:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --text: #1f2a33;
  --muted: #66737f;
  --line: #d8e0df;
  --green: #2f6b4f;
  --blue: #2f5f8f;
  --amber: #9a6a23;
  --danger: #9f3a38;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

.report-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 16px;
  font-size: 18px;
}

.meta {
  margin: 10px 0 0;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 13px;
  cursor: pointer;
}

button:hover {
  border-color: var(--green);
}

.status {
  margin: 20px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #eef5f1;
  color: var(--green);
}

.status.error {
  background: #fff1f1;
  color: var(--danger);
}

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

.metric-card,
.panel,
.filters {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-card {
  padding: 18px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.filters select,
.filters input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
}

.filters button {
  align-self: end;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.panel {
  padding: 18px;
  margin-bottom: 20px;
}

.narrative-panel ol {
  margin: 0;
  padding-left: 22px;
}

.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2) {
  text-align: left;
}

th {
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 860px) {
  .report-header,
  .chart-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

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

@media (max-width: 560px) {
  .metric-grid,
  .filters {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 25px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .report-shell {
    width: 100%;
    padding: 0;
  }

  .no-print {
    display: none !important;
  }

  .panel,
  .metric-card {
    break-inside: avoid;
  }
}
