/* Valuation Toolkit 화면 공통 스타일. 외부 라이브러리·CDN 없이 이 PC 안에서만 동작한다.
 * 디자인: 미니멀 스위스. 흰 바탕, 검정 타이포, 강조색 하나(코발트), 각진 모서리, 그림자 없음.
 * 글꼴: Pretendard 가변 글꼴(web/fonts, SIL OFL 1.1). 없으면 맑은 고딕으로 대체한다. */
@font-face {
  font-family: "Pretendard Variable";
  src: url("fonts/PretendardVariable.woff2") format("woff2-variations"), url("fonts/PretendardVariable.woff2") format("woff2");
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --panel: #fafafa;
  --ink: #111111;
  --ink-2: #555555;      /* 보조 글자 (대비 7.5:1) */
  --ink-3: #767676;      /* 주석 (대비 4.5:1) */
  --line: #e6e6e6;
  --line-2: #cfcfcf;
  --accent: #1e3a5f;     /* 강조색은 이것 하나(딥 네이비): 주 버튼, 현재 메뉴, 현재 탭, 초점 */
  --accent-hover: #142a46;
  --accent-tint: rgba(30, 58, 95, .12);
  --accent-soft: #eef2f7;
  /* 상태색: 뜻이 있을 때만, 항상 글자와 함께 */
  --ok: #0b7a3e;
  --danger: #c4161c;
  --danger-tint: #fdf2f2;
  --warn: #8a5a00;
  --warn-tint: #fff8e6;
  --warn-line: #e3b04b;
  --info-tint: #f5f6ff;

  --bar: 56px;
  --row: 30px;
  --font: "Pretendard Variable", Pretendard, "Malgun Gothic", "Apple SD Gothic Neo", "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 14px/1.55 var(--font); letter-spacing: -0.003em;
  word-break: keep-all; overflow-wrap: break-word;   /* 한글은 어절 단위로 줄바꿈 */
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  caret-color: var(--accent);
  scrollbar-color: var(--line-2) transparent;
}
::selection { background: var(--accent); color: #fff; }
a { color: var(--ink); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code { font-family: Consolas, "D2Coding", monospace; font-size: .9em; background: var(--panel); border: 1px solid var(--line); padding: 1px 5px; }
.num, .metric-value, .grid-table, .ytm-table, input { font-variant-numeric: tabular-nums; }

/* 상단 메뉴 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: stretch; gap: 40px;
  height: var(--bar); padding: 0 32px;
  background: var(--bg); border-bottom: 1px solid var(--ink);
}
.topbar .brand { display: flex; align-items: center; color: var(--ink); font-weight: 800; font-size: 15px; letter-spacing: -0.02em; text-decoration: none; white-space: nowrap; }
.topbar nav { display: flex; gap: 28px; overflow-x: auto; scrollbar-width: none; }
.topbar nav a {
  display: flex; align-items: center; color: var(--ink-2); text-decoration: none; white-space: nowrap;
  font-size: 14px; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .2s ease-out, border-color .2s ease-out;
}
.topbar nav a:hover { color: var(--ink); }
.topbar nav a[aria-current="page"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }
.topbar .logout { margin-left: auto; align-self: center; background: none; border: 0; padding: 6px 0; font: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.topbar .logout:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* 왼쪽 입력, 오른쪽 결과 */
.layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); min-height: calc(100vh - var(--bar)); }
.inputs {
  position: sticky; top: var(--bar); height: calc(100vh - var(--bar)); overflow-y: auto;
  background: var(--panel); border-right: 1px solid var(--line); padding: 28px 28px 0;
}
.results { min-width: 0; padding: 40px 48px 64px; max-width: 1440px; }
.page { max-width: 1200px; margin: 0 auto; padding: 72px 48px 80px; }

h1 { font-size: 32px; line-height: 1.3; font-weight: 800; letter-spacing: -0.03em; margin: 0 0 10px; text-wrap: balance; }
h2 { font-size: 18px; line-height: 1.4; font-weight: 700; letter-spacing: -0.02em; margin: 48px 0 16px; }
.caption { color: var(--ink-2); font-size: 15px; margin: 0 0 36px; max-width: 70ch; text-wrap: pretty; }
p, .metric-help, .hint, .note { text-wrap: pretty; }
.subtitle { font-size: 13px; font-weight: 500; color: var(--ink-2); margin: 0 0 20px; }
.facts { color: var(--ink-3); font-size: 12px; margin: 0 0 24px; }
.empty { color: var(--ink-3); padding: 28px 0; margin: 0; border-top: 2px solid var(--ink); }

/* 입력 */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset + fieldset, fieldset + .note, .note + fieldset { margin-top: 28px; }
legend { float: left; width: 100%; padding: 0 0 8px; margin: 0 0 16px; font-size: 13px; font-weight: 700; color: var(--ink); border-bottom: 1px solid var(--ink); }
legend + * { clear: both; }
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }
.field:has([required]) > .field-label::after { content: " *"; color: var(--accent); }
input[type="text"], input[type="password"], input[type="date"], select, textarea {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: 0; background: #fff;
  font: inherit; font-size: 14px; color: inherit;
  transition: border-color .15s ease-out, box-shadow .15s ease-out;
}
input[inputmode="decimal"], input[inputmode="numeric"] { text-align: right; }
textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
input[type="file"] { font: inherit; font-size: 13px; max-width: 100%; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 600; height: 36px; margin-right: 12px; padding: 0 14px; border: 1px solid var(--ink); background: #fff; color: var(--ink); cursor: pointer; }
.check { display: flex; align-items: flex-start; gap: 10px; margin: 6px 0 14px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }
.hint { font-size: 12px; color: var(--ink-3); margin: -6px 0 14px; }
.hint.warn { color: var(--warn); font-weight: 600; }
.hint.bad { color: var(--danger); font-weight: 700; }
.note { font-size: 12px; color: var(--ink-2); background: #fff; border: 1px solid var(--line); padding: 12px 14px; margin: 4px 0 14px; line-height: 1.6; }
.note b { color: var(--ink); }
.is-hidden { display: none !important; }

/* 접는 입력 묶음 */
fieldset[data-collapsible] > legend { padding-bottom: 0; }
.group-toggle {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 0 0 8px; border: 0; background: none;
  font: inherit; font-size: 13px; font-weight: 700; color: var(--ink); text-align: left;
}
.group-toggle::after {
  content: ""; width: 7px; height: 7px; margin: 0 4px 3px auto; flex: none;
  border-right: 1.5px solid var(--ink-2); border-bottom: 1.5px solid var(--ink-2);
  transform: rotate(45deg); transition: transform .2s ease-out;
}
.group-toggle[aria-expanded="false"]::after { transform: rotate(-45deg); margin-bottom: 0; }
.group-summary { font-weight: 500; color: var(--ink-3); font-size: 12px; }
.group-toggle[aria-expanded="true"] .group-summary { display: none; }
.group-toggle:hover .group-title { color: var(--accent); }
fieldset.is-collapsed > legend { margin-bottom: 0; }
fieldset.is-collapsed > .group-body { display: none; }

/* 버튼 */
button { font: inherit; cursor: pointer; border-radius: 0; }
button:disabled { opacity: .55; cursor: progress; }
/* 실행 버튼: 입력판 맨 아래에 고정 */
.run-bar {
  position: sticky; bottom: 0; z-index: 5;
  margin: 24px -28px 0; padding: 16px 28px 20px;
  background: var(--panel); border-top: 1px solid var(--line);
}
button.primary {
  width: 100%; height: 48px; border: 0;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 700;
  transition: background-color .2s ease-out;
}
button.primary:hover:not(:disabled) { background: var(--accent-hover); }
button.secondary {
  height: 40px; padding: 0 18px; border: 1px solid var(--ink);
  background: #fff; color: var(--ink); font-weight: 600;
  transition: background-color .2s ease-out, color .2s ease-out;
}
button.secondary:hover:not(:disabled) { background: var(--ink); color: #fff; }
button.link { border: 0; background: none; color: var(--accent); padding: 4px 0; font-size: 13px; font-weight: 600; }
button.link:hover { text-decoration: underline; text-underline-offset: 3px; }
button.icon { border: 0; background: none; color: var(--ink-3); width: 28px; height: 28px; }
button.icon:hover { background: var(--danger-tint); color: var(--danger); }

/* 메시지: 전체 테두리 + 앞머리 글자. 색 없이도 종류가 읽힌다. */
.msg { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 12px 16px; margin: 0 0 16px; border: 1px solid; white-space: pre-line; font-size: 13px; line-height: 1.6; }
.msg::before { font-weight: 700; white-space: nowrap; }
.msg.error { background: var(--danger-tint); border-color: var(--danger); color: var(--danger); }
.msg.error::before { content: "오류"; }
.msg.warn { background: var(--warn-tint); border-color: var(--warn-line); color: var(--warn); }
.msg.warn::before { content: "주의"; }
.msg.info { background: var(--info-tint); border-color: var(--line-2); color: var(--ink); }
.msg.info::before { content: "참고"; color: var(--ink-2); }

/* 결과 지표: 검정 2px 괘선 아래 숫자 줄. 상자·배경 없음 */
.metrics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 40px;
  border-top: 2px solid var(--ink); padding-top: 20px; margin-bottom: 24px;
}
.metric { min-width: 0; padding-bottom: 8px; }
.metric-label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.metric-value { font-size: 28px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.3; margin-top: 4px; white-space: nowrap; }
.metric-help { font-size: 12px; color: var(--ink-3); margin-top: 6px; line-height: 1.5; }
.metric.ok .metric-value { color: var(--ok); }
.metric.bad .metric-value { color: var(--danger); }
/* 최종값이 있으면 줄 맨 앞에 크게, 나머지 구성요소는 같은 줄 오른쪽에 */
.metrics:has(.lead) { display: flex; flex-wrap: wrap; column-gap: 40px; }
.metrics:has(.lead) .metric { flex: 1 0 auto; }
.metrics:has(.lead) .metric.lead { flex: 2 0 auto; }
.metrics:has(.lead) .metric-help { max-width: 26ch; }
.metric.lead { order: -1; }
.metric.lead .metric-label { color: var(--ink); font-weight: 700; }
.metric.lead .metric-value { font-size: 48px; font-weight: 800; letter-spacing: -0.035em; margin-top: 2px; }

.download { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; margin: 0 0 32px; }
.download:not(:has(.download-note > *)):not(:has(button)) { display: none; }
.download-note { flex: 1 1 320px; }
.download-note .msg { margin: 0 0 8px; }

/* 계산 뒤: 제목을 줄이고, 요약 바(최종값·조건·내려받기)를 위에 고정 */
.has-result .results > h1 { font-size: 20px; margin-bottom: 0; }
.has-result .results > .caption { display: none; }
.has-result .results > #status:empty + #placeholder[hidden] { display: none; }
.result-bar {
  position: sticky; top: var(--bar); z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  margin: 12px -48px 16px; padding: 14px 48px;
  background: var(--bg); border-bottom: 1px solid transparent;
  transition: border-color .2s ease-out;
}
.result-bar.is-stuck { border-bottom-color: var(--line); }
.result-bar-main { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 28px; min-width: 0; }
.result-bar-lead { display: none; align-items: baseline; gap: 10px; white-space: nowrap; }
.result-bar.show-lead .result-bar-lead { display: flex; }
.result-bar-label { font-size: 13px; font-weight: 700; }
.result-bar-value { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.result-bar button.secondary { flex: none; background: var(--accent); border-color: var(--accent); color: #fff; }
.result-bar button.secondary:hover:not(:disabled) { background: var(--accent-hover); }
ul.subtitle, ul.facts { display: flex; flex-wrap: wrap; gap: 4px 20px; list-style: none; padding: 0; }
ul.subtitle { margin: 0; font-size: 13px; }
ul.subtitle li, ul.facts li { white-space: nowrap; }
ul.facts { margin: 0 0 24px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }

/* 입력이 바뀐 뒤의 옛 결과 */
.stale-note {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 16px 0; padding: 10px 16px; border: 1px solid var(--accent); background: var(--accent-soft); font-size: 13px; color: var(--accent);
}
.stale-note[hidden] { display: none; }
.stale-note button.link { color: var(--accent); }
#output.is-stale .metrics, #output.is-stale .result-bar-lead, #output.is-stale .tab-panel { opacity: .4; transition: opacity .2s ease-out; }

/* 탭과 표 */
.tabs {
  display: flex; flex-wrap: nowrap; gap: 0 24px; border-bottom: 1px solid var(--line); margin-top: 8px;
  overflow-x: auto; scrollbar-width: thin; scroll-padding-inline: 24px;
}
.tabs:has(.tab:nth-child(7)) { -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent); mask-image: linear-gradient(90deg, #000 92%, transparent); padding-right: 40px; }
.tab { flex: none; }
.tab {
  border: 0; border-bottom: 2px solid transparent; background: none; margin-bottom: -1px;
  padding: 10px 0; color: var(--ink-3); white-space: nowrap; font-size: 13px; font-weight: 500;
  transition: color .2s ease-out, border-color .2s ease-out;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 700; }
.tab-panel { padding-top: 16px; }

.grid-scroll { overflow: auto; max-height: 520px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); background: #fff; }
.grid-table { border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 13px; }
.grid-table th, .grid-table td {
  height: var(--row); padding: 0 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.grid-table th {
  position: sticky; top: 0; z-index: 2;
  background: #fff; font-weight: 600; font-size: 12px; color: var(--ink-2); text-align: left;
  border-bottom-color: var(--line-2);
}
.grid-table td.num { text-align: right; }
.grid-table tbody tr:hover td { background: var(--panel); }
.grid-table .idx { position: sticky; left: 0; z-index: 1; background: #fff; color: var(--ink-3); border-right: 1px solid var(--line); }
.grid-table th.idx { z-index: 3; }
.grid-table td.pass { color: var(--ok); font-weight: 700; }
.grid-table td.fail { color: var(--danger); font-weight: 700; background: var(--danger-tint); }
.grid-table tr.loading td { color: var(--ink-3); }
.grid-meta { font-size: 12px; color: var(--ink-3); margin-top: 8px; }
.grid-loading { color: var(--ink-3); padding: 16px 0; }

/* YTM·배당 입력표 */
.ytm { border: 1px solid var(--line); padding: 14px; margin: 0 0 14px; background: #fff; }
.seg { display: inline-flex; border: 1px solid var(--ink); overflow: hidden; margin-bottom: 12px; background: #fff; }
.seg label { position: relative; padding: 6px 14px; font-size: 13px; font-weight: 500; cursor: pointer; }
.seg label + label { border-left: 1px solid var(--ink); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--ink); color: #fff; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.ytm-table { width: 100%; border-collapse: collapse; }
.ytm-table th { font-size: 12px; color: var(--ink-2); font-weight: 500; text-align: left; padding: 0 4px 6px; }
.ytm-table td { padding: 2px 4px; }
.ytm-table input { height: 32px; padding: 0 8px; }
.ytm-table td:last-child { width: 32px; }
.ytm-fill { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; align-items: end; margin-top: 8px; }
.ytm-fill button { grid-column: 1 / -1; margin-bottom: 10px; }
.ytm-preview table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.ytm-preview td, .ytm-preview th { padding: 3px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.ytm-preview th { color: var(--ink-2); font-weight: 500; }
/* 업로드한 수익률표의 행 선택: 파일 모습 그대로 보여 주고 한 행을 누른다 */
.ytm-pick { max-height: 264px; overflow: auto; margin: 0 0 12px; border: 1px solid var(--line-2); }
.ytm-pick table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 12px; line-height: 1.4; }
.ytm-pick th { position: sticky; top: 0; z-index: 1; background: var(--panel); color: var(--ink-2); font-weight: 500; text-align: left; padding: 6px; border-bottom: 1px solid var(--line-2); overflow-wrap: anywhere; }
.ytm-pick td { padding: 5px 6px; border-bottom: 1px solid var(--line); cursor: pointer; vertical-align: middle; overflow-wrap: anywhere; }
.ytm-pick tr.is-match td { font-weight: 600; color: var(--ink); background: var(--warn-tint); }
.ytm-pick th:first-child, .ytm-pick td:first-child { width: 36px; text-align: center; border-left: 2px solid transparent; }
.ytm-pick tr:hover td { background: var(--panel); }
.ytm-pick tr:has(input:checked) td { background: var(--accent-soft); }
.ytm-pick tr:has(input:checked) td:first-child { border-left-color: var(--accent); }
.ytm-pick input[type="radio"] { width: 14px; height: 14px; margin: 0; accent-color: var(--accent); vertical-align: middle; }

/* 홈 */
.home-hero { margin-bottom: 56px; }
.home-hero h1 { font-size: 56px; line-height: 1.3; letter-spacing: -0.045em; margin-bottom: 12px; }
.home-hero .caption { font-size: 18px; margin: 0; max-width: 60ch; }
.home-grid { border-top: 2px solid var(--ink); }
.card {
  display: grid; grid-template-columns: 260px minmax(0, 1fr) 40px; align-items: baseline; gap: 32px;
  padding: 26px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit;
}
.card h2 { font-size: 24px; line-height: 1.35; font-weight: 800; letter-spacing: -0.03em; margin: 0; transition: color .2s ease-out; }
.card p { margin: 0; color: var(--ink-2); font-size: 15px; max-width: 68ch; }
.card .card-go { justify-self: end; font-size: 20px; line-height: 1.35; color: var(--ink-3); transition: transform .25s cubic-bezier(.16, 1, .3, 1), color .2s ease-out; }
.card:hover h2, .card:hover .card-go { color: var(--accent); }
.card:hover .card-go { transform: translateX(6px); }
.howto { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; margin: 72px 0 0; padding: 24px 0 0; list-style: none; border-top: 1px solid var(--ink); }
.howto li { font-size: 14px; color: var(--ink-2); line-height: 1.65; }
.howto li b { display: block; color: var(--ink); font-size: 14px; font-weight: 700; margin-bottom: 6px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media (max-width: 1100px) {
  .card { grid-template-columns: 200px minmax(0, 1fr) 32px; gap: 24px; }
}
@media (max-width: 900px) {
  .topbar { gap: 20px; padding: 0 16px; }
  .topbar nav { gap: 20px; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 24px; }
  .layout { grid-template-columns: 1fr; }
  .inputs { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 24px 16px 0; }
  .run-bar { margin: 20px -16px 0; padding: 12px 16px 16px; }
  .result-bar { position: static; margin: 8px -16px 16px; padding: 12px 16px; flex-wrap: wrap; }
  .results { padding: 28px 16px 48px; }
  .page { padding: 40px 16px 56px; }
  h1 { font-size: 24px; }
  .home-hero h1 { font-size: 38px; }
  .metric.lead .metric-value { font-size: 38px; }
  .card { grid-template-columns: minmax(0, 1fr) 24px; gap: 8px 16px; padding: 20px 0; }
  .card h2 { font-size: 20px; }
  .card p { grid-column: 1; grid-row: 2; font-size: 14px; }
  .card .card-go { grid-column: 2; grid-row: 1; }
  .howto { grid-template-columns: 1fr; gap: 20px; }
}

/* 인쇄·PDF: 메뉴·버튼은 빼고, 결과를 먼저, 입력 조건은 그 뒤에 3단으로 압축 */
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  body { font-size: 11px; }
  .topbar, .run-bar, .result-bar button, .stale-note, .group-toggle::after, .tabs .tab:not([aria-selected="true"]), button.link, button.icon, .seg, #placeholder { display: none !important; }
  .result-bar { position: static; margin: 0 0 12px; padding: 0 0 8px; background: none; }
  fieldset.is-collapsed > .group-body { display: block; }
  .group-summary { display: none; }
  .tabs { mask-image: none; -webkit-mask-image: none; }
  .layout { display: flex; flex-direction: column-reverse; min-height: 0; }
  .inputs { position: static; height: auto; overflow: visible; background: #fff; border: 0; border-top: 2px solid var(--ink); margin-top: 8mm; padding: 10px 0 0; }
  .inputs::before { content: "입력 조건"; display: block; font-weight: 700; font-size: 13px; margin-bottom: 8px; }
  .inputs form { columns: 3; column-gap: 18px; }
  .inputs fieldset { break-inside: avoid; padding-top: 8px; }
  .inputs legend { margin-bottom: 6px; }
  .inputs .hint, .inputs .note, .inputs .ytm-fill { display: none; }
  .inputs .field { margin-bottom: 4px; }
  .inputs input, .inputs select { height: 22px; padding: 0 4px; font-size: 10px; }
  .results { padding: 0; }
  h1 { font-size: 20px; }
  .caption { margin-bottom: 16px; }
  .grid-scroll { max-height: none; overflow: visible; }
  .metrics, .metric { break-inside: avoid; }
}

/* 입력 저장·불러오기 */
.io-bar { display: flex; justify-content: flex-end; gap: 16px; margin: 0 0 8px; }
.io-bar .link { font-size: 13px; }

/* 민감도 분석(SO·RCPS 결과 아래). 데이터 색은 한 계열이라 --series-1 하나(대비·명도·채도 검증 통과) */
:root { --series-1: #2f5d93; }
.sensitivity { margin-top: 8px; }
.sens-controls { display: grid; grid-template-columns: minmax(140px, 1.4fr) repeat(3, minmax(90px, 1fr)) auto; gap: 0 12px; align-items: end; }
.sens-controls button { margin-bottom: 14px; }
.sens-title { font-size: 15px; margin: 20px 0 8px; }
.sens-chart-wrap { position: relative; max-width: 720px; }
.sens-chart { display: block; width: 100%; height: auto; overflow: visible; }
.sens-grid { stroke: var(--line); stroke-width: 1; }
.sens-baseline { stroke: var(--line-2); stroke-width: 1; }
.sens-axis { font-size: 11px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.sens-line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sens-dot { fill: var(--series-1); stroke: var(--bg); stroke-width: 2; }
.sens-base { fill: var(--bg); stroke: var(--series-1); stroke-width: 2; }
.sens-label { font-size: 12px; font-weight: 600; fill: var(--ink-2); }
.sens-cross { stroke: var(--ink-3); stroke-width: 1; }
.sens-focus { fill: var(--series-1); stroke: var(--bg); stroke-width: 2; }
.sens-hit { fill: transparent; cursor: crosshair; }
.sens-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 160px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--ink); font-size: 12px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.sens-tip-title { font-weight: 700; }
.sens-tip-sub { color: var(--ink-2); }
.sens-table { border-collapse: collapse; margin: 12px 0 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
.sens-table th, .sens-table td { padding: 5px 14px 5px 0; border-bottom: 1px solid var(--line); text-align: right; }
.sens-table th { color: var(--ink-2); font-weight: 500; }
@media (max-width: 720px) { .sens-controls { grid-template-columns: 1fr 1fr; } }

/* 가격 파일(일자·종가) */
.price-file-summary { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: baseline; margin: -6px 0 14px; padding: 8px 10px; border: 1px solid var(--line); font-size: 13px; font-variant-numeric: tabular-nums; }
.price-file-summary span { grid-column: 1; color: var(--ink-2); }
.price-file-summary button { grid-column: 2; grid-row: 1 / span 2; }

/* 로그인 화면(서버 모드) */
.login-page { max-width: 440px; }
.login-page form { margin-top: 32px; }
.login-page button.primary { margin-top: 8px; }
