:root {
  color-scheme: light;
  --navy-950: #081525;
  --navy-900: #0d1d30;
  --ink: #14263a;
  --muted: #68798b;
  --subtle: #8b99a8;
  --line: #dce4eb;
  --line-soft: #e9eef3;
  --canvas: #f4f7fa;
  --white: #ffffff;
  --blue: #176ca5;
  --blue-soft: #e9f3fa;
  --orange: #e66f28;
  --orange-dark: #c95917;
  --green: #20a979;
  --red: #cb4b4b;
  --shadow: 0 18px 50px rgba(28, 48, 70, .08);
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); font-size: 16px; }
button, input { font: inherit; }
svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 26px 18px 22px; display: flex; flex-direction: column; overflow: auto; background: var(--navy-950); color: #fff; }
.brand { padding: 0 8px 25px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.14); border-radius: 11px; background: linear-gradient(145deg, #163853, #0e2438); color: #55d6df; box-shadow: inset 0 0 0 1px rgba(85,214,223,.06); }
.brand-mark svg { width: 23px; height: 23px; }
.brand-copy { min-width: 0; display: grid; gap: 3px; }
.brand-copy strong { font-size: 1.05rem; letter-spacing: -.02em; }
.brand-copy small { color: #7891a9; font: 700 .65rem/1.2 Consolas, "IBM Plex Mono", monospace; letter-spacing: .11em; }
.nav-label { margin: 0 10px 10px; color: #657b91; font: 700 .68rem/1.3 Consolas, "IBM Plex Mono", monospace; letter-spacing: .13em; }
.side-nav { margin-top: 26px; }
.nav-item { position: relative; min-height: 46px; margin-bottom: 5px; padding: 0 12px; display: flex; align-items: center; gap: 11px; border: 1px solid transparent; border-radius: 10px; color: #9fb0c1; text-decoration: none; font-size: .9rem; font-weight: 650; transition: background .18s, border-color .18s, color .18s; }
.nav-item svg { width: 19px; height: 19px; }
.nav-item:hover { border-color: rgba(255,255,255,.08); background: rgba(255,255,255,.04); color: #fff; }
.nav-item.active { border-color: rgba(69,190,202,.2); background: linear-gradient(90deg, rgba(32,167,181,.17), rgba(32,167,181,.06)); color: #fff; }
.nav-item.active::before { position: absolute; left: -19px; width: 3px; height: 24px; border-radius: 0 4px 4px 0; background: #45beca; content: ""; }
.nav-item.active svg { color: #55d6df; }
.sidebar-status { margin-top: auto; padding: 22px 10px 18px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-status .nav-label { margin-left: 0; }
.model-row { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #7891a9; font-size: .76rem; }
.model-row strong { color: #c3d0dc; font-size: .76rem; font-weight: 650; }
.model-row i { width: 6px; height: 6px; margin-right: 6px; display: inline-block; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(32,169,121,.12); vertical-align: 1px; }
.sidebar-foot { margin: 0 10px; color: #526a81; font: 600 .64rem/1.7 Consolas, "IBM Plex Mono", monospace; letter-spacing: .08em; }

.workspace { min-width: 0; }
.topbar { height: 66px; padding: 0 clamp(24px, 3vw, 44px); display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.88); backdrop-filter: blur(12px); }
.mobile-brand { display: none; }
.breadcrumb { display: flex; align-items: center; gap: 9px; color: #8795a4; font: 700 .72rem/1 Consolas, "IBM Plex Mono", monospace; letter-spacing: .09em; }
.breadcrumb b { color: #c1cbd5; }
.breadcrumb strong { color: #42586e; }
.calculation-status { min-width: 105px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: #52677c; font-size: .8rem; font-weight: 700; }
.calculation-status i { width: 8px; height: 8px; border-radius: 50%; background: #8ba0b4; box-shadow: 0 0 0 4px rgba(139,160,180,.12); }
.status-complete, .status-error { display: none; }
.workspace:has(#result-state:not([hidden])) .calculation-status i { background: var(--green); box-shadow: 0 0 0 4px rgba(32,169,121,.12); }
.workspace:has(#result-state:not([hidden])) .status-ready { display: none; }
.workspace:has(#result-state:not([hidden])) .status-complete { display: inline; color: #23835f; }
.workspace:has(#error-state:not([hidden])) .calculation-status i { background: var(--red); box-shadow: 0 0 0 4px rgba(203,75,75,.12); }
.workspace:has(#error-state:not([hidden])) .status-ready { display: none; }
.workspace:has(#error-state:not([hidden])) .status-error { display: inline; color: var(--red); }

.workspace-content { width: min(100% - 48px, 1240px); margin: 0 auto; padding: 38px 0 24px; }
.page-heading { margin-bottom: 25px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.eyebrow { margin: 0 0 8px; color: var(--blue); font: 700 .72rem/1.35 Consolas, "IBM Plex Mono", monospace; letter-spacing: .14em; }
.page-heading h1 { margin: 0; color: #102339; font-size: clamp(1.8rem, 3vw, 2.25rem); line-height: 1.14; letter-spacing: -.045em; }
.page-heading p:not(.eyebrow) { margin: 10px 0 0; color: var(--muted); line-height: 1.65; }
.assumption-chips { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.assumption-chips span { min-width: 78px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.75); color: #52677c; font: 650 .75rem/1 Consolas, "IBM Plex Mono", monospace; text-align: center; }
.assumption-chips b { margin-right: 4px; color: var(--blue); }

.dashboard-grid { display: grid; grid-template-columns: minmax(360px, .88fr) minmax(430px, 1.12fr); gap: 20px; align-items: stretch; }
.panel { min-width: 0; padding: 27px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); box-shadow: var(--shadow); }
.panel-heading { min-height: 48px; margin-bottom: 25px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-heading > div { display: flex; align-items: flex-start; gap: 12px; }
.panel-index { width: 31px; height: 31px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; background: var(--navy-900); color: #fff; font: 700 .72rem/1 Consolas, "IBM Plex Mono", monospace; }
.panel-index.accent { background: var(--blue-soft); color: var(--blue); }
.panel-heading h2 { margin: 0; color: #1c3044; font-size: 1.03rem; line-height: 1.3; }
.panel-heading p { margin: 4px 0 0; color: var(--subtle); font-size: .76rem; }
.required-badge, .result-badge { padding: 6px 9px; border: 1px solid var(--line-soft); border-radius: 999px; background: #f7f9fb; color: #7d8d9d; font-size: .7rem; font-weight: 700; white-space: nowrap; }
.result-badge { color: #378062; font: 700 .66rem/1.2 Consolas, "IBM Plex Mono", monospace; letter-spacing: .07em; }
.result-badge i { width: 6px; height: 6px; margin-right: 6px; display: inline-block; border-radius: 50%; background: var(--green); }

.field-section { min-width: 0; margin: 0; padding: 0; border: 0; }
.field-section + .field-section { margin-top: 25px; padding-top: 23px; border-top: 1px solid var(--line-soft); }
.field-section legend { width: 100%; margin-bottom: 15px; padding: 0; color: #6a7b8c; font-size: .75rem; font-weight: 750; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px 15px; }
.field { min-width: 0; display: block; }
.field-wide { grid-column: 1 / -1; }
.field-heading { margin-bottom: 8px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: #2d4358; font-size: .8rem; font-weight: 700; }
.field-heading > span:last-child { color: #94a1ae; font: 500 .68rem/1 Consolas, "IBM Plex Mono", monospace; }
.field-heading em { margin-left: 3px; color: var(--blue); font: 500 .76rem/1 Consolas, "IBM Plex Mono", monospace; }
.input-wrap { position: relative; display: block; }
.input-wrap input { width: 100%; height: 47px; padding: 0 63px 0 14px; border: 1px solid #ced8e1; border-radius: 9px; outline: none; background: #fbfcfd; color: #14283d; font-size: .95rem; font-weight: 750; transition: border-color .18s, box-shadow .18s, background .18s; }
.input-wrap input:hover { border-color: #9eafbf; }
.input-wrap input:focus { border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px rgba(23,108,165,.13); }
.input-wrap > span { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: #8998a7; font: 500 .69rem/1 Consolas, "IBM Plex Mono", monospace; pointer-events: none; }
.calculate-button { width: 100%; height: 50px; margin-top: 27px; padding: 0 16px; display: flex; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 9px; background: var(--orange); color: #fff; font-weight: 800; cursor: pointer; box-shadow: 0 9px 22px rgba(230,111,40,.2); transition: transform .12s, background .18s, box-shadow .18s; }
.calculate-button svg { width: 19px; height: 19px; }
.calculate-button span { margin-left: auto; font-size: 1.1rem; }
.calculate-button::before { width: 18px; content: ""; }
.calculate-button:hover { background: var(--orange-dark); box-shadow: 0 11px 25px rgba(201,89,23,.26); }
.calculate-button:active { transform: translateY(1px); }
.calculate-button:focus-visible { outline: 3px solid rgba(230,111,40,.3); outline-offset: 3px; }

.result-panel { display: flex; flex-direction: column; background: linear-gradient(150deg, #fff 0%, #fff 62%, #f8fbfd 100%); }
.result-panel-heading { margin-bottom: 21px; }
.empty-state { min-height: 352px; flex: 1; padding: 28px; display: flex; align-items: center; justify-content: center; gap: 16px; border: 1px dashed #cbd7e1; border-radius: 13px; background: linear-gradient(145deg, #f8fafc, #f3f7fa); text-align: left; }
.empty-icon { width: 50px; height: 50px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid #d5e3ed; border-radius: 12px; background: #fff; color: var(--blue); }
.empty-icon svg { width: 25px; height: 25px; }
.empty-state strong { color: #334b61; font-size: .9rem; }
.empty-state p { margin: 5px 0 0; color: #81909f; font-size: .78rem; line-height: 1.55; }
.error-state { min-height: 130px; padding: 22px; display: flex; align-items: flex-start; gap: 13px; border: 1px solid #edcccc; border-radius: 12px; background: #fff6f5; color: #8c3434; }
.error-state svg { width: 24px; height: 24px; flex: 0 0 auto; color: var(--red); }
.error-state strong { font-size: .86rem; }
.error-state p { margin: 6px 0 0; color: #a15151; font-size: .8rem; line-height: 1.6; }
.result-state { flex: 1; }
.primary-result { min-height: 142px; padding: 24px 25px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; border-radius: 13px; background: var(--navy-900); color: #fff; box-shadow: 0 12px 28px rgba(13,29,48,.16); }
.primary-result p { margin: 0 0 6px; color: #dbe5ee; font-size: .84rem; font-weight: 700; }
.primary-result > div > span { color: #7691aa; font: 650 .63rem/1.3 Consolas, "IBM Plex Mono", monospace; letter-spacing: .09em; }
.primary-value { display: flex; align-items: flex-end; gap: 8px; text-align: right; }
.primary-value strong { color: #fff; font-size: clamp(2.15rem, 4vw, 3rem); line-height: .95; letter-spacing: -.045em; }
.primary-value span { padding-bottom: 4px; color: #94aabd !important; font-size: .78rem !important; letter-spacing: 0 !important; }
.result-grid { margin: 14px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.result-grid div { min-width: 0; min-height: 90px; padding: 15px 16px; border: 1px solid var(--line-soft); border-radius: 11px; background: #fff; }
.result-grid dt { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: #718293; font-size: .72rem; }
.result-grid dt em { color: var(--blue); font: 600 .74rem/1 Consolas, "IBM Plex Mono", monospace; }
.result-grid dd { margin: 14px 0 0; overflow-wrap: anywhere; color: #20374d; font: 750 .96rem/1.25 Consolas, "IBM Plex Mono", monospace; }
.result-note { margin: 14px 0 0; padding: 12px 14px; display: flex; align-items: flex-start; gap: 9px; border-radius: 9px; background: #edf8f4; color: #426e5d; font-size: .75rem; line-height: 1.6; }
.result-note svg { width: 17px; height: 17px; margin-top: 1px; flex: 0 0 auto; color: var(--green); }

.assumption-panel { margin-top: 20px; padding: 20px 22px; display: grid; grid-template-columns: minmax(220px, .75fr) minmax(350px, 1fr) minmax(260px, 1.15fr); align-items: center; gap: 24px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.assumption-title { display: flex; align-items: center; gap: 12px; }
.assumption-title > span { width: 39px; height: 39px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; background: var(--blue-soft); color: var(--blue); }
.assumption-title svg { width: 21px; height: 21px; }
.assumption-title p { margin: 0 0 3px; color: #7890a5; font: 650 .62rem/1.2 Consolas, "IBM Plex Mono", monospace; letter-spacing: .09em; }
.assumption-title h2 { margin: 0; color: #2a4157; font-size: .86rem; }
.assumption-facts { display: grid; grid-template-columns: repeat(3, 1fr); }
.assumption-facts div { padding: 0 14px; border-left: 1px solid var(--line-soft); }
.assumption-facts span { display: block; margin-bottom: 5px; color: #8997a5; font-size: .67rem; }
.assumption-facts strong { color: #30485e; font: 700 .76rem/1.25 Consolas, "IBM Plex Mono", monospace; }
.assumption-panel > p { margin: 0; color: #778797; font-size: .72rem; line-height: 1.6; }
footer { padding: 20px 2px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; color: #8694a2; font-size: .68rem; line-height: 1.55; }
footer span { color: #627589; font: 650 .65rem/1.5 Consolas, "IBM Plex Mono", monospace; white-space: nowrap; }
footer p { max-width: 720px; margin: 0; text-align: right; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 214px minmax(0, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .result-panel { min-height: 0; }
  .empty-state { min-height: 190px; }
  .assumption-panel { grid-template-columns: 1fr 1.3fr; }
  .assumption-panel > p { grid-column: 1 / -1; padding-top: 14px; border-top: 1px solid var(--line-soft); }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { height: 62px; padding: 0 18px; }
  .mobile-brand { display: flex; align-items: center; gap: 9px; color: #1a3046; }
  .mobile-brand .brand-mark { width: 34px; height: 34px; border-color: #d4e1e9; background: var(--navy-900); }
  .mobile-brand .brand-mark svg { width: 19px; height: 19px; }
  .mobile-brand strong { font-size: .92rem; }
  .breadcrumb { display: none; }
  .workspace-content { width: min(100% - 32px, 1240px); padding-top: 27px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .assumption-chips { justify-content: flex-start; }
  .panel { padding: 21px; border-radius: 14px; }
  .primary-result { align-items: flex-start; flex-direction: column; }
  .primary-value { align-self: flex-end; }
  .assumption-panel { grid-template-columns: 1fr; }
  .assumption-facts { padding: 14px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
  .assumption-panel > p { grid-column: auto; padding-top: 0; border-top: 0; }
  footer { align-items: flex-start; flex-direction: column; }
  footer p { text-align: left; }
}

@media (max-width: 500px) {
  .workspace-content { width: min(100% - 24px, 1240px); }
  .page-heading p:not(.eyebrow) { font-size: .88rem; }
  .assumption-chips span { min-width: 0; flex: 1 1 auto; }
  .panel-heading { align-items: flex-start; }
  .required-badge, .result-badge { display: none; }
  .field-grid, .result-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .empty-state { padding: 22px; align-items: flex-start; flex-direction: column; }
  .assumption-facts { grid-template-columns: 1fr; gap: 12px; }
  .assumption-facts div { padding: 0; border-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
