:root {
  --ink: #172433;
  --navy: #17324d;
  --navy-2: #244a69;
  --paper: #f4f1eb;
  --surface: #fffefa;
  --line: #dcd8cf;
  --muted: #69737d;
  --amber: #d9a13b;
  --amber-soft: #fff3d6;
  --red: #b83a3a;
  --red-soft: #fbe6e4;
  --green: #32705a;
  --green-soft: #e5f2ec;
  --purple: #71508e;
  --purple-soft: #efe7f5;
  --blue: #336b8b;
  --blue-soft: #e5f0f6;
  --shadow: 0 16px 45px rgba(35, 45, 55, 0.08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--paper); }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 2%, rgba(218, 180, 99, 0.16), transparent 28%),
    linear-gradient(180deg, #f8f6f1 0, var(--paper) 35%, #eeece6 100%);
  font-family: Arial, "Microsoft YaHei", sans-serif;
}

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

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

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  background: rgba(255, 254, 250, 0.9);
  border-bottom: 1px solid rgba(23, 50, 77, 0.12);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand-block { display: flex; align-items: center; gap: 13px; }
.brand-block h1 { margin: 1px 0 0; font-family: Georgia, serif; font-size: 23px; letter-spacing: -0.02em; }
.eyebrow, .section-label { margin: 0; color: #7d6a49; font-size: 10px; font-weight: 800; letter-spacing: 0.15em; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: var(--navy); display: grid; place-content: center; gap: 3px; transform: rotate(-2deg); box-shadow: 0 8px 18px rgba(23, 50, 77, 0.18); }
.brand-mark span { display: block; width: 20px; height: 3px; background: #f5cf79; border-radius: 9px; }
.brand-mark span:nth-child(2) { width: 14px; }

.top-actions { display: flex; align-items: center; gap: 10px; }
.button { min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: 150ms ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--navy); box-shadow: 0 8px 18px rgba(23, 50, 77, 0.14); }
.button-primary:hover { background: #0f263c; }
.button-secondary { color: var(--navy); border-color: rgba(23, 50, 77, 0.22); background: #fff; }
.button-ghost { color: var(--muted); background: transparent; }
.button-ghost:hover { background: rgba(23, 50, 77, 0.06); }

.workspace { max-width: 1540px; margin: 0 auto; padding: 34px; }
.intro-panel { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.intro-panel h2 { margin: 13px 0 7px; font-family: Georgia, "Microsoft YaHei", serif; font-size: clamp(28px, 3vw, 44px); font-weight: 500; letter-spacing: -0.025em; }
.intro-panel p { margin: 0; color: var(--muted); font-size: 14px; }
.standard-line { display: flex; align-items: center; gap: 9px; color: var(--navy); font-size: 13px; }
.standard-badge { padding: 5px 8px; border-radius: 6px; color: #7d5a1a; background: #f8e9c4; font-size: 11px; font-weight: 800; }
.privacy-note { color: var(--green); padding-left: 10px; border-left: 1px solid var(--line); }

.review-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 14px; color: var(--muted); font-size: 12px; }
.review-legend span { display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-fail { background: var(--red); }
.dot-missing { background: var(--amber); }
.dot-method { background: var(--purple); }
.dot-review { background: var(--blue); }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.metric-card { min-height: 116px; padding: 20px; border-radius: 15px; border: 1px solid rgba(23, 50, 77, 0.1); background: rgba(255, 254, 250, 0.88); box-shadow: 0 10px 28px rgba(35, 45, 55, 0.045); }
.metric-card .metric-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.metric-card .metric-icon { width: 31px; height: 31px; border-radius: 9px; display: grid; place-items: center; font-weight: 900; }
.metric-card strong { display: block; margin-top: 12px; font-family: Georgia, serif; font-size: 31px; line-height: 1; }
.metric-card small { color: var(--muted); font-size: 11px; }
.metric-reports .metric-icon { color: var(--navy); background: #e7edf1; }
.metric-fail .metric-icon { color: var(--red); background: var(--red-soft); }
.metric-missing .metric-icon { color: #8a651e; background: var(--amber-soft); }
.metric-review .metric-icon { color: var(--purple); background: var(--purple-soft); }

.content-grid { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 18px; align-items: start; }
.panel { background: rgba(255, 254, 250, 0.94); border: 1px solid rgba(23, 50, 77, 0.11); border-radius: 17px; box-shadow: var(--shadow); }
.report-panel { position: sticky; top: 94px; max-height: calc(100vh - 120px); padding: 18px 14px 14px; overflow: hidden; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 1px 6px 15px; }
.panel-heading h3, .modal-header h3 { margin: 4px 0 0; font-size: 18px; }
.count-pill { min-width: 27px; height: 27px; padding: 0 8px; border-radius: 9px; color: #fff; background: var(--navy); display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.search-box { height: 39px; margin: 0 3px 12px; display: flex; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: #faf9f6; color: var(--muted); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.report-list { overflow-y: auto; max-height: calc(100vh - 240px); padding-right: 3px; scrollbar-width: thin; }
.report-card { width: 100%; border: 0; border-left: 3px solid transparent; border-radius: 10px; background: transparent; padding: 13px 10px; display: block; text-align: left; transition: 150ms ease; }
.report-card:hover { background: #f4f2ed; }
.report-card.active { border-left-color: var(--amber); background: #f1eee7; }
.report-card-top { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.report-card strong { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.report-card p { margin: 5px 0 0; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-card .report-mini { margin-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.report-card .report-mini span:last-child { color: var(--muted); font-size: 10px; }

.review-panel { min-width: 0; overflow: hidden; }
.review-header { padding: 21px 24px 18px; border-bottom: 1px solid var(--line); }
.review-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.review-title-row h3 { margin: 4px 0 5px; font-size: 21px; letter-spacing: -0.015em; }
.review-title-row p { margin: 0; color: var(--muted); font-size: 12px; }
.meta-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.meta-item { padding: 10px 12px; border-radius: 9px; background: #f5f3ee; min-width: 0; }
.meta-item span { display: block; color: var(--muted); font-size: 10px; }
.meta-item strong { display: block; margin-top: 3px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.toolbar { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.filter-group { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip { border: 1px solid transparent; border-radius: 999px; padding: 7px 11px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 700; }
.filter-chip:hover { background: #f1efea; }
.filter-chip.active { color: var(--navy); border-color: #cfd9e0; background: #eaf0f3; }
.text-button { border: 0; background: transparent; color: var(--navy-2); font-size: 12px; font-weight: 800; white-space: nowrap; }

.table-wrap { min-height: 480px; overflow-x: auto; }
.comparison-table, .rules-table { width: 100%; border-collapse: collapse; }
.comparison-table { min-width: 830px; }
.comparison-table th, .rules-table th { color: #656e76; background: #f4f2ed; text-align: left; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; }
.comparison-table th { padding: 12px 16px; }
.comparison-table td { padding: 14px 16px; border-top: 1px solid #e7e3dc; vertical-align: top; font-size: 12px; }
.comparison-table tbody tr { cursor: pointer; transition: 120ms ease; }
.comparison-table tbody tr:hover { background: #faf8f4; }
.item-cell strong { display: block; font-size: 12px; }
.item-cell span, .subtle { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.method-text { max-width: 190px; color: #4e5b66; }
.raw-result { font-family: Consolas, monospace; font-size: 11px; }
.required-value { color: var(--navy); font-weight: 700; }

.status-badge { display: inline-flex; align-items: center; gap: 6px; min-height: 25px; padding: 4px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-PASS { color: var(--green); background: var(--green-soft); }
.status-FAIL { color: var(--red); background: var(--red-soft); }
.status-MISSING { color: #8a651e; background: var(--amber-soft); }
.status-PARTIAL { color: #8a651e; background: #fff0cc; }
.status-UNRECOGNIZED { color: #71508e; background: #efe7f5; }
.status-UNPARSED { color: #59636b; background: #ececeb; }
.status-METHOD { color: var(--purple); background: var(--purple-soft); }
.status-REVIEW { color: var(--blue); background: var(--blue-soft); }
.status-ID { color: #9c3939; background: #f5dddd; }
.status-NA { color: #6d7377; background: #ececeb; }
.status-OPEN { color: var(--red); background: var(--red-soft); }
.status-CLEARED { color: var(--green); background: var(--green-soft); }
.empty-state { min-height: 390px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); gap: 7px; }
.empty-icon { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--green-soft); color: var(--green); font-size: 19px; }
.empty-state strong { color: var(--ink); }
.empty-state span { font-size: 12px; }
.report-footnotes { display: flex; flex-wrap: wrap; gap: 8px; padding: 15px 20px 18px; border-top: 1px solid var(--line); background: #fbfaf7; }
.footnote-chip { padding: 7px 9px; border-radius: 7px; background: #f0eee8; color: var(--muted); font-size: 10px; }

.modal { width: min(720px, calc(100vw - 30px)); border: 0; padding: 0; background: transparent; overflow: visible; }
.modal::backdrop { background: rgba(20, 30, 38, 0.52); backdrop-filter: blur(4px); }
.modal-card { border-radius: 17px; background: var(--surface); box-shadow: 0 28px 80px rgba(12, 24, 34, 0.22); overflow: hidden; }
.modal-wide { width: min(980px, calc(100vw - 30px)); margin-left: 50%; transform: translateX(-50%); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 21px 23px 17px; border-bottom: 1px solid var(--line); }
.icon-button { width: 34px; height: 34px; border-radius: 9px; border: 0; background: #f0eee9; color: var(--muted); font-size: 22px; }
.notice { margin: 16px 22px 0; padding: 12px 14px; border-radius: 10px; font-size: 12px; line-height: 1.55; }
.notice-amber { color: #70521d; background: var(--amber-soft); border: 1px solid #edd89f; }
.rules-table-wrap { max-height: 62vh; overflow: auto; padding: 16px 22px 22px; }
.rules-table th, .rules-table td { padding: 10px 11px; border-bottom: 1px solid var(--line); font-size: 11px; text-align: left; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; padding: 20px 23px 10px; }
.form-grid label, .full-field, .manual-review-box label { display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.form-grid input, .form-grid select, .full-field textarea, .manual-review-box select, .manual-review-box textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; outline: none; color: var(--ink); background: #fff; }
.full-field { margin: 8px 23px 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 18px 23px 21px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; padding: 20px 23px 8px; }
.detail-box { min-height: 77px; padding: 11px 12px; border-radius: 9px; background: #f4f2ed; }
.detail-box span { display: block; color: var(--muted); font-size: 10px; }
.detail-box strong { display: block; margin-top: 6px; font-size: 12px; line-height: 1.45; }
.reason-box { margin: 8px 23px; padding: 13px 14px; border-left: 3px solid var(--amber); background: #fbf4e4; font-size: 12px; line-height: 1.55; }
.manual-review-box { margin: 15px 23px 0; padding: 14px; border-radius: 11px; background: #eef2f4; display: grid; grid-template-columns: 190px 1fr; gap: 12px; }

.toast { position: fixed; right: 26px; bottom: 26px; max-width: 360px; padding: 13px 16px; border-radius: 11px; color: #fff; background: var(--navy); box-shadow: 0 16px 38px rgba(12, 24, 34, 0.2); font-size: 12px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: 180ms ease; z-index: 50; }
.toast.visible { opacity: 1; transform: translateY(0); }

.panel-heading-actions { display: flex; align-items: center; gap: 8px; }
.icon-add-button { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid #d4dce1; border-radius: 8px; color: var(--navy); background: #fff; font-size: 17px; line-height: 1; }
.icon-add-button:hover { border-color: var(--navy); background: #eef3f6; }

.file-workbench { margin-bottom: 18px; padding: 18px; }
.file-workbench-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 2px 3px 14px; }
.file-workbench-heading h2 { margin: 4px 0; color: var(--ink); font-size: 20px; }
.file-workbench-heading p:not(.section-label) { margin: 0; color: var(--muted); font-size: 12px; }
.workbench-note { margin: 0 3px 12px; color: #80632b; font-size: 10px; }
.session-notice { margin: 0; padding: 10px 12px; border-radius: 10px; color: #41634f; background: #edf6f0; border: 1px solid #d2e5d8; font-size: 11px; line-height: 1.5; white-space: nowrap; }
.file-source-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.file-source-card { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fbfaf7; }
.file-source-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-height: 70px; }
.file-source-heading h3 { display: inline; margin: 0 0 0 7px; font-size: 15px; }
.file-source-heading p { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.file-step { color: #8d6e34; font-family: Georgia, serif; font-size: 13px; font-weight: 700; }
.text-danger-button { padding: 5px 7px; border: 0; color: var(--red); background: transparent; font-size: 11px; font-weight: 700; }
.text-danger-button:disabled { cursor: not-allowed; color: #a9adaf; }
.upload-zone { min-height: 104px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 1px dashed #aebbc4; border-radius: 11px; color: var(--navy); background: #f3f7f8; cursor: pointer; transition: 140ms ease; }
.upload-zone:hover { border-color: var(--navy); background: #eaf1f4; }
.upload-zone-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--navy); font-size: 17px; }
.upload-zone strong { font-size: 12px; }
.upload-zone small { color: var(--muted); font-size: 10px; }
.managed-file-list { max-height: 252px; display: flex; flex-direction: column; gap: 7px; margin-top: 12px; overflow-y: auto; }
.managed-file { display: grid; grid-template-columns: 30px minmax(0, 1fr) 28px; align-items: center; gap: 9px; padding: 9px; border: 1px solid #e4e0d8; border-radius: 9px; background: #fff; }
.managed-file.active-file { border-color: #9eb5c4; box-shadow: inset 3px 0 0 var(--navy-2); }
.file-type-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: var(--navy); background: #e8eef2; font-size: 9px; font-weight: 900; }
.managed-file-copy { min-width: 0; }
.managed-file-copy strong { display: block; overflow: hidden; color: var(--ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.managed-file-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.managed-file-copy .ready { color: var(--green); }
.managed-file-copy .pending { color: #8a651e; }
.remove-file-button { width: 27px; height: 27px; border: 0; border-radius: 7px; color: #8c6f6f; background: #f8eeee; font-size: 17px; line-height: 1; }
.remove-file-button:hover { color: #fff; background: var(--red); }
.file-list-empty { padding: 18px 10px; border-radius: 9px; color: var(--muted); background: #f2f0eb; text-align: center; font-size: 10px; }
.file-manager-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 2px 0; color: var(--muted); font-size: 10px; }
.danger-button { color: var(--red); border-color: #e6b9b6; background: #fff5f4; }
.danger-button:hover { color: #fff; background: var(--red); }
.review-empty { min-height: 166px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 8px; }
.review-empty h3 { margin: 0; }
.review-empty p { margin: 0 0 5px; color: var(--muted); font-size: 12px; }

@media (max-width: 980px) {
  .workspace { padding: 24px 18px; }
  .content-grid { grid-template-columns: 1fr; }
  .report-panel { position: static; max-height: none; }
  .report-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: none; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .meta-strip { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 680px) {
  .topbar { height: auto; min-height: 72px; padding: 12px 16px; gap: 12px; }
  .top-actions { gap: 6px; }
  .top-actions .button { min-height: 36px; padding: 0 10px; font-size: 11px; }
  .top-actions .button-ghost { display: none; }
  .eyebrow { display: none; }
  .intro-panel { align-items: flex-start; flex-direction: column; }
  .review-legend { justify-content: flex-start; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 100px; padding: 15px; }
  .report-list { grid-template-columns: 1fr; }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .meta-strip { grid-template-columns: repeat(2, 1fr); }
  .form-grid, .detail-grid, .manual-review-box { grid-template-columns: 1fr; }
  .privacy-note { display: none; }
  .file-workbench-heading { align-items: flex-start; flex-direction: column; }
  .file-source-grid { grid-template-columns: 1fr; }
  .file-manager-footer { align-items: flex-start; flex-direction: column; }
}
