:root {
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #d8d8d8;
  --bg: #fafafa;
  --danger: #c0392b;
  --warning: #b9770e;
  --info: #55606b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.015em;
  word-break: keep-all;
  color: var(--ink);
  background: var(--bg);
}

.topbar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 5;
}

.chip {
  font-size: 12px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}
.chip.muted { color: var(--muted); }

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 20px;
}

h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 20px 0 8px; }
h4 { font-size: 14px; margin: 14px 0 6px; }

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

/*
 * [hidden]은 UA 스타일(display:none)로 지워지는데, 클래스 규칙(.grid{display:grid})이
 * 특이도에서 이겨서 **hidden 속성이 무시된다.** 그래서 모드를 바꿔도 반대쪽 폼이 화면에 남았다.
 * (총괄 브라우저 실측: 상속 모드에서 증여 전용 9개 필드가 계속 보임)
 */
[hidden] {
  display: none !important;
}

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

label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }

input, select {
  font: inherit;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
}

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

button {
  font: inherit;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  cursor: pointer;
}
button:disabled { opacity: 0.4; cursor: not-allowed; }

.verdict {
  font-size: 16px;
  padding: 12px 14px;
  background: #f4f7fb;
  border-left: 4px solid var(--ink);
  border-radius: 4px;
}

table { width: 100%; border-collapse: collapse; margin-top: 8px; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; }
thead th { font-size: 13px; color: var(--muted); font-weight: 600; }
tbody th { font-weight: 500; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.delta { font-weight: 600; }
.dash { text-align: right; color: var(--muted); }

.steps { padding-left: 20px; margin: 8px 0 0; }
.steps li { margin-bottom: 6px; display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.steps .label { min-width: 260px; }
.steps .note { flex-basis: 100%; color: var(--muted); font-size: 12px; }

.warn {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #fff;
}
.warn.danger { border-left-color: var(--danger); background: #fdf3f2; }
.warn.warning { border-left-color: var(--warning); background: #fdf8f0; }
.warn.info { border-left-color: var(--info); }
.warn-head { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.badge { font-size: 12px; font-weight: 700; }
.warn.danger .badge { color: var(--danger); }
.warn.warning .badge { color: var(--warning); }
.warn.info .badge { color: var(--info); }
.warn code { font-size: 12px; color: var(--muted); }
.warn p { margin: 4px 0; }
.basis { color: var(--muted); font-size: 12px; }

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

.counts { display: flex; gap: 8px; margin-bottom: 12px; }
.count { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); }
.count.danger { color: var(--danger); border-color: var(--danger); }
.count.warning { color: var(--warning); border-color: var(--warning); }
.count.info { color: var(--info); border-color: var(--info); }

.hint-inline { font-size: 12px; color: var(--muted); font-weight: 400; }

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

.sheet th { width: 60%; font-weight: 500; }
.disclaimer { color: var(--muted); font-size: 12px; margin-top: 14px; }
.sheet-warn { font-size: 13px; }

/* ------------------------------------------------------------------ */
/* R4 프리미엄 세무 실익 분석 보고서 스타일 (반응형 UI 프로토타입 기반)  */
/* ------------------------------------------------------------------ */

.report-card-wrap {
  background: #0f172a;
  color: #f8fafc;
  border-radius: 10px;
  padding: 24px;
  margin-top: 10px;
  border: 1px solid #334155;
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.3);
}

.report-header {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 20px;
}

.report-badge {
  display: inline-block;
  background: #334155;
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid #475569;
  margin-bottom: 8px;
}

.report-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
  margin: 0 0 6px 0;
}

.report-subtitle {
  font-size: 0.9rem;
  color: #94a3b8;
  line-height: 1.5;
  margin: 0;
}

.report-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

@media (max-width: 768px) {
  .report-stat-grid { grid-template-columns: 1fr; }
  .report-grid-2 { grid-template-columns: 1fr !important; }
}

.report-stat-card {
  background: #1e293b;
  border-radius: 8px;
  border-left: 3px solid #38bdf8;
  padding: 16px 18px;
  border-top: 1px solid #334155;
  border-right: 1px solid #334155;
  border-bottom: 1px solid #334155;
}
.report-stat-card.green { border-left-color: #10b981; }
.report-stat-card.blue { border-left-color: #3b82f6; }
.report-stat-card.amber { border-left-color: #f59e0b; }
.report-stat-card.rose { border-left-color: #ef4444; }

.report-stat-label { font-size: 0.82rem; color: #94a3b8; margin-bottom: 4px; font-weight: 500; }
.report-stat-val { font-size: 1.4rem; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.report-stat-desc { font-size: 0.76rem; color: #64748b; margin-top: 4px; }

.report-section-card {
  background-color: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.report-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #f1f5f9;
}

.report-svg-container {
  width: 100%;
  background: #111a2e;
  border-radius: 6px;
  padding: 16px;
  border: 1px solid #1e293b;
  display: flex;
  justify-content: center;
  margin: 12px 0;
  overflow-x: auto;
}
.report-svg-container svg text { font-family: inherit; }

.report-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.86rem;
}
.report-table th, .report-table td {
  padding: 9px 11px;
  text-align: right;
  border-bottom: 1px solid #334155;
  color: #f1f5f9;
  font-variant-numeric: tabular-nums;
}
.report-table th:first-child, .report-table td:first-child { text-align: left; }
.report-table th {
  background: #182234;
  color: #94a3b8;
  font-weight: 600;
}
.report-table tr:hover td { background: rgba(255, 255, 255, 0.02); }
.report-highlight-row td {
  background: rgba(56, 189, 248, 0.08);
  font-weight: 700;
  color: #fff;
}
.report-benefit { color: #34d399 !important; font-weight: 700; }
.report-loss { color: #f87171 !important; font-weight: 700; }

.report-summary-box {
  background: #0f172a;
  border-radius: 6px;
  padding: 12px 14px;
  margin-top: 12px;
  border: 1px solid #334155;
}
.report-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.86rem;
  margin-bottom: 5px;
}
.report-summary-total {
  border-top: 1px solid #334155;
  padding-top: 8px;
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1rem;
}

.report-alert-box {
  background: #1e293b;
  border: 1px solid #334155;
  border-left: 3px solid #38bdf8;
  border-radius: 6px;
  padding: 16px 18px;
  margin: 20px 0;
}
.report-alert-title { font-weight: 700; color: #f1f5f9; font-size: 0.92rem; margin-bottom: 6px; }
.report-alert-content { font-size: 0.82rem; color: #94a3b8; line-height: 1.6; }

/* 인쇄 — R5 미리보기만 1장으로 */
@media print {
  .topbar, #r2, #r3, .actions, .hint, button { display: none !important; }
  body { background: #fff; font-size: 10pt; }
  .panel { border: none; padding: 0; margin: 0; }
  #r5 { display: block !important; }
  .warn, .sheet-warn { break-inside: avoid; }
  @page { size: A4; margin: 14mm; }
}
