:root {
  --ink: #17120f;
  --muted: #756d64;
  --line: #ddd3c5;
  --paper: #fffdf8;
  --surface: #f7f3ec;
  --gold: #b99153;
  --gold-deep: #826235;
  --jade: #315b51;
  --vermillion: #9d332c;
  --blue: #215a86;
  --shadow: 0 24px 70px rgba(29, 21, 13, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 1120px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(23, 18, 15, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(23, 18, 15, 0.035) 1px, transparent 1px),
    #eee8dd;
  background-size: 36px 36px;
  font-family:
    "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial,
    sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--gold);
  box-shadow: 0 10px 22px rgba(23, 18, 15, 0.08);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button svg {
  width: 17px;
  height: 17px;
}

.primary-action {
  color: #fff;
  border-color: #17120f;
  background: #17120f;
}

.app-header {
  height: 96px;
  padding: 20px 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(130, 98, 53, 0.24);
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.brand-logo {
  width: 162px;
  height: 54px;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  padding: 5px 10px;
  border: 1px solid rgba(23, 18, 15, 0.08);
}

.brand-title {
  display: grid;
  gap: 5px;
}

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

.brand-title strong {
  font-size: 18px;
  font-weight: 650;
}

.header-meta {
  color: var(--muted);
  font-size: 13px;
}

.workspace {
  width: min(1460px, calc(100vw - 52px));
  margin: 28px auto 44px;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.control-panel {
  position: sticky;
  top: 124px;
  border: 1px solid rgba(130, 98, 53, 0.22);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 253, 248, 0.9);
  box-shadow: var(--shadow);
}

.upload-zone {
  min-height: 154px;
  border: 1.5px dashed rgba(130, 98, 53, 0.54);
  border-radius: 8px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--ink);
  background: #fbf8f0;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.upload-zone:hover,
.upload-zone.is-dragging {
  background: #fffaf0;
  border-color: var(--gold-deep);
  transform: translateY(-1px);
}

.upload-zone input {
  display: none;
}

.upload-zone svg {
  width: 30px;
  height: 30px;
  color: var(--gold-deep);
}

.upload-zone span {
  font-weight: 700;
  font-size: 17px;
}

.upload-zone small {
  color: var(--muted);
  font-size: 12px;
}

.settings-grid {
  margin-top: 18px;
  display: grid;
  gap: 13px;
}

.field {
  display: grid;
  gap: 7px;
}

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

.field input,
.field select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fffefa;
  padding: 0 12px;
}

.field input:disabled,
.field select:disabled {
  color: #8a8178;
  background: #f2eee6;
}

.action-bar {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.action-bar .primary-action {
  grid-column: 1 / -1;
}

.status-stack {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.status-message {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 8px;
  background: #f7f3ec;
  border: 1px solid rgba(130, 98, 53, 0.2);
}

.status-message i {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: var(--gold-deep);
}

.status-message strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.status-message p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 12px;
}

.status-message.warning {
  background: #fff6e5;
  border-color: rgba(185, 145, 83, 0.38);
}

.status-message.error {
  background: #fff0ed;
  border-color: rgba(157, 51, 44, 0.34);
}

.status-message.success {
  background: #eff7f3;
  border-color: rgba(49, 91, 81, 0.25);
}

.preview-shell {
  min-height: calc(100vh - 168px);
  border: 1px solid rgba(130, 98, 53, 0.24);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.74);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.empty-state {
  min-height: 720px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  text-align: center;
  color: var(--muted);
}

.empty-state img {
  width: 228px;
  opacity: 0.88;
}

.empty-state h1 {
  margin: 0;
  color: var(--ink);
  font-size: 28px;
  font-weight: 650;
}

.empty-state p {
  margin: 0;
}

.report-deck {
  padding: 1px 0;
}

.report-document {
  width: 960px;
  min-height: 1320px;
  margin: 26px auto;
  padding: 44px 50px 42px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid rgba(130, 98, 53, 0.22);
  box-shadow: 0 20px 54px rgba(28, 20, 12, 0.13);
  break-after: page;
}

.report-document:last-child {
  break-after: auto;
}

.report-cover {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 28px;
  align-items: center;
  padding-bottom: 26px;
  border-bottom: 2px solid var(--ink);
}

.report-cover img {
  width: 160px;
  height: auto;
  object-fit: contain;
}

.report-title h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0;
}

.report-title p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.key-meta {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 12px;
  margin: 24px 0 12px;
}

.key-meta-box {
  padding: 18px 20px;
  border: 1px solid rgba(130, 98, 53, 0.34);
  border-radius: 8px;
  background: #fff8eb;
}

.key-meta-box span {
  display: block;
  color: var(--gold-deep);
  font-size: 14px;
  font-weight: 700;
}

.key-meta-box strong {
  display: block;
  margin-top: 9px;
  font-size: 26px;
  line-height: 1.18;
  font-weight: 800;
}

.report-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0 0 22px;
}

.meta-box,
.kpi-box,
.area-card,
.detail-block,
.notice-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
}

.meta-box {
  padding: 12px 14px;
}

.meta-box span,
.kpi-box span,
.area-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.meta-box strong {
  display: block;
  margin-top: 7px;
  font-size: 15px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 0 0 18px;
}

.kpi-box {
  padding: 15px 14px;
}

.kpi-box strong {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.kpi-box em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 500;
}

.area-summary {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 18px 0 22px;
}

.area-card {
  padding: 12px;
  border-top-width: 4px;
}

.area-card[data-area="朱"] {
  border-top-color: var(--vermillion);
}

.area-card[data-area="青"] {
  border-top-color: var(--blue);
}

.area-card[data-area="白"] {
  border-top-color: #c8c0b2;
}

.area-card[data-area="玄"] {
  border-top-color: #1c1a18;
}

.area-card[data-area="苍"] {
  border-top-color: var(--jade);
}

.area-card[data-area="紫"] {
  border-top-color: #734f91;
}

.area-card strong {
  display: block;
  margin: 7px 0 5px;
  font-size: 24px;
  line-height: 1;
}

.progress-track {
  height: 5px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #ede5d9;
}

.progress-track b {
  display: block;
  height: 100%;
  width: var(--rate);
  background: var(--gold-deep);
}

.notice-box {
  margin: 0 0 20px;
  padding: 12px 14px;
  color: #563f21;
  background: #fff8eb;
  line-height: 1.65;
  font-size: 13px;
}

.notice-box:empty {
  display: none;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 22px 0 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

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

.detail-grid {
  display: grid;
  gap: 12px;
}

.detail-block {
  padding: 15px 16px 13px;
  break-inside: avoid;
}

.detail-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.detail-header strong {
  font-size: 18px;
}

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

.seat-line {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 12px;
  padding: 6px 0;
  line-height: 1.7;
}

.seat-line + .seat-line {
  border-top: 1px dashed rgba(117, 109, 100, 0.24);
}

.seat-line b {
  color: var(--gold-deep);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.seat-line p {
  margin: 0;
  word-break: break-word;
}

.muted-empty {
  color: var(--muted);
}

.report-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.export-stage {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 1000px;
  background: #fffdf8;
  z-index: -1;
}

@media (max-width: 1180px) {
  body {
    min-width: 0;
  }

  .workspace {
    width: calc(100vw - 28px);
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
  }

  .report-document {
    width: min(960px, calc(100vw - 56px));
  }

  .key-meta {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    min-width: 0;
    background: #fff;
  }

  .app-header,
  .control-panel,
  .empty-state {
    display: none !important;
  }

  .workspace,
  .preview-shell,
  .report-deck {
    width: auto;
    margin: 0;
    display: block;
    border: 0;
    box-shadow: none;
    background: #fff;
  }

  .report-document {
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }
}
