* { box-sizing: border-box; }
:root {
  --brand: #1447a6;
  --brand-dark: #0f3680;
  --brand-tint: #eef3fc;
  --accent: #f5a623;
  --text: #1c2430;
  --text-muted: #6b7480;
  --border: #e3e7ee;
  --border-strong: #d3d9e3;
  --surface: #fff;
  --bg: #f4f6fa;
  --radius: 8px;
  --radius-sm: 5px;
  --shadow-sm: 0 1px 2px rgba(20, 40, 90, 0.06);
  --shadow-md: 0 4px 16px rgba(20, 40, 90, 0.08);
}
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}
body {
  display: flex;
  flex-direction: column;
  font-family: "Noto Sans KR", -apple-system, "Malgun Gothic", "맑은 고딕", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
header {
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: 0 2px 10px rgba(10, 30, 70, 0.18);
  position: relative;
  z-index: 2;
}
header h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}
.top-nav {
  display: flex;
  gap: 4px;
}
.top-nav a {
  color: #fff;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  opacity: 0.86;
  padding: 7px 12px;
  border-radius: 999px;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.top-nav a:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.14);
  text-decoration: none;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.16);
  padding: 4px;
  border-radius: 999px;
}
.search-bar select, .search-bar input, .search-bar button {
  padding: 7px 14px;
  border: none;
  border-radius: 999px;
  font-size: 13.5px;
  font-family: inherit;
}
.search-bar select, .search-bar input {
  background: var(--surface);
  color: var(--text);
}
.search-bar input {
  width: 220px;
}
.search-bar input:focus, .search-bar select:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent) inset;
}
.search-bar button {
  background: var(--accent);
  color: #1a1a1a;
  cursor: pointer;
  font-weight: 700;
  transition: filter 0.15s ease;
}
.search-bar button:hover {
  filter: brightness(1.06);
}

.layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  gap: 16px;
  padding: 16px;
}
.tree {
  width: 290px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 12px;
  height: 100%;
  overflow-y: auto;
}

.detail-sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  height: 100%;
  overflow-y: auto;
}
.detail-sidebar:empty {
  display: none;
}
.sidebar-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-section h3 {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0 0 10px;
}
.sidebar-section ul {
  list-style: none;
  margin: 0;
  padding-left: 10px;
}
.sidebar-section .outline-chapter {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 12px 0 4px;
}
.sidebar-section .outline-chapter:first-child {
  margin-top: 0;
}
.sidebar-section a {
  display: block;
  padding: 3px 6px;
  margin: 0 -6px;
  border-radius: var(--radius-sm);
  color: var(--brand);
  text-decoration: none;
  font-size: 12.5px;
  line-height: 1.55;
  transition: background 0.12s ease;
}
.sidebar-section a:hover {
  background: var(--brand-tint);
  text-decoration: none;
}
.tree ul {
  list-style: none;
  margin: 0;
  padding-left: 16px;
}
.tree > ul {
  padding-left: 0;
}
.tree .category > .node-header {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  padding: 6px 6px;
  margin: 0 -6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s ease;
}
.tree .category > .node-header:hover {
  background: var(--brand-tint);
}
.tree .category > .node-header .toggle-arrow {
  margin-top: 2px;
}
.tree .category > .node-header .label {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
}
.tree .category > .node-header .label span {
  flex: 1;
  min-width: 0;
}
.tree .icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.55;
}
.tree .category > .node-header .icon {
  color: var(--brand);
}
.tree .category .toggle-arrow {
  display: inline-block;
  width: 14px;
  color: var(--text-muted);
  font-size: 10px;
  user-select: none;
  transition: transform 0.15s ease;
}
.tree .category.collapsed > ul {
  display: none;
}
.tree .regulation a {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 5px 8px;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.45;
  transition: background 0.12s ease, color 0.12s ease;
}
.tree .regulation a .icon {
  margin-top: 3px;
}
.tree .regulation a span {
  flex: 1;
  min-width: 0;
}
.tree .regulation a:hover {
  background: var(--brand-tint);
  color: var(--brand);
}
.tree .regulation a.active {
  background: var(--brand);
  color: #fff;
  font-weight: 500;
}
.tree .regulation a.active .icon {
  color: #fff;
  opacity: 0.9;
}
.tree .cat-link {
  cursor: pointer;
  color: var(--text);
}
.tree .cat-link:hover {
  color: var(--brand);
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.content-header {
  flex-shrink: 0;
  padding: 20px 40px 0;
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
}
.content-header:empty {
  padding: 0;
}
.content-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 40px 32px;
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
}
.placeholder {
  color: var(--text-muted);
}

table.reg-list {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
table.reg-list th, table.reg-list td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13.5px;
}
table.reg-list th {
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
table.reg-list tbody tr {
  transition: background 0.12s ease;
}
table.reg-list tr:hover td {
  background: var(--brand-tint);
  cursor: pointer;
}
table.reg-list tbody tr:last-child td {
  border-bottom: none;
}

table.body-hit-list td {
  vertical-align: top;
}
.body-hit-reg {
  font-weight: 600;
  font-size: 13.5px;
}
.body-hit-art {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}
.body-hit-snippet {
  color: var(--text-muted);
  line-height: 1.6;
}
.body-hit-snippet mark {
  background: #fff1b8;
  color: var(--text);
  border-radius: 3px;
  padding: 0 2px;
}

.rev-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 4px 0 14px;
}
.rev-filter-bar input[type="text"],
.rev-filter-bar input[type="date"] {
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
}
.rev-filter-bar input[type="text"] {
  width: 180px;
}
.rev-filter-bar label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.rev-filter-bar button {
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: background 0.12s ease;
}
.rev-filter-bar button:hover {
  background: var(--brand-tint);
  border-color: var(--brand);
  color: var(--brand);
}
#revFilterApply {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
#revFilterApply:hover {
  background: var(--brand-dark);
}

.doc-header-top {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 4px;
}
.doc-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
}
.doc-toolbar button {
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-muted);
  transition: background 0.12s ease, color 0.12s ease;
}
.doc-toolbar button:hover {
  background: var(--brand-tint);
  color: var(--brand);
  border-color: var(--brand);
}
.breadcrumb {
  font-size: 12.5px;
  color: var(--text-muted);
}
.breadcrumb .sep {
  margin: 0 6px;
}

.doc-title-bar {
  position: relative;
  text-align: center;
  padding: 6px 90px 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.doc-title-bar::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 3px;
  border-radius: 3px;
  background: var(--brand);
}
.doc-title-bar h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.doc-title-bar .doc-toolbar {
  position: absolute;
  top: 2px;
  right: 0;
}
.reg-detail h2 {
  margin: 0;
  color: var(--brand);
}
.reg-meta {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
}
.amend-list {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.amend-list a.amend-date-link {
  color: var(--brand);
  text-decoration: none;
  border-bottom: 1px dotted var(--brand);
  cursor: pointer;
}
.amend-list a.amend-date-link:hover {
  border-bottom-style: solid;
}
.amend-note {
  font-size: 12.5px;
  color: #8a5a00;
  background: #fff8ea;
  border: 1px solid #f0d9a6;
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  margin-bottom: 16px;
}
table.compare-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  table-layout: fixed;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
table.compare-table th, table.compare-table td {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 11px 14px;
  font-size: 13.5px;
  vertical-align: top;
  text-align: left;
}
table.compare-table th:last-child, table.compare-table td:last-child {
  border-right: none;
}
table.compare-table th {
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
table.compare-table .compare-artno {
  width: 15%;
  font-weight: 700;
  color: var(--text);
}
table.compare-table .compare-old {
  width: 42.5%;
}
table.compare-table .compare-new {
  width: 42.5%;
}
.diff-del {
  color: var(--brand);
  text-decoration: line-through;
  text-decoration-color: var(--brand);
}
.diff-ins {
  color: var(--brand);
  font-weight: 700;
  background: var(--brand-tint);
  border-radius: 3px;
  padding: 0 1px;
}
.article {
  margin-bottom: 18px;
  scroll-margin-top: 16px;
  line-height: 1.75;
  font-size: 14.5px;
}
.chapter-tag {
  display: inline-block;
  font-size: 12px;
  color: var(--brand);
  font-weight: 700;
  margin: 24px 0 10px;
  padding: 4px 13px;
  background: var(--brand-tint);
  border-radius: 999px;
}
.chapter-tag:first-child {
  margin-top: 0;
}
.article .art-no {
  font-weight: 700;
  color: var(--brand-dark);
  margin-right: 4px;
}
.article .amend-tag {
  color: #2f6fd6;
}
.article .list-indent {
  display: block;
  padding-left: 1.6em;
}
.addenda {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-strong);
  font-size: 13.5px;
  color: var(--text-muted);
}
.attachment-file {
  margin-top: 16px;
}
.file-open-link {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--brand);
  font-size: 13.5px;
}
.attachment-pdf {
  width: 100%;
  height: 80vh;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.result-count {
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 13.5px;
}
.back-link {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--brand);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
}
.back-link:hover {
  text-decoration: underline;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 18px;
  font-size: 13.5px;
  color: var(--text-muted);
}
.pager button {
  padding: 6px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s ease;
}
.pager button:hover:not(:disabled) {
  background: var(--brand-tint);
  border-color: var(--brand);
  color: var(--brand);
}
.pager button:disabled {
  color: #c3c9d2;
  cursor: default;
}

@media print {
  header, .tree, .detail-sidebar, .doc-toolbar, .back-link, .breadcrumb, .pager {
    display: none !important;
  }
  html, body {
    height: auto;
    overflow: visible;
  }
  .layout {
    height: auto;
    overflow: visible;
    display: block;
    padding: 0;
  }
  .content {
    height: auto;
    overflow: visible;
    display: block;
    border: none;
    box-shadow: none;
    border-radius: 0;
  }
  .content-header, .content-body {
    max-width: none;
    margin: 0;
    padding: 0;
  }
}
