:root {
  --bg: #f7f8f5;
  --surface: #ffffff;
  --surface-soft: #eef5ef;
  --text: #171a17;
  --muted: #667067;
  --line: #dfe5df;
  --green: #0b7a43;
  --green-strong: #065f34;
  --green-soft: #e5f3ea;
  --red: #d94235;
  --amber: #b97a13;
  --shadow: 0 18px 40px rgba(24, 32, 24, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto auto minmax(240px, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 68px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 248, 245, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 800;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
}

.top-nav {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
}

.top-nav a {
  padding: 10px 14px;
  border-radius: 6px;
  color: #343a35;
  font-weight: 600;
}

.top-nav a:hover,
.top-nav a:focus {
  background: var(--green-soft);
  color: var(--green-strong);
}

.kimchi-ticker {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.kimchi-ticker span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: #343a35;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.kimchi-ticker b {
  font-size: 14px;
}

.kimchi-ticker.is-loading span {
  opacity: 0.7;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.icon-button svg,
.side-link svg,
.result-title svg {
  width: 18px;
  height: 18px;
}

.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: calc(100vh - 68px);
}

.sidebar {
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
  padding: 28px 20px;
  border-right: 1px solid var(--line);
  background: #fbfcfa;
}

.sidebar-title {
  margin: 0 0 16px;
  color: #2d342e;
  font-weight: 700;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  color: #454d47;
  font-weight: 600;
}

.side-link:hover,
.side-link.active {
  background: var(--green-soft);
  color: var(--green-strong);
}

.content {
  min-width: 0;
  padding: 28px;
}

.intro {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 780px;
  margin: 0;
  font-size: 36px;
  line-height: 1.22;
  letter-spacing: 0;
}

.intro-copy {
  max-width: 680px;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.workspace {
  display: block;
}

.calculator-stack {
  display: grid;
  gap: 16px;
}

.tool-panel,
.article-panel,
.result-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tool-panel,
.article-panel {
  padding: 24px;
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h2,
.article-panel h2 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.3;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.ghost-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #f7f9f7;
  color: #303731;
}

.primary-button {
  border: 0;
  background: var(--green);
  color: #fff;
}

.grid {
  display: grid;
  gap: 16px;
}

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

.compact-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.advanced-field {
  display: none;
}

label {
  display: grid;
  gap: 8px;
  color: #273029;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #d7ded8;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
}

input:focus,
select:focus,
button:focus {
  outline: 3px solid rgba(11, 122, 67, 0.16);
  outline-offset: 2px;
}

.input-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid #d7ded8;
  border-radius: 8px;
  background: #fff;
}

.input-unit input {
  border: 0;
}

.input-unit b {
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.stepper {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 46px;
}

.stepper input {
  border-radius: 0;
  text-align: center;
}

.stepper button {
  border: 1px solid #d7ded8;
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.stepper button:first-child {
  border-radius: 8px 0 0 8px;
}

.stepper button:last-child {
  border-radius: 0 8px 8px 0;
}

.result-card {
  padding: 18px;
}

.inline-result {
  margin-top: 18px;
  background: #fbfdfb;
  box-shadow: none;
}

.inline-result.is-collapsed {
  display: none;
}

.action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.action-row span {
  color: var(--muted);
  font-size: 13px;
}

.auto-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 44px;
  margin-bottom: 14px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: #2d342e;
  font-weight: 700;
}

.auto-status span:last-child {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.premium-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.premium-row {
  display: grid;
  grid-template-columns: 0.7fr 1.2fr 1.2fr 0.8fr;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 14px;
  border-top: 1px solid #edf0ed;
}

.premium-row:first-child {
  border-top: 0;
}

.premium-row span,
.premium-row b {
  text-align: right;
}

.premium-row strong {
  font-size: 16px;
}

.premium-row b {
  font-size: 17px;
}

.premium-head {
  min-height: 42px;
  background: #f7f9f7;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.premium-head span:first-child {
  text-align: left;
}

.result-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-weight: 800;
}

.result-title svg {
  color: var(--green);
}

dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

dl div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid #edf0ed;
}

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

dd {
  margin: 0;
  font-weight: 800;
  text-align: right;
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--red);
}

.warning {
  color: var(--amber);
}

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

.calculator-copy {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.calculator-copy h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.calculator-copy p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.article-grid article {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.article-grid h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.article-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.panel-copy {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.7;
}

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

.resource-grid a,
.content-links a,
.crumbs a,
.text-page .cta-link {
  color: var(--green);
  font-weight: 800;
}

.resource-grid a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.resource-grid a:hover,
.resource-grid a:focus {
  background: var(--green-soft);
}

.faq-list {
  display: grid;
  gap: 16px;
}

.faq-list article {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.faq-list h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.faq-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 28px;
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

.footer-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-footer a {
  color: var(--green);
  font-weight: 800;
  white-space: nowrap;
}

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

.text-page {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.text-page h1 {
  font-size: 30px;
}

.text-page h2 {
  margin: 28px 0 8px;
  font-size: 20px;
}

.text-page p,
.text-page li {
  color: var(--muted);
  line-height: 1.75;
}

.crumbs {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.text-page .lead {
  color: #3e4740;
  font-size: 17px;
}

.formula-box,
.note-box {
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.formula-box strong,
.note-box strong {
  display: block;
  margin-bottom: 8px;
}

.content-links {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.content-links a {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.content-links a:hover,
.content-links a:focus {
  background: var(--green-soft);
}

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 14px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-title {
    display: none;
  }

  .side-link {
    justify-content: center;
  }
}

@media (max-width: 980px) {
  .site-header {
    grid-template-columns: 1fr auto;
    gap: 12px;
  }

  .top-nav {
    display: none;
  }

  .kimchi-ticker {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-bottom: 10px;
  }
}

@media (max-width: 720px) {
  .site-header {
    min-height: 62px;
    padding: 0 16px;
  }

  .brand {
    font-size: 18px;
  }

  .content {
    padding: 18px 14px;
  }

  h1 {
    font-size: 28px;
  }

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

  .grid.two,
  .compact-grid,
  .premium-row,
  .article-grid,
  .resource-grid {
    grid-template-columns: 1fr;
  }

  .kimchi-ticker {
    overflow-x: auto;
  }

  .action-row {
    display: grid;
  }

  .auto-status,
  .premium-row {
    align-items: start;
  }

  .auto-status {
    display: grid;
    padding: 12px 14px;
  }

  .auto-status span:last-child,
  .premium-row span,
  .premium-row b {
    text-align: left;
  }

  .premium-head {
    display: none;
  }

  .premium-row {
    padding: 14px;
  }

  .section-heading {
    display: grid;
  }

  .tool-panel,
  .article-panel {
    padding: 18px;
  }

  .site-footer {
    display: grid;
    padding: 20px 14px;
  }

  .footer-links {
    justify-content: flex-start;
  }
}
