:root {
  color-scheme: light;
  --ink: #17231d;
  --muted: #657169;
  --line: #dce4df;
  --paper: #ffffff;
  --canvas: #f4f7f4;
  --green: #176b4a;
  --green-dark: #0d4d34;
  --amber: #a66a10;
  --red: #a33b32;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 15px/1.6 system-ui, "Microsoft YaHei", sans-serif; }
button, input, textarea { font: inherit; }
.site-header, main { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
.site-header { display: flex; justify-content: space-between; gap: 32px; align-items: end; padding: 56px 0 30px; }
.eyebrow { margin: 0 0 8px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .14em; }
h1 { margin: 0; font-size: clamp(32px, 5vw, 52px); line-height: 1.12; letter-spacing: -.04em; }
.subtitle { margin: 14px 0 0; color: var(--muted); font-size: 17px; }
.scope-badge { border: 1px solid #b9d1c4; border-radius: 999px; padding: 7px 14px; color: var(--green-dark); background: #eaf4ee; white-space: nowrap; }
main { padding-bottom: 70px; }
.panel, #report-section { margin-top: 20px; padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: 0 12px 35px rgba(30, 55, 41, .06); }
.section-heading, .section-heading > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-heading h2 { margin: 0; font-size: 20px; }
.capability-boundary { max-width: 880px; margin-left: auto; line-height: 1.15; text-align: left; }
.upload-heading-actions { min-width: 0; flex: 1; justify-content: flex-end !important; }
.review-history-button { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; min-height: 38px; padding: 7px 14px; border: 1px solid #9bb7f2; border-radius: 9px; color: var(--blue); background: #fff; text-decoration: none; font-size: 13px; font-weight: 800; white-space: nowrap; box-shadow: 0 4px 12px rgba(8, 73, 223, .08); }
.review-history-button:hover { border-color: var(--blue); background: #eef4ff; }
.step { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--green); color: white; font-size: 12px; font-weight: 800; }
.hint, .status, .boundary { color: var(--muted); font-size: 13px; }
.drop-zone { display: grid; gap: 5px; margin-top: 24px; padding: 38px; border: 1.5px dashed #9eb9aa; border-radius: 14px; background: #f7fbf8; text-align: center; cursor: pointer; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone strong { font-size: 17px; }
.drop-zone span { color: var(--muted); }
.drop-zone .upload-limit { color: var(--blue); font-size: 12px; }
.file-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.file-chip { padding: 5px 10px; border-radius: 8px; background: #edf2ef; color: #425048; font-size: 13px; }
button { border: 0; border-radius: 10px; padding: 11px 20px; font-weight: 700; cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
.primary { background: var(--green); color: white; }
.primary:hover { background: var(--green-dark); }
.secondary { margin-top: 18px; background: #e8f1ec; color: var(--green-dark); }
.extracted-fields { display: grid; gap: 14px; margin-top: 18px; }
.field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.party-group { padding: 15px; border: 1px solid #cfdaef; border-radius: 12px; background: #f7f9ff; }
.party-group h3 { margin: 0 0 10px; color: var(--blue); font-size: 15px; }
.field-item { display: grid; gap: 3px; }
.field-item label { font-weight: 700; }
.field-item small { color: var(--muted); font-size: 11px; }
.field-label-editor { min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; color: var(--ink); background: #fbfcfb; font-size: 13px; }
.field-item textarea { min-height: 58px; resize: vertical; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; color: var(--ink); background: #fbfcfb; line-height: 1.45; }
.extraction-details { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 12px; margin-top: 18px; }
.fact-group { min-width: 0; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: #f9fbff; }
.fact-group h3 { margin: 0 0 9px; font-size: 15px; }
.compact-table-wrap { overflow-x: auto; }
.compact-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.compact-table th, .compact-table td { padding: 5px 7px; border-top: 1px solid var(--line); text-align: left; white-space: nowrap; }
.compact-table th { border-top: 0; color: var(--muted); font-size: 12px; }
.fact-list { display: grid; gap: 5px; margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.45; }
.empty-fact { color: var(--muted); }
.report-title { margin-bottom: 20px; }
.report-actions { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.report-actions select { border: 1px solid #bac8e6; border-radius: 8px; padding: 6px 28px 6px 9px; color: var(--ink); background: #fff; }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.report-card { border: 1px solid var(--line); border-top: 4px solid var(--green); border-radius: 14px; padding: 22px; }
.report-card.future { border-top-color: var(--amber); }
.report-card h3 { margin: 0; font-size: 20px; }
.release-status { display: inline-block; margin: 8px 0 16px; padding: 3px 9px; border-radius: 6px; background: #f7ecea; color: var(--red); font-weight: 700; }
.issue { padding: 13px 0; border-top: 1px solid var(--line); }
.issue p { margin: 0; }
.issue-meta { color: var(--muted); font-size: 12px; }
.issue a { color: var(--green); }
.check-summary { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 12px; }
.status-pill, .result-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 9px; font-size: 12px; font-weight: 800; }
.check-result { margin-top: 9px; padding: 12px 13px; border: 1px solid; border-left-width: 5px; border-radius: 10px; background: #fff; }
.check-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.check-heading strong { font-size: 14px; }
.check-result p { margin: 4px 0 0; font-size: 13px; line-height: 1.5; }
.check-result a { display: inline-block; margin-top: 5px; color: var(--blue); font-size: 12px; }
.check-authority { color: #42527a; font-weight: 700; }
.check-meta { color: var(--muted); font-size: 11px !important; }
.status-compliant { border-color: #79c69f; background: #f0faf5; color: #176b4a; }
.status-noncompliant { border-color: #e49a94; background: #fff4f3; color: #b42318; }
.status-pending { border-color: #e3bd72; background: #fff9ec; color: #9a5c00; }
.hidden { display: none !important; }

@media (max-width: 760px) {
  .site-header { align-items: start; padding-top: 32px; }
  .scope-badge { display: none; }
  .panel, #report-section { padding: 20px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .capability-boundary { max-width: none; margin-left: 0; }
  .upload-heading-actions { width: 100%; align-items: flex-start !important; flex-direction: column; }
  .report-actions { width: 100%; flex-wrap: wrap; }
  .field-grid, .report-grid, .extraction-details { grid-template-columns: 1fr; }
  .drop-zone { padding: 28px 14px; }
}

.history-main { padding-top: 20px; }
.history-panel { min-height: 420px; }
.history-list { display: grid; gap: 10px; margin-top: 20px; }
.history-item { display: grid; grid-template-columns: minmax(180px, 1.5fr) minmax(150px, 1fr) minmax(130px, .8fr) minmax(130px, .8fr) auto; align-items: center; gap: 18px; padding: 15px 17px; border: 1px solid #d8e2f5; border-radius: 12px; background: #fff; }
.history-item:hover { border-color: #a8bff0; box-shadow: 0 7px 18px rgba(34, 66, 132, .08); }
.history-file { min-width: 0; }
.history-file strong { display: block; overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.history-file small, .history-time { color: var(--muted); font-size: 12px; }
.history-result { display: grid; gap: 3px; }
.history-result span:first-child { color: var(--muted); font-size: 11px; }
.history-status { font-weight: 800; }
.history-status.status-ready { color: var(--green); }
.history-status.status-revise { color: var(--red); }
.history-status.status-pending { color: var(--amber); }
.history-view { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 7px 13px; border-radius: 8px; color: #fff; background: var(--blue); text-decoration: none; font-size: 13px; font-weight: 800; white-space: nowrap; }
.history-view:hover { background: var(--blue-dark); }
.history-empty { margin: 70px 0; color: var(--muted); text-align: center; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 24px; }
.pagination button { min-width: 86px; padding: 8px 14px; border: 1px solid #b9c8e8; color: var(--blue); background: #fff; }
.pagination button:hover:not(:disabled) { background: #eef4ff; }
.pagination button:disabled { cursor: not-allowed; opacity: .45; }
.page-indicator { min-width: 80px; color: var(--muted); text-align: center; font-size: 13px; }

@media (max-width: 900px) {
  .history-item { grid-template-columns: 1fr 1fr; }
  .history-file { grid-column: 1 / -1; }
  .history-view { justify-self: end; }
}

@media (max-width: 560px) {
  .history-item { grid-template-columns: 1fr; gap: 10px; }
  .history-file { grid-column: auto; }
  .history-view { justify-self: stretch; }
}

/* Foodaite tool-page visual system */
:root {
  --blue: #0849df;
  --blue-dark: #073fcb;
  --blue-2: #0b53f0;
  --ink: #121d47;
  --muted: #67738f;
  --line: #dce4f2;
  --paper: #ffffff;
  --canvas: #f4f7fc;
  --green: #1a8f60;
  --green-dark: #15744f;
  --amber: #b66b08;
  --red: #c62828;
  --shadow: 0 10px 26px rgba(34, 66, 132, .10);
}

body {
  background:
    radial-gradient(circle at 10% 20%, rgba(92, 136, 255, .08), transparent 24%),
    radial-gradient(circle at 88% 8%, rgba(100, 127, 255, .06), transparent 18%),
    var(--canvas);
  background-attachment: fixed;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
}

.tool-header {
  position: relative;
  width: 100%;
  color: #fff;
  background: linear-gradient(90deg, #054cdb 0%, #0747d6 60%, #0a42ca 100%);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .08);
}

.header-inner, main {
  width: min(1540px, calc(100% - 56px));
  max-width: 1540px;
  margin: 0 auto;
}

.header-inner { padding: 16px 0 26px; }
.compact-header { position: relative; min-height: 126px; text-align: center; }
.back-home {
  position: absolute;
  top: 16px;
  left: 0;
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, .10);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}
.back-home:hover { background: rgba(255, 255, 255, .2); }
.tool-title { display: flex; justify-content: center; align-items: center; gap: 10px; padding-top: 34px; }
.tool-title-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--blue); background: #fff; font-size: 20px; font-weight: 900; box-shadow: 0 7px 18px rgba(0,0,0,.16); }
h1 { color: #fff; font-size: clamp(27px, 3vw, 38px); letter-spacing: -.02em; }
.tool-header h1 { padding: 0 !important; text-align: center; font-size: 1.75rem !important; }
.tool-meta-actions { display: inline-flex; align-items: center; gap: 8px; }
.tool-version { display: inline-flex; align-items: center; min-height: 28px; padding: 5px 10px; border: 1px solid rgba(255,255,255,.45); border-radius: 999px; color: #fff; background: rgba(255,255,255,.14); font-size: 12px; font-weight: 800; line-height: 1; }
.update-history-button { min-height: 34px; padding: 6px 12px; border: 1px solid rgba(255,255,255,.45); border-radius: 8px; color: #fff; background: rgba(255,255,255,.08); font-size: 12px; font-weight: 700; }
.update-history-button:hover { background: rgba(255,255,255,.18); }
.subtitle { margin: 5px 0 0; color: rgba(255,255,255,.86); font-size: 13px; }
.tool-header > .user-menu { position: absolute; top: 16px; right: 20px; z-index: 100; }
.user-menu-button { display: flex; align-items: center; gap: 6px; padding: 6px 14px; border: 1px solid rgba(255,255,255,.3); border-radius: 16px; color: #fff; background: rgba(255,255,255,.25); box-shadow: none; font-size: .85em; font-weight: 700; white-space: nowrap; backdrop-filter: blur(4px); }
.user-menu-button:hover { background: rgba(255,255,255,.4); }
.menu-chevron { margin-left: auto; font-size: 14px; }
.user-dropdown { position: absolute; top: 40px; right: 0; min-width: 180px; overflow: hidden; padding: 8px 0; border-radius: 10px; color: #333; background: #fff; box-shadow: 0 4px 20px rgba(0,0,0,.15); text-align: left; }
.user-dropdown[hidden] { display: none; }
.user-phone { padding: 12px 16px 8px; color: #999; font-size: 13px; }
.user-dropdown a, .logout-button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 16px; border: 0; border-radius: 0; color: #333; background: #fff; text-decoration: none; font-size: 14px; font-weight: 400; }
.user-dropdown a span { color: var(--blue); }
.user-dropdown a:hover { background: #f5f7fb; }
.logout-button { border-top: 1px solid #eef0f4; color: #ef4444; text-align: left; }
.logout-button:hover { background: #fff7f7; transform: none !important; }

main { padding: 2px 0 70px; }
.tool-meta { margin-top: 28px; padding: 34px 0 12px; color: #667085; }
.contributor-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.tool-meta-title { display: flex; align-items: center; gap: 12px; margin: 0; color: #17213b; font-size: 17px; line-height: 26px; }
.tool-meta-title::before { width: 5px; height: 26px; border-radius: 3px; background: #1261f3; content: ""; }
.contributor-intro { margin: 0; color: #7d89a3; font-size: 13px; line-height: 26px; }
.contributor-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.contributor-card { display: flex; align-items: center; gap: 12px; min-height: 74px; padding: 14px 16px; border: 1px solid #dfe6f2; border-radius: 12px; background: rgba(255,255,255,.82); box-shadow: 0 5px 14px rgba(39,72,130,.07); }
.contributor-icon { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; border-radius: 50%; color: #1261f3; background: #edf3ff; font-size: 18px; }
.tool-meta-content { color: #344054; font-size: 14px; }
.contributor-invite { margin: 2px 0 0; color: #7d89a3; font-size: 12px; line-height: 1.45; }
.update-history-modal { position: fixed; inset: 0; z-index: 1000; display: none; place-items: center; padding: 20px; background: rgba(15,23,42,.48); }
.update-history-modal.show { display: grid; }
.update-history-dialog { width: min(520px, 100%); padding: 22px; border-radius: 16px; background: #fff; box-shadow: 0 24px 70px rgba(15,23,42,.26); }
.update-history-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.update-history-header h2 { margin: 0; color: #17213b; font-size: 18px; }
.update-history-close { width: 32px; height: 32px; padding: 0; border: 1px solid #e4e7ec; border-radius: 50%; color: #667085; background: #f8fafc; }
.update-history-item { display: grid; grid-template-columns: 88px 112px 1fr; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid #f0f2f5; color: #667085; font-size: 14px; }
.update-history-item strong { color: #1261f3; }
.panel, #report-section {
  margin-top: 18px;
  border-color: #e1e7f2;
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.step { background: linear-gradient(135deg, #0953e7, #0a45dd); box-shadow: 0 5px 12px rgba(14,83,229,.2); }
.drop-zone { border-color: #aebfe4; background: linear-gradient(180deg, #f8faff, #f2f6ff); }
.drop-zone:hover { border-color: var(--blue-2); background: #f7f9ff; }
.file-chip { background: #edf4ff; color: var(--blue); }
button { transition: transform .18s ease, box-shadow .18s ease; }
button:hover:not(:disabled) { transform: translateY(-1px); }
.primary {
  background: linear-gradient(90deg, #0953e7, #0a45dd);
  box-shadow: 0 8px 18px rgba(14,83,229,.22);
}
.primary:hover { background: linear-gradient(90deg, #0b5af4, #0849df); }
.secondary {
  background: #fff;
  color: var(--blue);
  border: 2px solid var(--blue);
}
.asset-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 220px));
  gap: 12px;
  margin: 12px 0;
}
.asset-previews:empty { display: none; }
.asset-preview {
  margin: 0;
  overflow: hidden;
  border: 1px solid #dfe6f3;
  border-radius: 10px;
  background: #f7f9fd;
}
.asset-preview-image {
  display: block;
  width: 100%;
  height: 150px;
  object-fit: contain;
  background: #fff;
}
.asset-preview-file {
  display: grid;
  height: 110px;
  place-items: center;
  color: var(--blue);
  font-weight: 700;
}
.asset-preview figcaption {
  overflow: hidden;
  padding: 8px 10px;
  color: #52617d;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.field-item textarea { border: 1.5px solid #bac8e6; color: #263556; background: #fff; }
.field-item textarea:focus { outline: none; border-color: #3870f0; box-shadow: 0 0 0 4px rgba(43,103,236,.08); }
.report-card { border-color: #dfe6f3; border-top-color: var(--blue); }
.report-card.future { border-top-color: #7d4df2; }
.issue a { color: var(--blue-2); }

@media (max-width: 760px) {
  .header-inner, main { width: calc(100% - 24px); }
  .header-inner { padding: 12px 0 18px; }
  .compact-header { min-height: 150px; }
  .back-home { top: 12px; }
  .tool-header > .user-menu { top: 12px; right: 16px; }
  .tool-title { padding-top: 48px; gap: 8px; }
  .tool-title { flex-wrap: wrap; }
  .tool-meta-actions { width: 100%; justify-content: center; }
  .tool-title-icon { width: 30px; height: 30px; font-size: 17px; }
  h1 { font-size: 23px; }
  .subtitle { font-size: 13px; }
  .contributor-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .contributor-intro { line-height: 1.6; }
  .update-history-item { grid-template-columns: 1fr; gap: 4px; }
}
