:root {
  --bg: #f7f8f3;
  --surface: #ffffff;
  --surface-soft: #eef6f2;
  --text: #242420;
  --muted: #63675f;
  --line: #d9ddcf;
  --primary: #2563eb;
  --secondary: #0f766e;
  --danger: #b42318;
  --warning: #b45309;
  --shadow: 0 16px 36px rgba(34, 38, 30, 0.10);
  font-family: Inter, "Segoe UI", "Noto Sans KR", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

code {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 0.94em;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(247, 248, 243, 0.96);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 230px;
}

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

.brand small,
.meta,
.muted {
  color: var(--muted);
}

.brand small {
  display: block;
  font-size: 12px;
  line-height: 1.35;
}

.site-nav,
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.site-nav a,
.footer-links a,
.text-link {
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 700;
}

.site-nav a:hover,
.footer-links a:hover,
.text-link:hover {
  color: var(--text);
  background: #e9ecdf;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.78fr);
  gap: 18px;
  padding: 34px 0 20px;
}

.hero-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

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

h2 {
  margin-bottom: 12px;
  font-size: 25px;
  line-height: 1.25;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
  letter-spacing: 0;
}

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

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

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

.hero-visual {
  margin: 0 0 14px;
}

.hero-visual img {
  display: block;
  width: 100%;
  aspect-ratio: 760 / 430;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat {
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: #fbfdf9;
}

.stat strong {
  display: block;
  font-size: 28px;
  line-height: 1.1;
}

.tool-grid,
.content-grid,
.category-grid,
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.tool-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
}

.section {
  padding: 28px 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 14px;
}

.section-head p {
  max-width: 720px;
  color: var(--muted);
}

.card {
  display: flex;
  min-height: 230px;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
}

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

.card-footer,
.meta-row,
.button-row,
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  background: #eaf1ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.badge.secondary {
  background: #ecfdf5;
  color: var(--secondary);
}

.badge.danger {
  background: #fff1f0;
  color: var(--danger);
}

.btn,
.primary-btn,
.secondary-btn,
.chip {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 800;
}

.primary-btn,
.btn.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.secondary-btn,
.btn.secondary,
.chip {
  background: #f8faf5;
  color: var(--text);
}

.chip.is-active {
  border-color: rgba(37, 99, 235, 0.34);
  background: #eaf1ff;
  color: var(--primary);
}

label {
  display: block;
  margin-bottom: 7px;
  color: #36392f;
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c8cfbe;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input,
select {
  min-height: 44px;
  padding: 10px 12px;
}

textarea {
  min-height: 116px;
  padding: 12px;
  resize: vertical;
  font-family: "JetBrains Mono", Consolas, monospace;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.search-results,
.list-stack {
  display: grid;
  gap: 10px;
}

.result-card {
  border: 1px solid #d7dfd3;
  border-left: 4px solid var(--secondary);
  border-radius: 7px;
  padding: 12px;
  background: #fbfdf9;
}

.result-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.formula-output,
.note,
.summary-box,
.check-box,
.faq-box,
.law-box,
.case-box,
.author-box {
  border: 1px solid #d7dfd3;
  border-radius: 7px;
  padding: 14px;
  background: #fbfdf9;
}

.law-box {
  border-left: 4px solid var(--primary);
  background: #f4f8ff;
}

.law-box dt {
  font-weight: 800;
  margin-top: 10px;
}

.law-box dt:first-child {
  margin-top: 0;
}

.law-box dd {
  margin: 6px 0 0;
  color: #3d4a3a;
}

.case-box {
  border-left: 4px solid #7c3aed;
  background: #faf8ff;
  margin-top: 14px;
}

.case-box h3 {
  margin-bottom: 8px;
}

.case-box p {
  margin: 6px 0;
}

.case-box .case-label {
  font-weight: 800;
  color: #5b21b6;
}

.note {
  border-left: 4px solid var(--warning);
  background: #fff8eb;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 14px;
}

.breadcrumb a {
  color: var(--primary);
  font-weight: 800;
}

.article-shell {
  max-width: 900px;
  margin: 28px auto;
  padding: clamp(18px, 4vw, 36px);
}

.article-shell h1 {
  font-size: clamp(30px, 4.5vw, 48px);
}

.article-body h2 {
  margin-top: 30px;
}

.toc {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 18px;
  background: #fff;
}

.toc a {
  color: var(--primary);
  font-weight: 700;
}

.article-body li {
  margin-bottom: 8px;
}

.faq-item {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}

.faq-item:first-child {
  border-top: 0;
}

.site-footer {
  margin-top: 28px;
  padding: 26px clamp(16px, 4vw, 48px);
  border-top: 1px solid var(--line);
  background: #eef0e6;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.footer-inner p {
  max-width: 680px;
  margin: 7px 0 0;
  color: var(--muted);
}

.admin-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 620px;
  overflow: hidden;
}

.admin-sidebar {
  border-right: 1px solid var(--line);
  padding: 18px;
  background: #eef0e6;
}

.admin-sidebar nav {
  display: grid;
  gap: 8px;
}

.admin-sidebar button {
  justify-content: flex-start;
  width: 100%;
}

.admin-main {
  padding: 20px;
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #eef6f2;
}

.hidden {
  display: none !important;
}

@media (max-width: 920px) {
  .site-header,
  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero,
  .tool-grid,
  .content-grid,
  .category-grid,
  .card-grid,
  .admin-shell,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .brand {
    min-width: 0;
  }

  .admin-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 560px) {
  main {
    width: min(100% - 22px, 1180px);
  }

  .site-header {
    padding: 12px;
  }

  .site-nav a,
  .footer-links a {
    padding: 7px 8px;
    font-size: 14px;
  }

  .quick-stats {
    grid-template-columns: 1fr;
  }
}
