:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #647282;
  --line: #d7dee8;
  --fill: #f5f7fa;
  --accent: #137c6b;
  --accent-2: #b9471b;
  --ok: #0f7a4f;
  --warn: #9a5b00;
  --bad: #a33a2f;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

.shell {
  width: min(1200px, calc(100% - 32px));
  margin: 24px auto;
}

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

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.topbar {
  padding: 10px 0 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 28px;
  width: 100%;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: clamp(230px, 28vw, 340px);
  max-width: 100%;
  height: auto;
  flex: 0 0 auto;
  object-fit: contain;
}

.brand-copy {
  width: 100%;
  min-width: 240px;
  max-width: 620px;
}

.brand-copy p {
  font-size: 15px;
  color: #516070;
}

.demo-guide {
  display: grid;
  gap: 10px;
  padding: 12px 0 4px;
}

.demo-guide-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 18px;
}

.demo-guide-head p {
  max-width: 860px;
  margin-top: 6px;
}

.login-link,
.demo-note a {
  color: #0f6f61;
  font-weight: 700;
  text-decoration: none;
}

.login-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #b6d8d2;
  background: #eef8f6;
  border-radius: 6px;
  white-space: nowrap;
}

.guide-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.guide-flow span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.guide-flow b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex: none;
}

.demo-note {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.demo-note a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.demo-note a:hover {
  text-decoration: underline;
}

.tagline-mobile {
  display: none;
}

h1 {
  margin: 0 0 8px;
  font-size: 26px;
  letter-spacing: 0;
}

h2,
h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  color: var(--muted);
}

.module-tabs {
  display: flex;
  gap: 8px;
  margin: 18px 0;
  overflow-x: auto;
}

.tab,
button,
.download {
  border: 1px solid transparent;
  background: var(--accent);
  color: white;
  padding: 10px 15px;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  border-radius: 6px;
}

.tab {
  background: white;
  color: var(--ink);
  border-color: var(--line);
  white-space: nowrap;
}

.tab.active {
  background: var(--accent);
  color: white;
}

button:disabled {
  opacity: .55;
  cursor: wait;
}

.download {
  display: inline-block;
  background: var(--accent-2);
}

.panel {
  display: none;
  padding: 18px 0 22px;
  border-top: 1px solid var(--line);
}

.panel.active {
  display: block;
}

.badge {
  color: var(--muted);
  background: white;
  border: 1px solid var(--line);
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
}

.upload,
.downloads,
.action-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 14px 0;
  flex-wrap: wrap;
}

.hs-search-bar {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) auto minmax(420px, 1.35fr) auto;
  align-items: end;
  gap: 14px;
}

.hs-search-bar label {
  display: grid;
  gap: 6px;
  color: var(--ink);
}

.hs-search-bar input[type="text"] {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
}

.hs-search-bar button {
  min-height: 46px;
}

.action-row {
  margin: 0;
}

.upload-block,
.optional-block {
  display: grid;
  gap: 12px;
  margin: 14px 0;
}

.mode-select {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 14px 0;
  color: var(--ink);
}

.mode-select label {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.ai-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 12px;
  padding: 8px 10px;
  background: #eef8f6;
  border: 1px solid #b6d8d2;
  border-radius: 6px;
  color: var(--accent);
  font-size: 14px;
}

.ai-retry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  margin: 10px 0 12px;
  padding: 9px 10px;
  background: #eef8f6;
  border: 1px solid #b6d8d2;
  border-radius: 6px;
  color: var(--accent);
  font-size: 14px;
}

.ai-retry[hidden] {
  display: none;
}

.ai-retry button {
  border: 0;
  background: var(--accent);
  color: white;
  padding: 8px 10px;
  cursor: pointer;
  min-width: 136px;
}

.ai-retry button:disabled {
  background: #e2eeeb;
  color: #315f57;
  border: 1px solid #a8c8c1;
  cursor: wait;
  opacity: 1;
}

.ai-retry span {
  overflow-wrap: anywhere;
}

.advisory {
  max-width: 980px;
  margin: 8px 0 12px;
  padding: 10px 12px;
  border: 1px solid #d4e0e8;
  background: #f8fbfd;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 980px;
  margin: 8px 0 12px;
  padding: 11px 12px;
  border: 1px solid #b9dcd6;
  background: #edf8f6;
  color: #245b54;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.privacy-icon {
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #d7eee9;
  color: var(--accent);
  font-size: 14px;
}

.privacy-note strong {
  display: block;
  margin-bottom: 3px;
  color: #123f38;
}

.privacy-note a {
  display: inline-block;
  color: #0f6f61;
  font-weight: 700;
  text-decoration: none;
  margin-top: 4px;
}

.privacy-note-footer {
  max-width: none;
  margin: 28px 0 12px;
}

.privacy-note a:hover,
.site-footer a:hover,
.legal-actions a:hover,
.legal-back:hover {
  text-decoration: underline;
}

.force-panel {
  display: grid;
  gap: 10px;
  margin: 4px 0 12px;
  padding: 9px 10px;
  background: #fff8f2;
  border: 1px solid #e5c47c;
  color: var(--warn);
  border-radius: 6px;
  max-width: 760px;
}

.force-panel button {
  width: fit-content;
  background: var(--accent-2);
}

.force-issues {
  display: grid;
  gap: 6px;
}

.force-issues div {
  padding: 7px 8px;
  background: white;
  border: 1px solid #efc1a8;
  color: var(--bad);
  border-radius: 4px;
}

.force-note {
  margin: 0;
  color: var(--warn);
  font-size: 13px;
}

.optional-block {
  padding: 12px;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.optional-title {
  font-weight: 700;
}

input[type="file"],
.field input,
textarea {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
}

input[type="file"] {
  min-width: min(420px, 100%);
  padding: 9px;
}

.file-slot {
  display: grid;
  gap: 6px;
  min-width: min(420px, 100%);
}

.file-slot span {
  color: var(--muted);
  font-size: 13px;
}

textarea {
  display: block;
  width: 100%;
  min-height: 88px;
  resize: vertical;
  padding: 10px 12px;
  margin: 12px 0;
}

.status {
  min-height: 38px;
  padding: 10px 12px;
  background: white;
  border: 1px solid var(--line);
  color: var(--muted);
  overflow-wrap: anywhere;
}

.progress-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: 8px 0 14px;
}

.progress-bar {
  height: 9px;
  background: #dfe7ee;
  border: 1px solid var(--line);
  overflow: hidden;
}

.progress-bar span {
  display: block;
  width: 4%;
  height: 100%;
  background: var(--accent);
  transition: width .25s ease;
}

.progress-wrap small {
  color: var(--muted);
  font-size: 12px;
  min-width: 38px;
  text-align: right;
}

.confirm {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.issue-list {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.issue {
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: white;
}

.issue.bad {
  color: var(--bad);
  border-color: #e3b2ab;
}

.issue.warn {
  color: var(--warn);
  border-color: #e5c47c;
}

.issue.notice {
  color: var(--muted);
  border-color: var(--line);
}

.check-result {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.panel-head.compact {
  margin-bottom: 4px;
}

.panel-head.compact h3 {
  margin: 0;
  font-size: 16px;
}

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

.issue-columns section {
  min-width: 0;
}

.issue-columns h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

.confirm-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.confirm-title {
  grid-column: 1 / -1;
  font-weight: 700;
  padding: 8px 0 2px;
}

.raw-tables {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  padding: 12px;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.raw-tables h4 {
  margin: 0;
  font-size: 14px;
}

.raw-table-wrap {
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
}

.raw-table-title {
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: var(--fill);
  border-bottom: 1px solid var(--line);
}

.raw-table {
  min-width: 720px;
  font-size: 12px;
}

.raw-table td {
  white-space: pre-wrap;
}

.ocr-text-output {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.ocr-text-output h4 {
  margin: 0;
  font-size: 14px;
}

.ocr-page-text {
  display: grid;
  gap: 6px;
}

.ocr-page-text strong {
  color: var(--muted);
  font-size: 12px;
}

.ocr-page-text pre {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f8fafb;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.55;
}

.field {
  display: grid;
  gap: 6px;
  padding: 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.field.needs-review {
  border-color: #df8f83;
  background: #fff8f7;
}

.field span {
  font-size: 12px;
  color: var(--muted);
}

.field input {
  width: 100%;
  min-width: 0;
  padding: 8px 9px;
}

.field small {
  min-height: 16px;
  color: var(--bad);
  line-height: 1.35;
}

.table-wrap {
  background: white;
  border: 1px solid var(--line);
  overflow: auto;
  max-height: 58vh;
  margin-top: 14px;
}

.hs-query-wrap {
  max-height: none;
  overflow-x: auto;
}

#hsQueryTable {
  min-width: 980px;
  table-layout: fixed;
}

#hsQueryTable th:nth-child(1) { width: 92px; }
#hsQueryTable th:nth-child(2) { width: 430px; }
#hsQueryTable th:nth-child(3) { width: 90px; }
#hsQueryTable th:nth-child(4) { width: 120px; }
#hsQueryTable th:nth-child(5) { width: 340px; }

#hsQueryTable td {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.cell-block {
  display: table-cell;
}

.cell-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.cell-value {
  display: block;
}

.hs-fr .cell-value {
  font-weight: 700;
}

.hs-context .cell-value {
  color: #3f4e5d;
}

.hs-warning .cell-value {
  color: var(--warn);
}

.hs-reason .cell-value {
  color: #3f4e5d;
}

.hs-designation-cell {
  display: grid;
  gap: 10px;
}

.hs-designation-line {
  display: grid;
  gap: 3px;
}

.hs-designation-line:first-child .cell-value {
  color: var(--ink);
  font-weight: 700;
}

.hs-designation-line .cell-value {
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
}

.hs-customer-designation {
  gap: 7px;
}

.hs-customer-designation .hs-designation-line:first-child .cell-value {
  font-size: 13px;
}

.hs-customer-designation .hs-designation-line:not(:first-child) .cell-value {
  color: #3f4e5d;
}

#hsQueryTable .hs-rate {
  font-weight: 700;
  color: var(--ink);
}

#hsQueryTable .hs-remark {
  color: #3f4e5d;
}

.hs-remark-text {
  margin-bottom: 8px;
}

.hs-common-names {
  display: grid;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid #e3e9ef;
  color: #3f4e5d;
}

.hs-common-names-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.hs-common-names-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.hs-common-name {
  display: inline-block;
  padding: 3px 6px;
  border: 1px solid #d4e0e8;
  background: #f8fbfd;
  border-radius: 4px;
  color: #34515f;
  font-size: 12px;
  line-height: 1.25;
}

#hsQueryTable .hs-more-results td {
  background: #f7fbfa;
  color: #34515f;
  font-size: 13px;
  line-height: 1.45;
  border: 1px solid var(--line);
}

@media (max-width: 900px) {
  .hs-search-bar {
    grid-template-columns: 1fr;
  }

  .hs-search-bar button {
    width: 100%;
  }
}

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

  .login-link {
    width: fit-content;
    white-space: normal;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

th {
  position: sticky;
  top: 0;
  background: var(--fill);
  z-index: 1;
}

td.num,
th.num {
  text-align: right;
}

td.clip {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

td.clip:hover {
  white-space: normal;
  overflow: visible;
}

.hs-validation {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.risk-badge {
  display: inline-block;
  min-width: 78px;
  padding: 4px 7px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.risk-passed {
  color: #0c6b57;
  background: #e8f4f1;
}

.risk-warning {
  color: #935900;
  background: #fff4da;
}

.risk-high_risk,
.risk-missing {
  color: #9b271d;
  background: #fdecea;
}

.hs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hs-actions button {
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 4px;
  cursor: pointer;
}

.hs-actions button:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.hs-detail-row td {
  color: var(--muted);
  background: #f8fafb;
  white-space: pre-wrap;
}

.hs-disclaimer {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.hs-disclaimer p {
  margin: 0;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 28px 0 8px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.site-footer a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.site-footer span {
  max-width: 760px;
  line-height: 1.55;
}

.legal-page {
  max-width: 1000px;
  margin-top: 26px;
  margin-bottom: 34px;
}

.legal-hero {
  padding: 22px 0 20px;
  border-bottom: 1px solid var(--line);
}

.legal-back {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.legal-kicker {
  margin-bottom: 8px;
  color: var(--accent);
  font-weight: 700;
}

.legal-hero h1 {
  margin-bottom: 6px;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.15;
}

.legal-hero p {
  max-width: 860px;
  color: #526273;
  font-size: 16px;
}

.legal-card {
  margin-top: 18px;
  padding: 22px 24px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(31, 41, 51, .04);
}

.legal-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.legal-number {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 50%;
  background: #e6f3f0;
  color: var(--accent);
  font-weight: 800;
}

.legal-card h2 {
  font-size: 18px;
}

.legal-card p {
  margin: 10px 0 0;
  color: #334454;
  font-size: 15.5px;
  line-height: 1.72;
}

.legal-callout {
  margin: 8px 0 12px;
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  background: #edf8f6;
  color: #173f38;
  font-weight: 700;
  line-height: 1.6;
}

.legal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 22px;
}

.legal-actions a {
  display: inline-block;
  padding: 10px 15px;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 900px) {
  .panel-head,
  .issue-columns {
    display: block;
  }

  .shell {
    width: min(100% - 24px, 760px);
    margin: 14px auto 22px;
  }

  .topbar {
    padding: 6px 0 14px;
  }

  .brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .brand-logo {
    width: min(228px, 72vw);
  }

  .brand-copy {
    min-width: 0;
    width: min(100%, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
  }

  .brand-copy p {
    width: 100%;
    font-size: 14px;
    line-height: 1.45;
    overflow-wrap: break-word;
  }

  .tagline-desktop {
    display: none;
  }

  .tagline-mobile {
    display: inline;
  }

  .switch,
  .badge {
    margin-top: 12px;
  }

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

  .privacy-note {
    margin: 10px 0 14px;
    padding: 10px 11px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .legal-page {
    width: min(100% - 24px, 760px);
    margin-top: 14px;
  }

  .legal-hero {
    padding: 12px 0 16px;
  }

  .legal-card {
    margin-top: 14px;
    padding: 18px 16px;
  }

  .legal-card-head {
    align-items: flex-start;
  }

  .legal-actions {
    justify-content: stretch;
  }

  .legal-actions a {
    width: 100%;
    text-align: center;
  }
}
