/* V0.49 R8 — compact hero, visible manual entry and help. No Bulk or Rule Guard behavior. */
#auditPage {
  --home-width: 1920px;
  --home-gutter: clamp(22px, 2vw, 48px);
  padding-top: clamp(16px, 1.2vw, 24px);
}
#auditPage > .home-hero,
#auditPage > .home-workspace,
#auditPage > .home-safety {
  width: calc(100% - var(--home-gutter) - var(--home-gutter));
  max-width: var(--home-width);
  margin-left: auto;
  margin-right: auto;
}
/* The entire section fills the workspace; only reading lines have a measure. */
.home-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 0;
  text-align: center;
  background: linear-gradient(125deg, #fffdf5 0%, #fff 48%, #fcfdff 100%);
  border: 1px solid #e9e3d4;
  border-radius: 22px;
  box-shadow: 0 12px 32px #223b5310, 0 1px 2px #223b5303;
}
.home-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #ffecc0, #f5bc45 36%, #f5bc4540 76%, transparent);
  pointer-events: none;
}
.home-hero-content { padding: 10px clamp(24px, 2vw, 42px) 4px; }
.home-kicker {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  max-width: 100%; padding: 0 8px;
  border: 0; border-radius: 999px;
  background: transparent; color: #856222;
  font-size: 11px; font-weight: 650; line-height: 1.45;
}
.home-kicker svg { flex: 0 0 auto; }
.home-hero h2 {
  margin: 5px auto 3px; max-width: 32em;
  font-size: clamp(26px, 1.9vw, 32px); font-weight: 780;
  line-height: 1.25; letter-spacing: -.035em; color: #17232e;
  text-wrap: balance;
}
.home-pain { margin: 0 auto 3px; font-size: 13px; line-height: 1.5; color: #736a5c; }
.home-lead { max-width: 72em; margin: 0 auto; color: #415267; font-size: 14px; line-height: 1.5; text-wrap: pretty; }
.home-ai-actions { display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; margin: 8px 0 5px; }
.home-copy-primary {
  display: inline-flex; justify-content: center; align-items: center; gap: 11px;
  min-height: 52px; max-width: 100%; padding: 13px 28px;
  border: 1px solid #e3a51c; border-radius: 12px;
  background: linear-gradient(180deg, #ffcb54, #f7b933); color: #33270e;
  font-size: 16px; font-weight: 750; line-height: 1.5; white-space: normal;
  box-shadow: 0 4px 10px #d69c201c, inset 0 1px #ffffff66;
  transition: background .15s, box-shadow .15s;
}
.home-copy-primary:hover { background: #f4b129; box-shadow: 0 5px 16px #cb92192b; }
.home-copy-primary svg { flex: 0 0 auto; }
.home-copy-primary:disabled { opacity: .6; cursor: wait; }
.home-text-link { padding: 2px 0; border: 0; background: transparent; color: #536578; font-size: 13px; line-height: 1.5; cursor: pointer; text-underline-offset: 4px; }
.home-text-link:hover { text-decoration: underline; color: #263a4c; }
.home-text-link:disabled { opacity: .5; cursor: wait; }
.home-helper { margin: 0; font-size: 12px; color: #5e6d7e; line-height: 1.6; }
.home-ai-note { margin: 0; font-size: 12px; line-height: 1.75; color: #647585; }
.home-ai-note a { color: #566d80; text-decoration: none; border-bottom: 1px dotted #afbac1; }
.home-ai-note a:hover { color: #263a4c; border-bottom-style: solid; }
/* Non-blocking copy feedback; no reserved blank space in the compact hero. */
.home-copy-status { position: fixed; z-index: 100; left: 50%; bottom: 22px; transform: translateX(-50%); width: max-content; max-width: min(600px, calc(100vw - 36px)); margin: 0; padding: 11px 18px; border: 1px solid #c5e1d2; border-radius: 10px; box-shadow: 0 6px 20px #193b2e18; background: #f3fff8; color: #196048; font-size: 13px; line-height: 1.6; pointer-events: none; }
.home-copy-status:empty { visibility: hidden; }
.home-flow {
  list-style: none; margin: 0; padding: 3px 20px;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid #ece7d8;
  background: #fffdf8;
}
.home-flow li { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; padding: 0 12px; font-size: 11px; font-weight: 600; line-height: 1.6; color: #47596c; }
.home-flow li + li { border-left: 1px solid #e9e5dd; }
.home-flow-number { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 22px; height: 22px; border-radius: 6px; background: #eef2f7; color: #5a6c81; font-size: 11px; font-weight: 750; font-variant-numeric: tabular-nums; }
.home-flow li:first-child .home-flow-number { background: #fff0c9; color: #9a6c14; }
.home-flow li:last-child .home-flow-number { background: #ebf5f0; color: #43765d; }
#auditPage .home-workspace { display: block; padding: 0; margin-top: 18px; margin-bottom: 0; }
#auditPage .workspace-main { min-width: 0; gap: 18px; }
#bulkUploadPanel { scroll-margin-top: 105px; border-color: #e1e7ef; border-radius: 20px; box-shadow: 0 6px 24px #233b5508; }
.home-manual-heading { padding: 22px 30px 0; }
.home-manual-heading h3 { margin: 0 0 7px; font-size: 21px; font-weight: 730; letter-spacing: -.02em; line-height: 1.5; }
.home-manual-heading > p { margin: 0; color: #5f7082; font-size: 13px; line-height: 1.65; }
#bulkUploadPanel .dual-upload { padding: 22px 30px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; align-items: start; }
#bulkUploadPanel .upload-slot { min-width: 0; }
#bulkUploadPanel .slot-title { margin: 0 0 4px; min-height: 25px; gap: 9px; align-items: center; font-size: 14px; }
.home-file-number { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 24px; height: 24px; border: 1px solid #dbe5f3; border-radius: 7px; background: #eef4ff; color: #426498; font-size: 11px; font-weight: 700; }
#bulkUploadPanel .upload-slot:last-child .home-file-number { background: #fff5d9; border-color: #f1e2b8; color: #957026; }
.home-slot-help { margin: 0 0 12px 33px; color: #68788a; font-size: 12px; line-height: 1.5; }
#bulkUploadPanel .dropzone { min-height: 135px; padding: 16px 18px; text-align: center; border-color: #c8d7e8; border-radius: 14px; background: #f8fbff; gap: 7px; }
#bulkUploadPanel .upload-slot:last-child .dropzone { background: #fffcf5; border-color: #e2d5b4; }
#bulkUploadPanel .dropzone:hover, #bulkUploadPanel .dropzone.dragging { background: #fffaed; border-color: #cda448; box-shadow: inset 0 0 0 1px #efcc7433; }
#bulkUploadPanel .dropzone strong { font-size: 15px; font-weight: 650; line-height: 1.45; }
#bulkUploadPanel .dropzone span { font-size: 12px; line-height: 1.5; }
#bulkUploadPanel .drop-icon { display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; border: 1px solid #dde7f4; border-radius: 11px; background: #fff; color: #6588b4; line-height: 1; font-size: 26px; margin-bottom: 1px; }
#bulkUploadPanel .upload-slot:last-child .drop-icon { border-color: #f0e3c3; color: #a48749; }
#bulkUploadPanel .file-card { min-height: 135px; margin: 0; border-radius: 14px; }
#bulkUploadPanel .file-remove { opacity: 1; pointer-events: auto; }
#bulkUploadPanel .file-card .status-pill { margin-right: 30px; }
#bulkUploadPanel .file-info { overflow: hidden; }
.home-manual-footer { border-top: 1px solid #edf0f4; background: #fcfdff; padding: 16px 30px 19px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.home-upload-help { min-width: 0; }
.home-privacy { margin: 0 0 4px; display: flex; align-items: center; gap: 6px; color: #4e7164; font-size: 12px; line-height: 1.6; }
.home-privacy svg { flex: 0 0 auto; }
.home-upload-state { margin: 0; color: #778391; font-size: 12px; line-height: 1.6; }
.home-start-check { padding: 14px 32px; min-height: 56px; min-width: 200px; flex-shrink: 0; font-size: 16px; line-height: 1.5; white-space: normal; }
.home-start-check:disabled { opacity: 1; background: #edf1f5; color: #8693a1; cursor: not-allowed; }
.home-audit-options { border-top: 1px solid #edf0f4; }
.home-audit-options summary { cursor: pointer; padding: 13px 30px; color: #526272; font-size: 12px; line-height: 1.65; }
.home-audit-options summary small { margin-left: 12px; color: #82909d; font-size: 11px; }
.home-audit-options[open] summary { background: #f9fafc; border-bottom: 1px solid #edf0f4; }
.home-audit-options .settings-grid { padding: 18px 30px; }
#bulkUploadPanel .local-progress { margin-top: 0; }
#homeAuditOverview[hidden] { display: none !important; }
#auditPage .home-audit-overview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; min-width: 0; }
.home-audit-overview .summary-panel { grid-column: 1 / -1; }
.home-audit-overview .compare-metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; padding: 12px 20px 18px; }
.home-audit-overview .compare-metrics > div { border: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.home-audit-overview .compare-metrics strong { font-size: 19px; }
.home-safety { text-align: center; font-size: 11px; color: #81909d; line-height: 1.6; padding: 14px 0 10px; }
/* Native dialog: long instructions never reflow the page. */
.home-ai-dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); margin: auto; padding: 24px; border: 1px solid #dde5ec; border-radius: 15px; background: #fff; color: #253443; box-shadow: 0 24px 80px #0f1c3b40; overflow: auto; }
.home-ai-dialog:not([open]) { display: none !important; }
.home-ai-dialog::backdrop { background: #17233470; }
.home-dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.home-dialog-heading h3 { margin: 0; font-size: 17px; line-height: 1.5; }
.home-close { display: inline-flex; justify-content: center; align-items: center; flex: 0 0 32px; height: 32px; border: 1px solid #e1e6ed; background: #fff; border-radius: 8px; color: #6b7886; font-size: 22px; cursor: pointer; }
#homeDialogHint { margin: 8px 0 16px; font-size: 12px; color: #69798a; line-height: 1.7; }
#homeAiInstruction { width: 100%; height: min(340px, 44dvh); min-height: 160px; resize: vertical; display: block; border: 1px solid #dce3eb; background: #f8fafc; border-radius: 9px; padding: 14px; color: #364657; font: 12px/1.85 ui-sans-serif, system-ui, 'Microsoft YaHei', sans-serif; }
.home-dialog-status { margin: 8px 0; min-height: 20px; font-size: 12px; line-height: 1.7; color: #196048; }
.home-dialog-footer { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.home-dialog-footer button { max-width: 100%; white-space: normal; font-size: 12px; line-height: 1.5; }
#bulkUploadPanel:focus-visible, .home-copy-primary:focus-visible, .home-text-link:focus-visible, #homeManualCheck:focus-visible, .home-close:focus-visible, .home-audit-options summary:focus-visible, #bulkUploadPanel .dropzone:focus-visible { outline: 2px solid #297884; outline-offset: 3px; }
body.home-dialog-open { overflow: hidden; }
/* Brief localized release notes preserve the existing version menu. */
.version-switch { position: relative; display: block; }
.version-tooltip { position: absolute; right: 0; top: calc(100% + 8px); z-index: 80; width: max-content; max-width: min(360px, calc(100vw - 40px)); padding: 13px 16px; background: #182332; color: #fff; border-radius: 11px; box-shadow: 0 8px 24px #13202d26; text-align: left; pointer-events: auto; }
.version-tooltip[hidden] { display: none !important; }
.version-tooltip strong { display: block; font-size: 12px; line-height: 1.5; margin-bottom: 6px; }
.version-tooltip ul { margin: 0; padding-left: 16px; }
.version-tooltip li { font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.topbar > div:first-child { min-width: 0; }
.topbar h1 { font-size: 18px; }
.top-actions { flex-shrink: 0; }
/* Responsive structure: AI above manual on every screen. */

@media (max-width: 1080px) and (min-width: 821px) {
  .topbar { padding: 12px 24px; height: auto; min-height: 86px; gap: 12px; flex-wrap: wrap; }
  .topbar .top-actions { margin-left: auto; }
  .home-flow { padding-left: 10px; padding-right: 10px; }
  .home-flow li { gap: 8px; padding-left: 10px; padding-right: 10px; font-size: 12px; }
}
@media (max-width: 820px) {
  #auditPage { --home-gutter: 20px; padding-top: 20px; }
  .home-hero-content { padding: 15px 22px 9px; }
  .home-hero h2 { font-size: 28px; }
  .home-lead { font-size: 14px; }
  .home-manual-heading { padding: 22px 22px 0; }
  #bulkUploadPanel .dual-upload { padding: 18px 22px; gap: 18px; }
  .home-manual-footer { padding: 16px 22px 18px; }
  .home-audit-overview .compare-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  #auditPage { --home-gutter: 14px; padding-top: 16px; }
  .topbar { height: auto; min-height: 86px; padding: 12px 18px; flex-wrap: wrap; gap: 10px; }
  .topbar > div:first-child { flex: 1 1 100%; }
  .topbar h1 { font-size: 17px; line-height: 1.4; }
  .top-actions { width: 100%; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
  .lang-select { max-width: 170px; font-size: 11px; }
  .home-hero, #bulkUploadPanel { border-radius: 17px; }
  .home-hero-content { padding: 14px 16px 10px; }
  .home-hero h2 { margin-top: 7px; font-size: 24px; line-height: 1.32; }
  .home-kicker { font-size: 10.5px; padding: 0; gap: 6px; }
  .home-lead, .home-pain { font-size: 13px; }
  .home-ai-actions { flex-direction: column; gap: 8px; margin-top: 12px; margin-bottom: 8px; }
  .home-copy-primary { width: 100%; min-height: 50px; font-size: 14px; padding: 12px; }
  .home-helper { font-size: 12px; }
  .home-ai-note { font-size: 11px; }

  .home-flow { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; padding: 8px; text-align: center; }
  .home-flow li { justify-content: flex-start; flex-direction: column; padding: 0; gap: 4px; font-size: 10px; line-height: 1.45; }
  .home-flow li + li { border-left: 0; }
  .home-flow-number { height: 20px; width: 22px; flex-basis: 20px; font-size: 10px; border-radius: 6px; }
  #auditPage .home-workspace { margin-top: 18px; }
  .home-manual-heading { padding: 20px 18px 0; }
  .home-manual-heading h3 { font-size: 18px; }
  .home-manual-heading > p { font-size: 12px; }
  #bulkUploadPanel .dual-upload { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 18px; }
  #bulkUploadPanel .slot-title { font-size: 13px; }
  .home-slot-help { font-size: 11px; }
  .home-manual-footer { align-items: stretch; flex-direction: column; gap: 14px; padding: 16px 18px 18px; }
  .home-start-check { width: 100%; }
  .home-privacy, .home-upload-state { font-size: 11px; }
  .home-audit-options summary { padding-left: 18px; padding-right: 18px; }
  .home-audit-options summary small { display: block; margin-left: 16px; }
  #auditPage .home-audit-overview { grid-template-columns: minmax(0, 1fr); }
  .home-audit-overview .compare-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-ai-dialog { padding: 18px; }
  .home-dialog-footer { flex-wrap: wrap; }
  #bulkUploadPanel { scroll-margin-top: 145px; }
}
@media (prefers-reduced-motion: reduce) { .home-copy-primary { transition: none; } }

/* Manual route is a first-class action; the existing anchor handler owns focus/scroll. */
.home-manual-primary { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; min-width: 210px; max-width: 100%; padding: 13px 28px; border: 1px solid #172531; border-radius: 12px; background: #172531; color: #fff; font-size: 16px; font-weight: 750; line-height: 1.5; text-decoration: none; box-shadow: 0 4px 10px #17253115; }
.home-manual-primary:hover { background: #263b4b; border-color: #263b4b; }
.home-manual-primary svg { flex: 0 0 auto; }
.home-ai-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; column-gap: 14px; row-gap: 2px; }
.home-ai-meta .home-text-link { font-size: 12px; }
.home-local-badge { float: right; margin: 2px 0 6px 18px; color: #477061; font-size: 11px; line-height: 1.6; padding: 3px 8px; border: 1px solid #dcebe2; border-radius: 6px; background: #f7fcf9; }
.home-privacy { align-items: flex-start; max-width: 80em; }
.home-privacy svg { margin-top: 2px; }
.home-upload-state { margin-top: 6px; }
/* Old check lists and explanations must not be hidden with empty result summaries. */
.home-guidance { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 0; border: 1px solid #e1e7ef; border-radius: 16px; background: #fff; overflow: hidden; }
.home-checklist, .home-reminders { padding: 21px 26px; min-width: 0; }
.home-guidance h3 { font-size: 15px; line-height: 1.6; font-weight: 700; margin: 0 0 12px; color: #263848; }
.home-checklist { background: #f9fbfd; border-right: 1px solid #e7edf3; }
.home-check-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.home-check-items li { position: relative; padding-left: 20px; font-size: 12px; line-height: 1.65; color: #52677b; overflow-wrap: anywhere; }
.home-check-items li::before { content: "•"; position: absolute; left: 0; top: 0; color: #7892a6; font-size: 13px; font-weight: 650; }
.home-settings-notice { margin: 17px 0 0; padding-top: 12px; border-top: 1px solid #e4ebf1; font-size: 11px; line-height: 1.8; color: #708191; }
.home-reminders dl { margin: 0; display: grid; gap: 11px; }
.home-reminder { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 12px; }
.home-reminder dt { color: #41586b; font-size: 12px; font-weight: 650; line-height: 1.7; }
.home-reminder dd { margin: 0; font-size: 12px; line-height: 1.7; color: #6d7f8d; overflow-wrap: anywhere; }
@media (max-width: 1080px) { .home-reminder { grid-template-columns: 1fr; gap: 2px; } }
@media (max-width: 820px) { .home-guidance { grid-template-columns: 1fr; } .home-checklist { border-right: 0; border-bottom: 1px solid #e7edf3; } .home-local-badge { float: none; display: inline-block; margin: 0 0 9px; } }
@media (max-width: 620px) {
  .home-manual-primary { width: 100%; min-width: 0; min-height: 52px; font-size: 14px; padding: 12px; }
  .home-copy-primary { min-height: 52px; }
  .home-ai-meta { column-gap: 10px; row-gap: 1px; }
  .home-helper { font-size: 11px; }
  .home-checklist, .home-reminders { padding: 18px; }
  .home-hero .home-flow li + li { border-left: 0; }
}

.home-checklist-hint { margin: -6px 0 14px; color: #7b8b98; font-size: 11px; line-height: 1.7; }
