:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --paper: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d9e0ea;
  --blue: #315fc7;
  --blue-soft: #eaf1ff;
  --green: #157a4f;
  --green-soft: #eaf8f1;
  --yellow: #98690a;
  --yellow-soft: #fff5d6;
  --red: #c23a3a;
  --red-soft: #fff0ee;
  --shadow: 0 18px 50px rgba(39, 51, 82, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif;
  line-height: 1.58;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid #b8c7e6;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  padding: 8px 13px;
}

button.secondary {
  background: #fff;
  color: #334155;
  border-color: var(--line);
}

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

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 22px 54px;
}

.topbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.brand,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.brand {
  color: #000;
}

.badge.primary {
  color: var(--blue);
  border-color: #b9c9f5;
  background: var(--blue-soft);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.hero > div,
.hero-note,
.card,
.mini-card,
.empty {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero > div {
  padding: 28px;
}

.hero-note {
  padding: 20px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.06;
}

h2 {
  margin: 0 0 14px;
  font-size: 21px;
  line-height: 1.25;
}

h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

p {
  margin: 0 0 10px;
}

.lead {
  color: var(--muted);
  font-size: 18px;
  max-width: 920px;
}

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

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 430px) 1fr;
  gap: 18px;
  align-items: start;
}

.card {
  padding: 20px;
  margin-bottom: 16px;
}

.mini-card {
  padding: 15px;
  box-shadow: none;
}

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

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

label {
  display: block;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 6px;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

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

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fbfdff;
  color: #334155;
  font-weight: 700;
  font-size: 13px;
}

.check input {
  accent-color: var(--blue);
}

.sample-row,
.actions,
.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

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

.template-card {
  display: grid;
  gap: 2px;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
  padding: 10px 12px;
}

.template-card:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.template-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0 0 10px;
  padding: 10px 12px 12px;
  display: grid;
  gap: 8px;
}

.field-group legend {
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  padding: 0 4px;
}

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

details.expert,
details.evidence,
details.collapsed-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 10px 12px;
}

details summary {
  cursor: pointer;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
}

details.expert[open],
details.collapsed-section[open] {
  background: var(--paper);
}

details.expert > div {
  margin-top: 12px;
}

details.evidence {
  margin-top: 6px;
  padding: 6px 10px;
  background: #f8fafc;
}

details.evidence summary {
  font-size: 12px;
}

details.collapsed-section {
  margin-bottom: 16px;
  padding: 16px 20px;
  box-shadow: var(--shadow);
  background: var(--paper);
}

details.collapsed-section summary {
  font-size: 19px;
  color: var(--ink);
}

details.collapsed-section[open] summary {
  margin-bottom: 12px;
}

.notice + .notice {
  margin-top: 8px;
}

.action-list {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 10px;
}

.action-list li::marker {
  color: var(--blue);
  font-weight: 800;
}

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

.stat strong {
  display: block;
  font-size: 30px;
  color: var(--blue);
  line-height: 1.05;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

.card-topline {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.pill,
.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.tone-good {
  border-color: #93d5b7;
  background: var(--green-soft);
}

.tone-good .pill,
.tone-good strong,
.chip.good {
  color: var(--green);
}

.tone-warning {
  border-color: #ead28a;
  background: var(--yellow-soft);
}

.tone-warning .pill,
.tone-warning strong,
.chip.warn {
  color: var(--yellow);
}

.tone-danger {
  border-color: #f1a5a5;
  background: var(--red-soft);
}

.tone-danger .pill,
.tone-danger strong,
.chip.danger {
  color: var(--red);
}

.tone-muted {
  border-color: var(--line);
  background: #f8fafc;
}

.list {
  display: grid;
  gap: 10px;
}

.compact-list {
  margin: 0;
  padding-left: 18px;
}

.compact-list li + li {
  margin-top: 5px;
}

.empty {
  padding: 34px;
  color: var(--muted);
  text-align: center;
}

.notice {
  border-left: 4px solid var(--yellow);
  background: #fffaf0;
  padding: 13px 15px;
  border-radius: 8px;
  color: #56410c;
}

.error {
  border-left-color: var(--red);
  background: var(--red-soft);
  color: #7f1d1d;
}

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

@media (max-width: 720px) {
  .page {
    padding: 18px 12px 42px;
  }

  .stats,
  .grid,
  .checkbox-grid,
  .two-col,
  .template-grid {
    grid-template-columns: 1fr;
  }
}

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

  .page {
    max-width: none;
    padding: 0;
  }

  .topbar,
  .input-panel,
  .actions,
  .sample-row,
  .template-grid,
  .hint {
    display: none;
  }

  details.collapsed-section,
  details.evidence {
    border: none;
    padding: 0;
  }

  .hero,
  .layout {
    display: block;
  }

  .card,
  .mini-card,
  .empty,
  .hero > div,
  .hero-note {
    box-shadow: none;
    break-inside: avoid;
  }
}
