:root {
  color-scheme: light;
  --bg: #edf3f9;
  --surface: #ffffff;
  --surface-2: #f5f8fc;
  --text: #122033;
  --sub: #58697f;
  --line: #d5dfeb;
  --blue: #0068c9;
  --blue-soft: #e5f2ff;
  --navy: #073d75;
  --green: #14734a;
  --case-number-bg: #0f7a48;
  --red: #b42318;
  --shadow: 0 18px 48px rgba(12, 50, 91, .12);
  font-family: "Pretendard GOV", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.55; }
body.access-locked { overflow: hidden; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.access-gate { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 24px; overflow-y: auto; background: linear-gradient(135deg, #e7f1fb 0%, #f8fbff 55%, #e5f2ff 100%); }
.access-card { width: min(100%, 430px); padding: 34px; border: 1px solid var(--line); border-top: 4px solid var(--blue); border-radius: 16px; background: var(--surface); box-shadow: 0 22px 60px rgba(12, 50, 91, .18); }
.access-card .eyebrow { margin-top: 16px; }
.access-card h1 { margin-bottom: 8px; }
.access-card > p:not(.eyebrow) { margin-bottom: 22px; color: var(--sub); }
.access-card label { display: block; font-weight: 700; }
.access-brand { display: inline-grid; place-items: center; min-width: 64px; height: 40px; padding: 0 12px; border-radius: 10px; color: #fff; background: linear-gradient(135deg, var(--navy), var(--blue)); font-weight: 800; }
.access-submit { width: 100%; margin-top: 18px; }

input::placeholder, textarea::placeholder { color: var(--sub); opacity: .62; font-weight: 400; }
input::-webkit-input-placeholder, textarea::-webkit-input-placeholder { color: var(--sub); opacity: .62; font-weight: 400; }

.skip-link { position: fixed; left: 16px; top: -80px; z-index: 100; padding: 10px 14px; background: var(--surface); color: var(--text); border-radius: 8px; }
.skip-link:focus { top: 12px; }

.site-shell { min-height: 100vh; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 32px; color: #fff; background: linear-gradient(120deg, var(--navy), var(--blue)); }
.brand { display: flex; min-width: 0; min-height: 44px; align-items: center; gap: 11px; margin: -4px 0; padding: 4px 6px 4px 4px; border-radius: 10px; color: inherit; font-size: 1.05rem; font-weight: 650; text-decoration: none; }
.brand:focus { outline: 3px solid #fff; outline-offset: 3px; }
@supports selector(:focus-visible) {
  .brand:focus { outline: none; }
  .brand:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
}
.brand-mark { display: grid; flex: 0 0 auto; place-items: center; min-width: 56px; width: auto; height: 36px; padding: 0 9px; border: 1px solid rgba(255,255,255,.4); border-radius: 10px; background: rgba(255,255,255,.16); font-size: .98rem; }
.brand-label { min-width: 0; line-height: 1.35; overflow-wrap: anywhere; }
.step { flex: 0 0 auto; color: rgba(255,255,255,.78); white-space: nowrap; }
.step strong { color: #fff; }
.content { width: min(100% - 32px, 1000px); margin: 0 auto; padding: 36px 0 56px; }

.intro { position: relative; overflow: hidden; padding: 28px; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(120deg, var(--blue-soft), var(--surface)); box-shadow: var(--shadow); }
.intro::after { position: absolute; width: 160px; height: 160px; right: -45px; top: -70px; border-radius: 50%; background: rgba(0, 104, 201, .10); background: color-mix(in srgb, var(--blue) 10%, transparent); content: ""; }
.intro > * { position: relative; z-index: 1; }
.eyebrow { margin: 0 0 5px; color: var(--blue); font-size: .78rem; font-weight: 750; letter-spacing: .12em; }
.intro-eyebrow { font-family: inherit; font-size: 1rem; font-weight: 700; letter-spacing: -.025em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(1.55rem, 3vw, 2rem); letter-spacing: -.025em; }
h2 { font-size: 1.18rem; }
h3 { font-size: 1.05rem; }
.intro-summary-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.intro-summary-row p { flex: 1 1 auto; margin-bottom: 0; color: var(--sub); }
.manual-download { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 7px 12px; border: 1px solid var(--blue); border-radius: 9px; color: var(--blue); background: var(--surface); font-size: .9rem; font-weight: 750; text-decoration: none; white-space: nowrap; transition: background .15s ease, box-shadow .15s ease, transform .15s ease; }
.manual-download:hover { background: var(--blue-soft); box-shadow: 0 5px 14px rgba(0, 104, 201, .12); transform: translateY(-1px); }
.manual-download:focus-visible { outline: 3px solid rgba(0, 104, 201, .32); outline-offset: 2px; }
.download-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.panel { margin-top: 18px; padding: 25px; border: 1px solid var(--line); border-top: 4px solid var(--blue); border-radius: 14px; background: var(--surface); box-shadow: 0 8px 24px rgba(22,54,90,.07); }
.panel-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.panel-title h2 { margin: 0; }
.star { color: var(--red); font-weight: 900; }
.section-heading { display: flex; align-items: center; gap: 9px; margin: 22px 0 12px; padding-top: 20px; border-top: 1px solid var(--line); }
.section-heading span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; color: #fff; background: var(--navy); font-size: 1rem; font-weight: 800; }
.section-heading h3 { margin: 0; }
.section-required-note { margin-left: auto; color: var(--red); font-size: .9rem; font-weight: 800; }
.company-details { margin-top: 22px; border-top: 1px solid var(--line); }
.company-details > summary { display: flex; width: 100%; align-items: center; gap: 9px; padding: 20px 0 12px; color: var(--text); list-style: none; }
.company-details > summary::-webkit-details-marker { display: none; }
.company-section-number { display: grid; flex: 0 0 auto; place-items: center; width: 28px; height: 28px; border-radius: 7px; color: #fff; background: var(--navy); font-size: 1rem; font-weight: 800; }
.company-disclosure-title { font-size: 1.05rem; font-weight: 700; }
.company-disclosure-title small { display: inline; margin: 0 0 0 3px; font-size: .82rem; font-weight: 500; }
.company-disclosure-action { display: inline-flex; align-items: center; margin-left: auto; padding: 5px 9px; border-radius: 999px; color: var(--blue); background: var(--blue-soft); font-size: .84rem; font-weight: 700; }
.company-close-label { display: none; }
.company-details[open] .company-open-label { display: none; }
.company-details[open] .company-close-label { display: inline; }
.company-details-content { padding-bottom: 2px; }
.privacy-note { padding: 11px 13px; border-radius: 8px; background: var(--blue-soft); color: var(--sub); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.form-grid label, .form-field > label { display: block; font-weight: 650; }
.form-grid .wide { grid-column: 1 / -1; }
.inline-optional { display: inline; margin: 0 0 0 3px; font-size: .82rem; font-weight: 500; }
input, textarea { width: 100%; margin-top: 7px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text); outline: none; }
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, button:focus, summary:focus { outline: 3px solid rgba(0, 104, 201, .45); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid rgba(0, 104, 201, .45); outline: 3px solid color-mix(in srgb, var(--blue) 45%, transparent); outline-offset: 2px; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--red); }
.industry-field { min-width: 0; }
.identity-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 17px; }
.identity-grid > div, .identity-grid > label { padding: 11px 13px; border-radius: 9px; background: var(--surface-2); }
.identity-grid > label { display: block; font-weight: 650; }
.identity-grid span { display: block; margin-bottom: 4px; color: var(--sub); font-size: .88rem; }
.identity-grid span small { display: inline; margin: 0 0 0 3px; font-size: .82rem; font-weight: 500; }
.identity-grid input { margin-top: 6px; background: var(--surface); }
.identity-grid strong { display: block; color: var(--sub); }
small { display: block; margin-top: 6px; color: var(--sub); font-weight: 450; }
.field-error { display: block; min-height: 1.2em; margin-top: 5px; color: var(--red); font-size: .86rem; font-weight: 550; }
.readonly-output { display: flex; min-height: 48px; align-items: center; margin-top: 7px; padding: 11px 13px; border-radius: 9px; background: var(--blue-soft); color: var(--sub); font-weight: 500; }
.readonly-output.is-placeholder { opacity: .62; font-weight: 400; }
.actions, .result-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.button { min-height: 44px; padding: 10px 17px; border-radius: 9px; border: 1px solid var(--line); font-weight: 700; }
.button.primary { border-color: var(--blue); color: #fff; background: linear-gradient(135deg, var(--navy), var(--blue)); box-shadow: 0 6px 16px rgba(0,104,201,.22); }
.button.secondary { background: var(--surface); color: var(--text); }
.button:disabled { cursor: not-allowed; opacity: .45; }
#save-button { min-width: 120px; min-height: 48px; padding: 12px 24px; }
.alert { margin-top: 16px; padding: 12px 14px; border-radius: 9px; border: 1px solid; }
.alert-error { color: var(--red); border-color: #d98983; border-color: color-mix(in srgb, var(--red) 45%, var(--line)); background: rgba(180, 35, 24, .07); background: color-mix(in srgb, var(--red) 7%, var(--surface)); }
.alert-info { color: var(--sub); border-color: var(--line); background: var(--blue-soft); }

.loading { padding: 50px 24px; text-align: center; }
.loading p { margin-bottom: 0; color: var(--sub); }
.loading .loading-estimate { min-height: 24px; margin-top: 12px; color: var(--blue); font-weight: 800; }
.spinner { width: 38px; height: 38px; margin: 0 auto 16px; border: 4px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.result-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.input-summary { display: grid; margin: 18px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 4px 14px rgba(0,0,0,.04); }
.input-summary-row { display: grid; grid-template-columns: minmax(120px, .7fr) 2.3fr; }
.input-summary-row + .input-summary-row { border-top: 1px solid var(--line); }
.input-summary-label, .input-summary-value { padding: 11px 13px; }
.input-summary-label { border-right: 1px solid var(--line); color: var(--sub); font-size: .9rem; }
.input-summary-value { color: var(--text); overflow-wrap: anywhere; white-space: pre-wrap; }
.result-overview { margin: 18px 0; }
.result-overview .panel-title { margin-bottom: 14px; }
.summary-identity-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.summary-identity-item { display: grid; grid-template-columns: minmax(110px, .7fr) 1.3fr; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.summary-identity-item span, .summary-identity-item strong { padding: 9px 11px; }
.summary-identity-item span { color: var(--sub); border-right: 1px solid var(--line); font-size: .88rem; }
.summary-identity-item strong { font-size: .92rem; overflow-wrap: anywhere; }
.result-overview .input-summary { margin-bottom: 0; box-shadow: none; }
.candidate-keywords { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.candidate-keywords-title { display: block; margin-bottom: 9px; font-size: .9rem; }
.keyword-list { display: flex; flex-wrap: wrap; gap: 8px; }
.keyword-chip { padding: 6px 10px; border: 1px solid #97bde1; border: 1px solid color-mix(in srgb, var(--blue) 28%, var(--line)); border-radius: 999px; color: var(--blue); background: var(--blue-soft); font-size: .88rem; font-weight: 700; }
.candidate-fieldset { margin: 0; padding: 0; border: 0; }
.candidate-fieldset legend { margin-bottom: 12px; font-weight: 750; font-size: 1.05rem; }
.candidate-list { display: grid; gap: 14px; }
.candidate-card { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 14px; padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); transition: border-color .15s, transform .15s, box-shadow .15s; }
.candidate-card:hover { border-color: #76a9d9; border-color: color-mix(in srgb, var(--blue) 45%, var(--line)); box-shadow: 0 8px 20px rgba(0,0,0,.07); }
.candidate-card.selected { border: 2px solid var(--blue); padding: 19px; box-shadow: 0 0 0 3px rgba(0,104,201,.12); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 12%, transparent); }
.candidate-card input { width: 20px; height: 20px; margin: 5px 0 0; accent-color: var(--blue); }
.candidate-topline { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.rank-badge { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px; color: #fff; background: var(--navy); font-weight: 800; }
.candidate-name { margin: 0; font-size: 1.25rem; }
.code-badge, .selected-badge { padding: 4px 8px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.code-badge { background: var(--surface-2); color: var(--sub); }
.selected-badge { display: none; background: var(--blue-soft); color: var(--blue); }
.selected .selected-badge { display: inline-block; }
.candidate-taxonomy { margin: 8px 0 0; color: var(--blue); font-size: .88rem; font-weight: 750; }
details { margin-top: 12px; }
summary { width: fit-content; color: var(--blue); cursor: pointer; font-weight: 700; }
.evidence-detail { display: grid; gap: 10px; margin-top: 10px; padding: 13px; border-radius: 9px; background: var(--surface-2); }
.evidence-detail p { margin: 0; }
.evidence-detail strong { display: block; margin-bottom: 3px; }
.evidence-detail span { color: var(--sub); }
.nearest-cases { margin-top: 10px; }
.nearest-case-list { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; counter-reset: nearest-case; }
.nearest-case-item { position: relative; padding: 11px 12px 11px 42px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); counter-increment: nearest-case; }
.nearest-case-item::before { position: absolute; left: 12px; top: 11px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: #fff; background: var(--case-number-bg); content: counter(nearest-case); font-size: .78rem; font-weight: 800; }
.nearest-case-fields { display: grid; grid-template-columns: minmax(96px, max-content) minmax(0, 1fr); gap: 6px 10px; margin: 0; }
.nearest-case-label, .nearest-case-value { margin: 0; }
.nearest-case-label { color: var(--sub); font-size: .86rem; font-weight: 700; }
.nearest-case-value { color: var(--text); font-size: .88rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.evidence-empty { color: var(--sub); }
.criterion-details, .nearest-cases-details { margin: 0 0 2px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.criterion-details > summary, .nearest-cases-details > summary { color: var(--blue); }
.criterion-description { display: grid; gap: 10px; margin-top: 10px !important; padding: 15px; border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 8px; background: var(--surface); color: var(--text); font-size: .95rem; line-height: 1.72; }
.criterion-block { margin: 0; overflow-wrap: anywhere; }
.criterion-major, .criterion-sub, .criterion-note { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 7px; }
.criterion-major { padding: 11px 12px; border-radius: 7px; background: var(--surface-2); font-weight: 600; }
.criterion-sub { padding: 1px 4px; }
.criterion-note { padding: 10px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--blue-soft); }
.criterion-symbol { color: var(--blue); font-weight: 900; text-align: center; }
.criterion-section-title { margin: 4px 0 0; padding: 8px 10px; border-radius: 7px; color: var(--navy); background: var(--blue-soft); font-size: .96rem; }
.criterion-text { min-width: 0; }

.confirmation { max-width: 760px; margin: 30px auto 0; }
.confirmation h1:focus { outline: none; }
#input-title:focus { outline: none; }
.confirmation > p { color: var(--sub); }
.definition-grid { display: grid; grid-template-columns: 170px 1fr; margin: 18px 0 0; border-top: 1px solid var(--line); }
.definition-grid dt, .definition-grid dd { margin: 0; padding: 11px 4px; border-bottom: 1px solid var(--line); }
.definition-grid dt { color: var(--sub); }
.definition-grid dd { font-weight: 650; }
.save-password { display: block; margin-top: 22px; font-weight: 700; }
.save-password input { max-width: 360px; }
.save-password-hint { display: block; margin-top: 10px; color: var(--blue); font-size: 1.05rem; font-weight: 750; line-height: 1.5; }
.demo-password-value { color: var(--red); }
.success { max-width: 720px; margin: 30px auto 0; padding: 46px 30px; text-align: center; }
.success-mark { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 16px; border-radius: 50%; color: #fff; background: var(--green); font-size: 1.6rem; }
.success-details { margin: 20px 0; padding: 16px; border-radius: 10px; background: var(--surface-2); color: var(--sub); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 720px) {
  .access-gate { padding: 16px; }
  .access-card { padding: 26px 22px; }
  .site-header { gap: 10px; padding: 14px 18px; }
  .brand { gap: 8px; font-size: .92rem; }
  .brand-mark { min-width: 50px; height: 34px; padding: 0 7px; font-size: .88rem; }
  .content { width: min(100% - 20px, 1000px); padding-top: 20px; }
  .intro, .panel { padding: 20px; }
  .intro-summary-row { gap: 10px; }
  .manual-download { padding-inline: 10px; font-size: .84rem; }
  .form-grid { grid-template-columns: 1fr; }
  .identity-grid { grid-template-columns: 1fr; }
  .summary-identity-grid { grid-template-columns: 1fr; }
  .input-summary-row { grid-template-columns: minmax(110px, .8fr) 2.2fr; }
  .nearest-case-fields { grid-template-columns: 1fr; gap: 2px; }
  .nearest-case-label:not(:first-child) { margin-top: 6px; }
  .form-grid .wide { grid-column: auto; }
  .result-intro { display: block; }
  .result-actions, .actions { flex-direction: column-reverse; }
  .button { width: 100%; }
  .definition-grid { grid-template-columns: 1fr; }
  .definition-grid dt { padding-bottom: 2px; border-bottom: 0; }
  .definition-grid dd { padding-top: 2px; }
}

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