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

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1119;
    --surface: #18212d;
    --surface-2: #101923;
    --text: #f2f6fb;
    --sub: #aebbc9;
    --line: #344457;
    --blue: #60b8ff;
    --blue-soft: #123653;
    --navy: #0c2a49;
    --green: #62d8a0;
    --red: #ff958c;
    --shadow: 0 18px 48px rgba(0, 0, 0, .32);
  }
}

@supports (color: light-dark(#000000, #ffffff)) {
  :root {
    --bg: light-dark(#edf3f9, #0a1119);
    --surface: light-dark(#ffffff, #18212d);
    --surface-2: light-dark(#f5f8fc, #101923);
    --text: light-dark(#122033, #f2f6fb);
    --sub: light-dark(#58697f, #aebbc9);
    --line: light-dark(#d5dfeb, #344457);
    --blue: light-dark(#0068c9, #60b8ff);
    --blue-soft: light-dark(#e5f2ff, #123653);
    --navy: light-dark(#073d75, #0c2a49);
    --green: light-dark(#14734a, #62d8a0);
    --red: light-dark(#b42318, #ff958c);
    --shadow: 0 18px 48px light-dark(rgba(12, 50, 91, .12), rgba(0, 0, 0, .32));
  }
}

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

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-height: 44px; align-items: center; gap: 11px; margin: -4px 0; padding: 4px 6px 4px 4px; border-radius: 10px; color: inherit; 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; }
}
@media (hover: hover) { .brand:hover { background: rgba(255,255,255,.10); } }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid rgba(255,255,255,.4); border-radius: 10px; background: rgba(255,255,255,.16); }
.step { color: rgba(255,255,255,.78); }
.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; }
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 p:last-child { margin-bottom: 0; color: var(--sub); }

.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); box-shadow: 0 8px 24px light-dark(rgba(22,54,90,.07), rgba(0,0,0,.18)); }
.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; }
.label-hint { margin-left: 3px; color: var(--sub); font-size: .84rem; font-weight: 450; }
.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: 26px; height: 26px; border-radius: 7px; color: #fff; background: var(--navy); font-size: .85rem; }
.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: 26px; height: 26px; border-radius: 7px; color: #fff; background: var(--navy); font-size: .85rem; }
.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; }
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); box-shadow: 0 6px 16px light-dark(rgba(0,104,201,.22), rgba(0,0,0,.2)); }
.button.secondary { background: var(--surface); color: var(--text); }
.button:disabled { cursor: not-allowed; opacity: .45; }
.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; }
.status-badge { position: relative; z-index: 1; padding: 7px 11px; border-radius: 999px; color: var(--blue); background: var(--surface); white-space: nowrap; font-weight: 700; }
.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(--navy); 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 { margin-top: 9px !important; padding: 11px 12px; border-left: 3px solid var(--blue); border-radius: 0 7px 7px 0; background: var(--surface); color: var(--sub); white-space: pre-wrap; }

.confirmation { max-width: 760px; margin: 30px auto 0; }
.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; }
.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) {
  .site-header { padding: 14px 18px; }
  .content { width: min(100% - 20px, 1000px); padding-top: 20px; }
  .intro, .panel { padding: 20px; }
  .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; }
  .status-badge { display: inline-block; margin-top: 14px; }
  .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; }
}
