:root {
  --ink-950: #102a43;
  --ink-800: #243b53;
  --ink-650: #486581;
  --ink-500: #627d98;
  --ink-250: #bcccdc;
  --ink-150: #d9e2ec;
  --ink-100: #e9eff5;
  --ink-50: #f5f8fb;
  --paper: #ffffff;
  --teal-800: #075e59;
  --teal-700: #08736b;
  --teal-100: #d8f3ef;
  --teal-50: #ecfaf8;
  --amber-700: #a85d00;
  --amber-100: #fff1cf;
  --red-700: #b42318;
  --red-100: #fee4e2;
  --shadow-sm: 0 1px 2px rgb(16 42 67 / 5%), 0 4px 14px rgb(16 42 67 / 5%);
  --shadow-lg: 0 18px 48px rgb(16 42 67 / 12%);
  --radius-lg: 18px;
  --radius-md: 12px;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  color: var(--ink-950);
  background: var(--ink-50);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 0 0, rgb(8 115 107 / 7%), transparent 26rem),
    var(--ink-50);
  color: var(--ink-950);
  line-height: 1.6;
}

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

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(8 115 107 / 28%);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  transform: translateY(-160%);
  border-radius: 8px;
  background: var(--ink-950);
  color: white;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  border-bottom: 1px solid rgb(188 204 220 / 70%);
  background: rgb(255 255 255 / 94%);
}

.topbar__inner {
  display: flex;
  width: min(1480px, calc(100% - 48px));
  min-height: 86px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand__mark {
  display: grid;
  width: 45px;
  height: 45px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  background: var(--ink-950);
  color: white;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 7px 18px rgb(16 42 67 / 18%);
}

.brand__eyebrow,
.step-label {
  margin: 0;
  color: var(--teal-700);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.brand h1 {
  margin: 1px 0 0;
  font-size: clamp(19px, 2vw, 24px);
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.local-badge,
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  background: var(--teal-50);
  color: var(--teal-800);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.local-badge {
  padding: 9px 13px;
  border: 1px solid var(--teal-100);
}

.local-badge__dot,
.live-badge span,
.draft-state__dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--teal-700);
  box-shadow: 0 0 0 4px rgb(8 115 107 / 11%);
}

.page-shell {
  width: min(1480px, calc(100% - 48px));
  margin: 0 auto;
  padding: 26px 0 64px;
}

.privacy-banner {
  display: flex;
  margin-bottom: 22px;
  padding: 17px 20px;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--teal-100);
  border-radius: var(--radius-md);
  background: var(--teal-50);
  color: var(--teal-800);
}

.privacy-banner__icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--teal-700);
  color: white;
  font-size: 14px;
  font-weight: 800;
}

.privacy-banner h2,
.privacy-banner p {
  margin: 0;
}

.privacy-banner h2 {
  font-size: 15px;
}

.privacy-banner p {
  margin-top: 1px;
  color: #236e68;
  font-size: 13px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
  align-items: start;
  gap: 22px;
}

.panel {
  overflow: hidden;
  border: 1px solid var(--ink-150);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}

.panel__header {
  display: flex;
  min-height: 82px;
  padding: 18px 22px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--ink-100);
}

.panel__header h2 {
  margin: 3px 0 0;
  font-size: 20px;
  line-height: 1.3;
}

.panel__header--compact {
  min-height: 72px;
}

.required-note {
  margin: 0;
  color: var(--ink-500);
  font-size: 12px;
  white-space: nowrap;
}

.required-note span,
.field label span {
  color: var(--red-700);
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 23px 22px 25px;
  border: 0;
}

fieldset + fieldset {
  border-top: 1px solid var(--ink-100);
}

legend {
  width: 100%;
  margin-bottom: 17px;
  padding: 0;
  color: var(--ink-800);
  font-size: 14px;
  font-weight: 800;
}

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

.field {
  min-width: 0;
}

.field + .field {
  margin-top: 18px;
}

.form-grid .field {
  margin-top: 0;
}

.field--wide {
  grid-column: 1 / -1;
}

.field label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-800);
  font-size: 14px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--ink-250);
  border-radius: 10px;
  background: white;
  color: var(--ink-950);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.field input,
.field select {
  min-height: 45px;
  padding: 9px 12px;
}

.field textarea {
  display: block;
  min-height: 96px;
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.7;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--ink-500);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--teal-700);
  outline: 0;
  box-shadow: 0 0 0 4px rgb(8 115 107 / 10%);
}

.field input:invalid:not(:placeholder-shown),
.field textarea:invalid:not(:placeholder-shown) {
  border-color: var(--red-700);
}

::placeholder {
  color: #829ab1;
  opacity: 1;
}

.field-hint {
  margin: 6px 0 0;
  color: var(--ink-500);
  font-size: 12px;
}

.quick-tools {
  display: flex;
  padding: 14px 22px;
  flex-wrap: wrap;
  gap: 9px;
  border-bottom: 1px solid var(--ink-100);
  background: #fbfcfd;
}

.module-card {
  border-bottom: 1px solid var(--ink-100);
  background: white;
}

.module-card summary {
  display: flex;
  min-height: 68px;
  padding: 15px 22px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
  list-style: none;
}

.module-card summary::-webkit-details-marker { display: none; }
.module-card summary span:first-child { display: grid; min-width: 0; }
.module-card summary strong { color: var(--ink-800); font-size: 15px; }
.module-card summary small { margin-top: 2px; color: var(--ink-500); font-size: 11px; font-weight: 400; }
.module-card summary::after {
  display: grid;
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--ink-50);
  color: var(--ink-650);
  content: "+";
  font-size: 18px;
  font-weight: 500;
}
.module-card[open] summary::after { content: "−"; }
.module-card[open] summary { background: var(--teal-50); }
.module-toggle { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.module-content { padding: 20px 22px 24px; }
.module-content.form-grid { display: grid; }
.metric-grid {
  display: grid;
  margin: 17px 0;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.metric-grid .field { margin-top: 0; }
.metric-grid .field label { font-size: 12px; }
.metric-grid input { min-width: 0; }

.draft-bar {
  display: flex;
  min-height: 68px;
  padding: 12px 22px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--ink-100);
  background: #fbfcfd;
}

.draft-state {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-500);
  font-size: 12px;
}

.draft-state__dot {
  width: 7px;
  height: 7px;
}

.preview-column {
  position: sticky;
  top: 18px;
  min-width: 0;
}

.live-badge {
  padding: 7px 10px;
  background: var(--ink-50);
  color: var(--ink-650);
  font-size: 12px;
}

.live-badge span {
  width: 7px;
  height: 7px;
  animation: pulse 2.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.report-paper {
  position: relative;
  margin: 22px;
  overflow: hidden;
  border: 1px solid var(--ink-150);
  border-radius: 12px;
  background: white;
  box-shadow: inset 0 0 0 1px rgb(233 239 245 / 50%);
}

.report-paper__topline {
  height: 6px;
  background: linear-gradient(90deg, var(--ink-950), var(--teal-700));
}

.report-paper__heading {
  padding: 22px 24px 18px;
}

.report-paper__type {
  display: inline-block;
  margin: 0 0 9px;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--teal-50);
  color: var(--teal-800);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.report-paper__heading h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.35;
  letter-spacing: 0.015em;
}

.report-meta {
  display: grid;
  margin: 0 24px;
  padding: 15px 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--ink-100);
  border-bottom: 1px solid var(--ink-100);
}

.report-meta > div {
  min-width: 0;
  padding: 7px 12px 7px 0;
}

.report-meta__wide {
  grid-column: 1 / -1;
}

.report-meta dt {
  color: var(--ink-500);
  font-size: 11px;
}

.report-meta dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  color: var(--ink-800);
  font-size: 14px;
  font-weight: 700;
}

.report-meta dd.is-empty,
#preview-report-title.is-empty {
  color: #9fb3c8;
  font-weight: 500;
}

.status-text:not(.is-empty) {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--teal-100);
  color: var(--teal-800);
}

.status-text[data-status="需关注"] {
  background: var(--amber-100);
  color: var(--amber-700);
}

.status-text[data-status="异常"] {
  background: var(--red-100);
  color: var(--red-700);
}

.report-sections {
  padding: 19px 24px 24px;
}

.report-section + .report-section {
  margin-top: 19px;
}

.report-section h4 {
  display: flex;
  margin: 0 0 7px;
  align-items: center;
  gap: 8px;
  color: var(--ink-800);
  font-size: 14px;
}

.report-section h4::before {
  width: 4px;
  height: 15px;
  border-radius: 999px;
  background: var(--teal-700);
  content: "";
}

.report-section p {
  margin: 0;
  color: var(--ink-800);
  font-size: 14px;
  line-height: 1.8;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.report-section ul {
  display: grid;
  margin: 0;
  padding-left: 1.25em;
  gap: 4px;
  color: var(--ink-800);
  font-size: 14px;
  line-height: 1.75;
}

.preview-empty {
  margin: 0;
  padding: 12px;
  border-radius: 9px;
  background: var(--ink-50);
  color: var(--ink-500);
  font-size: 13px;
  text-align: center;
}

.report-section p.is-empty {
  color: #9fb3c8;
}

.report-paper__footer {
  padding: 10px 24px;
  border-top: 1px solid var(--ink-100);
  background: #fbfcfd;
  color: var(--ink-500);
  font-size: 10px;
  text-align: center;
  letter-spacing: 0.03em;
}

.output-actions,
.image-actions {
  display: grid;
  padding: 0 22px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.button {
  min-height: 43px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 700;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.button:active {
  transform: translateY(1px);
}

.button--primary {
  background: var(--ink-950);
  color: white;
  box-shadow: 0 5px 14px rgb(16 42 67 / 16%);
}

.button--primary:hover {
  background: #173d5e;
}

.button--secondary {
  border-color: var(--ink-250);
  background: white;
  color: var(--ink-800);
}

.button--secondary:hover,
.button--quiet:hover {
  border-color: var(--teal-700);
  background: var(--teal-50);
  color: var(--teal-800);
}

.button--quiet {
  min-height: 36px;
  padding: 7px 11px;
  border-color: var(--ink-150);
  background: transparent;
  color: var(--ink-650);
  font-size: 12px;
}

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

.output-actions .button span {
  display: inline-grid;
  width: 22px;
  height: 22px;
  margin-right: 5px;
  place-items: center;
  border-radius: 6px;
  background: rgb(255 255 255 / 12%);
  font-size: 11px;
}

.button--secondary span {
  background: var(--ink-50) !important;
}

.action-status,
.image-hint {
  min-height: 40px;
  margin: 12px 22px 16px;
  color: var(--ink-500);
  font-size: 12px;
  text-align: center;
}

.action-status.is-success,
.image-hint.is-success {
  color: var(--teal-700);
}

.action-status.is-error,
.image-hint.is-error {
  color: var(--red-700);
}

.image-panel {
  margin-top: 22px;
}

.image-panel[hidden] {
  display: none;
}

.canvas-frame {
  margin: 20px 22px 16px;
  overflow: auto;
  border: 1px solid var(--ink-150);
  border-radius: 12px;
  background: var(--ink-100);
}

#report-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: white;
}

.image-actions {
  padding-bottom: 22px;
}

.mobile-actions { display: none; }

dialog {
  width: min(440px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: rgb(16 42 67 / 52%);
  backdrop-filter: blur(3px);
}

.dialog-card {
  padding: 28px;
  text-align: center;
}

.dialog-card__icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 15px;
  place-items: center;
  border-radius: 50%;
  background: var(--red-100);
  color: var(--red-700);
  font-size: 24px;
  font-weight: 800;
}

.dialog-card h2 {
  margin: 0;
  font-size: 21px;
}

.dialog-card p {
  margin: 9px 0 22px;
  color: var(--ink-500);
  font-size: 14px;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.noscript-notice {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 100;
  padding: 12px;
  border-radius: 10px;
  background: var(--red-700);
  color: white;
  text-align: center;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

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

  .preview-column {
    position: static;
  }
}

@media (max-width: 640px) {
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

  .topbar__inner,
  .page-shell {
    width: min(100% - 28px, 1480px);
  }

  .topbar__inner {
    min-height: 76px;
    gap: 10px;
  }

  .brand {
    gap: 10px;
  }

  .brand__mark {
    width: 39px;
    height: 39px;
    border-radius: 11px;
    font-size: 17px;
  }

  .brand__eyebrow {
    display: none;
  }

  .brand h1 {
    max-width: 210px;
    overflow: hidden;
    font-size: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .local-badge {
    padding: 7px 9px;
    font-size: 11px;
  }

  .local-badge__dot {
    display: none;
  }

  .page-shell {
    padding-top: 16px;
  }

  .privacy-banner {
    padding: 14px;
    align-items: flex-start;
  }

  .privacy-banner__icon {
    width: 34px;
    height: 34px;
  }

  .privacy-banner p {
    line-height: 1.55;
  }

  .panel,
  .privacy-banner {
    border-radius: 14px;
  }

  .panel__header,
  .draft-bar {
    padding-right: 16px;
    padding-left: 16px;
  }

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

  .quick-tools {
    display: grid;
    padding: 12px 16px;
    grid-template-columns: 1fr 1fr;
  }

  .quick-tools .button:first-child { grid-column: 1 / -1; }

  .module-card summary,
  .module-content {
    padding-right: 16px;
    padding-left: 16px;
  }

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

  .field--wide {
    grid-column: auto;
  }

  .draft-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .button--quiet {
    width: 100%;
  }

  .report-paper {
    margin: 16px;
  }

  .report-paper__heading,
  .report-sections {
    padding-right: 17px;
    padding-left: 17px;
  }

  .report-meta {
    margin-right: 17px;
    margin-left: 17px;
  }

  .report-paper__footer {
    padding-right: 17px;
    padding-left: 17px;
  }

  .output-actions,
  .image-actions {
    padding-right: 16px;
    padding-left: 16px;
    grid-template-columns: 1fr;
  }

  .output-actions .button,
  .image-actions .button {
    min-height: 48px;
  }

  .canvas-frame {
    margin-right: 16px;
    margin-left: 16px;
  }

  .action-status,
  .image-hint {
    margin-right: 16px;
    margin-left: 16px;
  }

  .mobile-actions {
    position: fixed;
    z-index: 80;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    min-height: 68px;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    border-top: 1px solid var(--ink-150);
    background: rgb(255 255 255 / 97%);
    box-shadow: 0 -8px 26px rgb(16 42 67 / 10%);
    backdrop-filter: blur(12px);
  }

  .mobile-actions button {
    display: grid;
    min-width: 0;
    min-height: 52px;
    padding: 4px 2px;
    place-items: center;
    gap: 1px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--ink-650);
    font-size: 10px;
    font-weight: 700;
  }

  .mobile-actions button:last-child { background: var(--ink-950); color: white; }
  .mobile-actions span { font-size: 15px; line-height: 1; }
}

@media (max-width: 390px) {
  .local-badge { display: none; }
  .brand h1 { max-width: calc(100vw - 88px); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .topbar,
  .privacy-banner,
  .editor-panel,
  .panel__header,
  .output-actions,
  .action-status,
  .image-panel {
    display: none !important;
  }

  .page-shell,
  .workspace,
  .preview-column {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .preview-panel,
  .report-paper {
    margin: 0;
    border: 0;
    box-shadow: none;
  }
}
