:root {
  --ink: #15223b;
  --muted: #68758a;
  --line: #dbe3ee;
  --paper: #f2f5f9;
  --white: #ffffff;
  --blue: #2157a6;
  --blue-dark: #173f7d;
  --blue-soft: #eaf1fb;
  --green: #18794e;
  --green-soft: #e8f6ef;
  --amber: #9a5a00;
  --amber-soft: #fff4dc;
  --red: #b42318;
  --red-soft: #feeceb;
  --shadow: 0 16px 48px rgba(32, 55, 88, 0.1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 0, rgba(33, 87, 166, 0.1), transparent 25rem),
    linear-gradient(180deg, #fbfcfe, var(--paper));
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
  line-height: 1.5;
}

button, select, textarea { font: inherit; }
button, select { cursor: pointer; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.site-header {
  width: min(1200px, calc(100% - 40px));
  height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--blue);
  font-weight: 850;
  box-shadow: 0 7px 18px rgba(33, 87, 166, 0.24);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: -0.02em; }
.brand small { color: var(--muted); font-size: 12px; }
.official-link { color: var(--muted); font-size: 14px; font-weight: 700; text-decoration: none; }
.official-link:hover { color: var(--blue); }

main { width: min(1200px, calc(100% - 40px)); margin: 12px auto 0; }

.search-panel, .results-section {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(219, 227, 238, 0.95);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.search-panel { padding: 26px 28px 24px; }
.purpose-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.eyebrow { margin-bottom: 5px; color: var(--blue); font-size: 12px; font-weight: 850; letter-spacing: 0.08em; }
h1 { margin: 0; font-size: clamp(27px, 3.4vw, 40px); line-height: 1.2; letter-spacing: -0.045em; }
h1 em { color: var(--blue); font-style: normal; }
.purpose-heading p { margin: 7px 0 0; color: var(--muted); font-size: 15px; }
.purpose-badge {
  flex: 0 0 auto;
  min-width: 108px;
  padding: 12px 15px;
  border: 1px solid #d5e2f4;
  border-radius: 15px;
  color: var(--blue);
  background: var(--blue-soft);
  text-align: center;
}
.purpose-badge strong, .purpose-badge span { display: block; }
.purpose-badge strong { font-size: 15px; }
.purpose-badge span { margin-top: 1px; color: var(--muted); font-size: 12px; }

form { margin-top: 22px; }
.search-layout { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); gap: 24px; align-items: stretch; }
.query-column { min-width: 0; }
.query-entry {
  padding: 14px;
  border: 2px solid #8eb1df;
  border-radius: 17px;
  background: linear-gradient(180deg, #f4f8ff, #edf4fd);
  box-shadow: 0 8px 22px rgba(33, 87, 166, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}
.field-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.field-label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 800; }
.query-label { display: flex; align-items: center; gap: 8px; color: var(--blue-dark); font-size: 16px; }
.query-label span { width: 24px; height: 24px; display: inline-grid; place-items: center; border-radius: 50%; color: white; background: var(--blue); font-size: 13px; }
.query-count { margin-bottom: 8px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: var(--white);
  outline: none;
  transition: border-color 160ms, box-shadow 160ms;
}
textarea { height: 286px; min-height: 190px; padding: 15px 17px; resize: vertical; border-width: 2px; border-color: #9ab8dd; line-height: 1.55; box-shadow: 0 3px 10px rgba(33, 87, 166, 0.06); }
select { height: 50px; padding: 0 42px 0 14px; }
textarea:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(33, 87, 166, 0.1); }
textarea::placeholder { color: #98a2b3; }
.field-help { margin: 8px 2px 0; color: var(--muted); font-size: 13px; }
.field-help strong { color: var(--blue-dark); }

.action-column {
  min-height: 331px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  border: 1px solid #e1e7f0;
  border-radius: 17px;
  background: #f7f9fc;
}
.data-tools { margin-top: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); overflow: hidden; }
.restricted-toggle { min-height: 68px; padding: 11px 13px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; cursor: pointer; background: var(--white); }
.restricted-toggle-copy strong, .restricted-toggle-copy small { display: block; }
.restricted-toggle-copy strong { font-size: 15px; }
.restricted-toggle-copy small { margin-top: 2px; color: var(--muted); font-size: 13px; }
.toggle-controls { display: flex; align-items: center; gap: 9px; }
.toggle-controls > small { color: var(--blue-dark); font-size: 13px; font-weight: 800; white-space: nowrap; }
.toggle-controls input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { width: 48px; height: 27px; padding: 3px; border-radius: 999px; background: #b9c2cf; transition: background 160ms; }
.toggle-track span { display: block; width: 21px; height: 21px; border-radius: 50%; background: white; box-shadow: 0 2px 5px rgba(21, 34, 59, 0.22); transition: transform 160ms; }
.restricted-toggle:has(input:checked) { background: var(--blue-soft); }
.toggle-controls input:checked + .toggle-track { background: var(--blue); }
.toggle-controls input:checked + .toggle-track span { transform: translateX(21px); }
.restricted-toggle:has(input:focus-visible) { outline: 3px solid rgba(33, 87, 166, 0.2); outline-offset: -3px; }
.restricted-toggle:has(input:disabled) { cursor: not-allowed; opacity: 0.55; }
.restricted-unavailable { padding: 9px 12px 11px; border-top: 1px solid var(--line); background: #f8fafc; }
.restricted-unavailable button { padding: 0; display: inline-flex; align-items: center; gap: 6px; border: 0; color: var(--blue-dark); background: transparent; font-size: 13px; font-weight: 800; }
.restricted-unavailable button span { width: 19px; height: 19px; display: inline-grid; place-items: center; border-radius: 50%; color: white; background: var(--blue); font-size: 12px; }
.restricted-unavailable p { max-height: 0; margin: 0; overflow: hidden; color: var(--muted); font-size: 13px; line-height: 1.55; opacity: 0; transition: max-height 180ms, margin 180ms, opacity 180ms; }
.restricted-unavailable:hover p, .restricted-unavailable.open p { max-height: 100px; margin-top: 7px; opacity: 1; }
.data-tools-body { padding: 0 12px 12px; border-top: 1px solid var(--line); }
.data-tools-body > p { margin: 10px 0 0; }
.monthly-file-panel { margin-top: 10px; padding: 11px; border: 2px solid #c7d8ee; border-radius: 12px; background: #f8fbff; }
.monthly-file-title { display: block; color: var(--blue-dark); font-size: 14px; }
.recent-purchase-panel { margin-top: 10px; padding: 11px; border: 2px solid #bcdcca; border-radius: 12px; background: #f7fcf9; }
.recent-purchase-title { display: block; color: var(--green); font-size: 14px; }
.data-download-link { margin-top: 8px; display: inline-flex; color: var(--blue); font-size: 13px; font-weight: 800; text-decoration: none; }
.data-download-link[aria-disabled="true"] { color: var(--muted); pointer-events: none; }
.data-instruction, .data-rule { color: var(--muted); font-size: 13px; line-height: 1.5; }
.data-slot { margin-top: 10px; padding: 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 5px 8px; border-radius: 10px; background: #f6f8fb; }
.data-slot strong, .data-slot span { display: block; }
.data-slot strong { font-size: 14px; }
.data-slot span { color: var(--muted); font-size: 12px; }
.file-button { padding: 7px 10px; border: 1px solid #cbd8ea; border-radius: 8px; color: var(--blue); background: var(--white); font-size: 13px; font-weight: 800; cursor: pointer; }
.file-button.disabled { color: var(--muted); pointer-events: none; }
.data-status { min-width: 0; margin: 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.data-remove { padding: 0; border: 0; color: var(--red); background: transparent; font-size: 12px; }
.catalog-guidance { padding: 8px 9px; border-radius: 8px; color: #704100; background: var(--amber-soft); font-size: 13px; line-height: 1.5; }
.recent-files { display: grid; gap: 5px; }
.recent-file-item { padding: 7px 9px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.recent-file-item span { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.recent-file-item button { grid-row: 1 / span 2; grid-column: 2; padding: 0; border: 0; color: var(--red); background: transparent; font-size: 12px; }
.result-notes { margin-top: 20px; }
.result-guide { padding: 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 14px; border: 1px solid var(--line); border-radius: 13px; background: #f7f9fc; }
.result-guide > strong { grid-column: 1 / -1; margin-bottom: 2px; font-size: 14px; }
.result-guide span { padding: 8px 10px; display: grid; grid-template-columns: 8px max-content 1fr; align-items: center; gap: 7px; border-radius: 9px; color: var(--muted); background: var(--white); font-size: 13px; line-height: 1.5; }
.result-guide b { color: var(--ink); font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.found { background: var(--green); }
.dot.recent { background: var(--blue); }
.dot.estimated { background: #db8500; }
.dot.absent { background: #98a2b3; }

.notice { margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.notice.warning { color: #7a4300; background: var(--amber-soft); }
.notice.error { color: var(--red); background: var(--red-soft); }
.limit-warning { margin: 9px 0 0; font-weight: 700; }

.primary-button, .secondary-button {
  border: 0;
  border-radius: 12px;
  font-weight: 850;
  transition: transform 150ms, background 150ms, opacity 150ms;
}
.primary-button { position: relative; width: 100%; height: 54px; margin-top: auto; color: white; background: var(--blue); }
.search-button-slot .primary-button { margin-top: 0; }
.left-search-button-slot { margin-top: 12px; }
.primary-button:hover:not(:disabled) { background: var(--blue-dark); transform: translateY(-1px); }
.primary-button:disabled, .secondary-button:disabled { cursor: not-allowed; opacity: 0.48; }
.button-progress {
  display: none;
  width: 17px;
  height: 17px;
  margin-left: 9px;
  vertical-align: -4px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.primary-button.loading .button-progress { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.results-section { margin-top: 18px; padding: 24px; }
.results-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.results-heading > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px; }
h2 { margin: 0; font-size: 21px; letter-spacing: -0.035em; }
.results-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.secondary-button { flex: 0 0 auto; min-height: 42px; padding: 0 17px; color: var(--blue); background: var(--blue-soft); white-space: nowrap; }
.secondary-button:hover:not(:disabled) { background: #dbe8f8; }

.table-wrap { margin-top: 16px; overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; }
table { width: 100%; min-width: 1135px; border-collapse: collapse; font-size: 13px; }
th { padding: 12px; color: #596579; background: #f5f7fa; text-align: left; white-space: nowrap; }
td { max-width: 260px; padding: 13px 12px; border-top: 1px solid #e9edf3; vertical-align: top; }
.sequence-column { width: 54px; text-align: center; font-variant-numeric: tabular-nums; }
td a { color: var(--blue); font-weight: 700; text-decoration: none; }
td a:hover { text-decoration: underline; }
.status-pill { display: inline-flex; align-items: center; min-width: max-content; padding: 5px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.status-found { color: var(--green); background: var(--green-soft); }
.status-recent { color: var(--blue); background: var(--blue-soft); }
.status-estimated { color: var(--amber); background: var(--amber-soft); }
.status-absent { color: #596579; background: #eef1f5; }
.status-error { color: var(--red); background: var(--red-soft); }
.mobile-results { display: none; }

.explanation {
  margin: 10px 4px 0;
  display: flex;
  justify-content: flex-start;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}
.explanation strong { color: var(--ink); }
.explanation p { margin: 0; }
.confirm-dialog {
  width: min(520px, calc(100% - 32px));
  padding: 25px;
  border: 0;
  border-radius: 20px;
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 24px 70px rgba(21, 34, 59, 0.28);
}
.confirm-dialog::backdrop { background: rgba(21, 34, 59, 0.48); backdrop-filter: blur(3px); }
.confirm-dialog-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: #7a4300; background: var(--amber-soft); font-size: 22px; font-weight: 900; }
.confirm-dialog h2 { margin-top: 13px; font-size: 21px; }
.confirm-dialog-message { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.confirm-file-box { margin-top: 17px; padding: 14px; border: 1px solid #f1d49c; border-radius: 13px; background: #fffaf0; }
.confirm-file-box > strong { font-size: 14px; }
.confirm-file-box ul { max-height: 180px; margin: 9px 0 0; padding: 0; display: grid; gap: 7px; overflow-y: auto; list-style: none; }
.confirm-file-box li { min-width: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: 9px; }
.confirm-file-box li span { padding: 3px 7px; border-radius: 999px; color: #7a4300; background: #ffe9bd; font-size: 12px; font-weight: 800; }
.confirm-file-box li b { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.confirm-dialog-warning { margin: 12px 0 0; color: var(--red); font-size: 13px; }
.confirm-dialog-actions { margin-top: 20px; display: grid; grid-template-columns: 1fr 1.35fr; gap: 9px; }
.dialog-button { min-height: 46px; border: 0; border-radius: 11px; font-weight: 850; }
.dialog-button.cancel { color: var(--ink); background: #eef1f5; }
.dialog-button.confirm { color: white; background: var(--red); }
.dialog-button:hover { filter: brightness(0.96); }
@media (max-width: 800px) {
  .site-header, main { width: min(100% - 28px, 1200px); }
  .search-layout { grid-template-columns: 1fr; }
  textarea { height: 230px; }
  .action-column { min-height: 0; }
  .primary-button { margin-top: 4px; }
  .result-guide { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .site-header { height: 62px; }
  .official-link { font-size: 0; }
  .official-link span { font-size: 15px; }
  main { margin-top: 6px; }
  .search-panel, .results-section { border-radius: 18px; }
  .search-panel { padding: 19px 17px 17px; }
  .purpose-heading { align-items: flex-start; }
  .purpose-heading h1 { font-size: 26px; }
  .purpose-heading p { font-size: 14px; }
  .purpose-badge { display: none; }
  form { margin-top: 17px; }
  .results-section { padding: 18px 16px; }
  .results-heading { align-items: flex-start; }
  .results-heading > div { min-width: 0; }
  .results-heading .secondary-button { width: 66px; padding: 0; font-size: 0; }
  .results-heading .secondary-button::after { content: "Excel"; font-size: 13px; }
  .table-wrap { display: none; }
  .mobile-results { margin-top: 15px; display: grid; gap: 10px; }
  .result-card { padding: 15px; border: 1px solid var(--line); border-radius: 14px; }
  .result-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
  .result-card-meta { display: flex; align-items: center; gap: 7px; }
  .result-sequence { color: var(--muted); font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
  .result-card h3 { margin: 11px 0 4px; font-size: 16px; line-height: 1.4; }
  .result-card h3 a { color: inherit; text-decoration: none; }
  .result-card .isbn { color: var(--muted); font-size: 12px; }
  .result-card dl { display: grid; grid-template-columns: 58px 1fr; gap: 5px 9px; margin: 12px 0 0; font-size: 13px; }
  .result-card dt { color: var(--muted); }
  .result-card dd { margin: 0; }
  .explanation { margin-inline: 2px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
