:root {
  --bg: #f3efe6;
  --surface: #fffdf9;
  --surface-soft: #f8f4eb;
  --ink: #1f322c;
  --muted: #667771;
  --line: #d8d2c3;
  --accent: #205548;
  --accent-soft: #d9e8df;
  --warn: #9c6534;
  --shadow: 0 20px 50px rgba(31, 50, 44, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(32, 85, 72, 0.08), transparent 28%),
    linear-gradient(180deg, #f7f3ea 0%, #efe8db 100%);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.page-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 24px auto 40px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.95fr);
  align-items: end;
  gap: 20px;
  padding: 28px;
  background: rgba(255, 253, 249, 0.92);
  border: 1px solid rgba(216, 210, 195, 0.9);
  border-radius: 32px;
  box-shadow: var(--shadow);
}

.hero-controls {
  display: grid;
  gap: 14px;
  justify-items: stretch;
  align-content: start;
  width: auto;
  margin-left: auto;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  min-width: 148px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 700;
}

.language-switch select {
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  outline: none;
  width: 100%;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1,
.section-title,
.panel-title,
.report-title {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

.hero h1 {
  font-size: clamp(34px, 5vw, 56px);
}

.hero-text,
.panel-copy,
.metric-copy,
.muted-text,
.report-summary,
.empty-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.tab-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(148px, 1fr));
  gap: 14px;
  width: auto;
}

.tab-button {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 700;
  text-align: center;
  transition: 0.2s ease;
}

.tab-button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-1px);
}

.page-content {
  margin-top: 18px;
}

.view-panel {
  display: grid;
  gap: 18px;
}

.panel {
  background: rgba(255, 253, 249, 0.94);
  border: 1px solid rgba(216, 210, 195, 0.92);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 24px;
}

.panel-head,
.report-head,
.upload-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-title {
  font-size: 32px;
}

.dashboard-grid,
.upload-grid,
.report-grid {
  display: grid;
  gap: 18px;
}

.dashboard-grid {
  grid-template-columns: 1.15fr 0.85fr;
}

.upload-grid {
  grid-template-columns: 1fr 0.92fr;
}

.report-grid {
  grid-template-columns: 0.92fr 1.08fr;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: var(--radius-lg);
  padding: 18px;
  min-height: 156px;
  display: grid;
  gap: 10px;
  align-content: space-between;
}

.metric-card-action {
  text-align: left;
  transition: 0.2s ease;
}

.metric-card-action:hover {
  transform: translateY(-2px);
  border-color: rgba(32, 85, 72, 0.4);
  box-shadow: 0 14px 30px rgba(32, 85, 72, 0.08);
}

.metric-label {
  color: var(--muted);
  font-size: 14px;
}

.metric-value {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
}

.metric-foot {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.report-list,
.saved-list,
.detail-list,
.report-detail-list,
.meta-list {
  display: grid;
  gap: 12px;
}

.report-card,
.saved-card,
.detail-list-item,
.meta-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  padding: 16px;
}

.report-card-head,
.saved-card-head,
.detail-list-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.report-name,
.detail-name,
.saved-name {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: #e8efe9;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.pill.warn {
  background: #f7eadc;
  color: var(--warn);
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.upload-action-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

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

.secondary-button {
  background: var(--surface-soft);
  color: var(--ink);
  border-color: var(--line);
}

.ghost-button {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.empty-state {
  min-height: 200px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  background: rgba(248, 244, 235, 0.7);
}

.upload-dropzone {
  border: 2px dashed rgba(32, 85, 72, 0.28);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(217, 232, 223, 0.7), rgba(255, 253, 249, 0.96));
  padding: 26px;
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
}

.upload-dropzone h3 {
  margin: 0;
  font-size: 28px;
}

.file-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 220px;
  text-align: center;
}

.upload-action-bar .primary-button,
.upload-action-bar .secondary-button {
  width: 100%;
  justify-content: center;
}

.upload-form,
.upload-side,
.detail-section,
.report-detail {
  display: grid;
  gap: 16px;
}

.field-grid {
  display: grid;
  gap: 14px;
}

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

.upload-type-card,
.upload-summary-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  padding: 18px;
}

.upload-type-card {
  display: grid;
  gap: 8px;
  text-align: left;
  transition: 0.2s ease;
}

.upload-type-card:hover {
  transform: translateY(-2px);
  border-color: rgba(32, 85, 72, 0.36);
  box-shadow: 0 14px 30px rgba(32, 85, 72, 0.08);
}

.upload-type-card strong {
  font-size: 18px;
}

.upload-type-card span {
  color: var(--muted);
  line-height: 1.6;
}

.field-label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
}

.field-label input,
.field-label select,
.field-label textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  background: #fff;
}

.field-label textarea {
  min-height: 150px;
  resize: vertical;
}

.upload-hint {
  font-size: 14px;
  color: var(--muted);
}

.selected-files {
  display: grid;
  gap: 10px;
}

.selected-file {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.report-list-panel,
.report-detail-panel {
  min-height: 560px;
}

.report-card.active {
  border-color: rgba(32, 85, 72, 0.44);
  box-shadow: inset 0 0 0 1px rgba(32, 85, 72, 0.22);
}

.score-badge {
  min-width: 78px;
  text-align: center;
  padding: 10px 14px;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}

.report-title {
  font-size: 34px;
}

.score-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.score-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.report-section {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.report-section h4,
.meta-card h4 {
  margin: 0;
  font-size: 18px;
}

.bullet-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.detail-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 50, 44, 0.28);
  backdrop-filter: blur(4px);
}

.detail-modal-card {
  position: relative;
  width: min(880px, calc(100vw - 24px));
  margin: 56px auto;
  max-height: calc(100vh - 112px);
  overflow: auto;
  border-radius: 30px;
  background: #fffdf9;
  border: 1px solid rgba(216, 210, 195, 0.9);
  box-shadow: 0 28px 70px rgba(31, 50, 44, 0.18);
  padding: 24px;
}

.detail-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

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

.detail-list-side {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  min-width: 220px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(31, 50, 44, 0.94);
  color: #fff;
  box-shadow: 0 18px 42px rgba(31, 50, 44, 0.24);
  z-index: 40;
}

@media (max-width: 980px) {
  .dashboard-grid,
  .upload-grid,
  .report-grid,
  .metric-grid,
  .upload-action-bar,
  .upload-type-grid {
    grid-template-columns: 1fr;
  }

  .hero,
  .panel,
  .detail-modal-card {
    padding: 18px;
  }

  .hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .hero-controls {
    width: 100%;
    margin-left: 0;
  }

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

  .language-switch {
    justify-self: end;
  }

  .panel-title,
  .report-title {
    font-size: 28px;
  }
}
