:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --muted: #6d7688;
  --line: #e3e8f0;
  --accent: #2459d6;
  --accent-dark: #1946b5;
  --green: #18794e;
  --green-bg: #eaf7f0;
  --amber: #9a5b00;
  --amber-bg: #fff4dd;
  --blue-bg: #edf3ff;
  --gray-bg: #f1f3f6;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(34, 52, 84, .08);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-width: 320px;
  background: linear-gradient(180deg, #eef4ff 0, var(--bg) 360px);
  color: var(--text);
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.app-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 70px 0 36px; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; margin-bottom: 30px; }
.eyebrow { margin: 0 0 9px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-size: clamp(32px, 4vw, 52px); line-height: 1.1; letter-spacing: -.045em; }
h2 { margin-bottom: 8px; font-size: 24px; letter-spacing: -.025em; }
.hero-copy { max-width: 720px; margin-bottom: 0; color: var(--muted); line-height: 1.75; }
.privacy-note { flex: 0 0 auto; display: flex; align-items: center; gap: 9px; padding: 12px 14px; border: 1px solid #dce6f8; border-radius: 12px; background: rgba(255,255,255,.72); color: #4c5e7a; font-size: 13px; }
.privacy-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px #dff3e8; }

.panel { border: 1px solid rgba(215, 223, 236, .9); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.upload-panel { padding: 28px; }

.file-guide {
  margin-bottom: 22px;
  padding: 24px;
  border: 1px solid #dce6f8;
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fbff 0%, #f4f8ff 100%);
}
.file-guide-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.file-guide-kicker { margin: 0 0 7px; color: var(--accent); font-size: 11px; font-weight: 850; letter-spacing: .14em; }
.file-guide-head h2 { margin-bottom: 6px; font-size: 20px; }
.file-guide-head p { margin-bottom: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.guide-steps { display: grid; gap: 10px; margin-top: 20px; }
.guide-step-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.guide-chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid #dbe5f5;
  border-radius: 10px;
  background: rgba(255,255,255,.92);
  color: #35425a;
  font-size: 13px;
  font-weight: 750;
  box-shadow: 0 3px 10px rgba(39, 69, 116, .04);
}
.guide-arrow { color: #9aa8bd; font-size: 15px; font-weight: 800; }
.guide-step-row-single { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin; }
.guide-step-row-single .guide-chip, .guide-step-row-single .guide-arrow { flex: 0 0 auto; }
.guide-chip-emphasis {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  box-shadow: 0 8px 18px rgba(36, 89, 214, .2);
}
.file-format-notice {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid #ccdcfa;
  border-radius: 13px;
  background: #edf4ff;
}
.format-badge {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: white;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .06em;
  box-shadow: 0 4px 12px rgba(36, 89, 214, .08);
}
.file-format-notice strong { display: block; margin-bottom: 3px; color: #23406f; font-size: 14px; }
.file-format-notice p { margin: 0; color: #65738b; font-size: 12px; line-height: 1.55; }
.drop-zone { padding: 64px 24px; border: 2px dashed #cdd8eb; border-radius: 18px; background: var(--surface-soft); text-align: center; transition: .2s ease; }
.drop-zone:hover, .drop-zone.dragover, .drop-zone:focus-visible { border-color: var(--accent); background: var(--blue-bg); outline: none; }
.drop-icon { width: 52px; height: 52px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 16px; background: var(--blue-bg); color: var(--accent); font-size: 28px; font-weight: 700; }
.drop-zone h2 { margin-bottom: 8px; }
.drop-zone p { margin-bottom: 22px; color: var(--muted); }
.button { border: 0; border-radius: 11px; padding: 11px 16px; font-weight: 750; transition: transform .15s ease, background .15s ease, opacity .15s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .45; }
.button.primary { background: var(--accent); color: white; }
.button.primary:hover:not(:disabled) { background: var(--accent-dark); }
.button.secondary { background: var(--blue-bg); color: var(--accent); }
.button.ghost { background: var(--gray-bg); color: #4b5568; }
.button.large { padding: 14px 20px; }
.panel-actions { display: flex; justify-content: flex-end; padding-top: 20px; }
.file-list { display: grid; gap: 8px; padding-top: 18px; }
.file-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; border-radius: 12px; background: var(--surface-soft); }
.file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.file-meta { color: var(--muted); font-size: 13px; }
.remove-file { border: 0; background: transparent; color: var(--muted); font-weight: 800; }

.progress-panel { display: flex; align-items: center; gap: 20px; padding: 34px; }
.progress-panel p { margin-bottom: 0; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 4px solid #dce6fb; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.summary-card { padding: 22px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.9); }
.summary-card span { display: block; margin-bottom: 10px; color: var(--muted); font-size: 14px; }
.summary-card strong { font-size: 34px; letter-spacing: -.04em; }
.summary-card.attention strong { color: var(--amber); }
.result-tools { padding: 26px; }
.result-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; padding: 18px 0 20px; border-bottom: 1px solid var(--line); }
.filter-chip { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--muted); font-size: 13px; font-weight: 700; }
.filter-chip.active { border-color: var(--accent); background: var(--blue-bg); color: var(--accent); }
.result-help { max-width: 720px; margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.result-list { display: grid; gap: 18px; padding-top: 18px; }
.class-result-block { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: white; }
.class-result-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 18px; border-bottom: 1px solid var(--line); background: #f8faff; }
.class-result-head > div { min-width: 0; }
.class-result-title { display: block; margin-bottom: 3px; font-size: 16px; }
.class-result-file { display: block; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.class-result-count { flex: 0 0 auto; color: var(--accent); font-size: 13px; font-weight: 800; }
.student-table-wrap { overflow-x: auto; }
.student-result-table { min-width: 1120px; }
.student-table-head,
.student-result-row {
  display: grid;
  grid-template-columns: 112px 62px 100px minmax(155px, .9fr) minmax(310px, 1.8fr) minmax(245px, 1.2fr);
  align-items: stretch;
}
.student-table-head {
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
  color: #6d7688;
  font-size: 12px;
  font-weight: 800;
}
.student-table-head span { padding: 11px 12px; border-right: 1px solid #edf0f5; }
.student-result-row { border-bottom: 1px solid #edf0f5; background: white; }
.student-result-row:last-child { border-bottom: 0; }
.student-result-row:nth-child(odd) { background: #fcfdff; }
.student-result-row:hover { background: #f8fbff; }
.student-cell { min-width: 0; padding: 14px 12px; border-right: 1px solid #edf0f5; }
.student-cell:last-child { border-right: 0; }
.class-cell, .number-cell, .name-cell, .career-cell { display: flex; align-items: center; }
.class-cell { color: #506078; font-size: 13px; font-weight: 700; }
.number-cell { justify-content: center; font-weight: 800; }
.name-cell { font-weight: 800; }
.career-cell { line-height: 1.55; }
.match-cell { display: flex; flex-direction: column; justify-content: center; }
.match-title-line { display: flex; align-items: center; gap: 9px; min-width: 0; }
.match-title-line strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recommendation-reason { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.choice-cell { display: flex; align-items: center; }
.student-count { color: var(--muted); }
.status-badge { justify-self: start; display: inline-flex; align-items: center; padding: 6px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.status-skip { background: var(--gray-bg); color: #667085; }
.status-keep, .status-exact { background: var(--green-bg); color: var(--green); }
.status-normalized { background: var(--blue-bg); color: var(--accent); }
.status-review, .status-related, .status-recommended { background: var(--amber-bg); color: var(--amber); }
.status-ai-search { background: #f1ecff; color: #6941c6; }
.status-error { background: #feeceb; color: var(--danger); }
.choice-group { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; width: 100%; }
.candidate-select { width: 100%; min-width: 0; padding: 10px 11px; border: 1px solid #d8dfeb; border-radius: 10px; background: white; color: var(--text); }
.apply-toggle { display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.apply-toggle input { accent-color: var(--accent); }
.ai-search-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid #d9ccff;
  border-radius: 10px;
  background: #f7f4ff;
  color: #6941c6;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.ai-search-button:hover {
  transform: translateY(-1px);
  border-color: #bda7ff;
  background: #f0eaff;
}
.ai-search-button:focus-visible {
  outline: 3px solid rgba(105, 65, 198, .2);
  outline-offset: 2px;
}
.empty-result { padding: 38px 0; text-align: center; color: var(--muted); }

.download-panel { margin-top: 18px; padding: 26px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.download-panel p { margin-bottom: 0; color: var(--muted); line-height: 1.6; }
footer { padding: 24px 0 0; text-align: center; color: var(--muted); font-size: 13px; }
footer p { margin-bottom: 0; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 20; transform: translate(-50%, 20px); padding: 12px 16px; border-radius: 10px; background: #172033; color: white; opacity: 0; pointer-events: none; transition: .2s ease; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 900px) {
  .hero { align-items: flex-start; flex-direction: column; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .student-result-table { min-width: 1040px; }
}
@media (max-width: 600px) {
  .app-shell { width: min(100% - 24px, 1180px); padding-top: 34px; }
  .upload-panel, .result-tools, .download-panel { padding: 18px; }
  .file-guide { padding: 16px; }
  .guide-step-row { gap: 6px; }
  .guide-chip { min-height: 34px; padding: 7px 10px; font-size: 12px; }
  .file-format-notice { align-items: flex-start; }
  .drop-zone { padding: 42px 14px; }
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .summary-card { padding: 16px; }
  .summary-card strong { font-size: 28px; }
  .result-heading, .download-panel { align-items: stretch; flex-direction: column; }
  .button-row { justify-content: flex-start; }
  .class-result-head { align-items: flex-start; }
}

.match-progress { margin-top: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.match-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.match-progress-head strong { color: var(--text); }
.match-progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: #dfe7f5; }
.match-progress-bar { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .25s ease; }
.match-progress.complete .match-progress-bar { background: var(--green); }
.status-pending { background: var(--blue-bg); color: var(--accent); }
.pending-text { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.mini-spinner { width: 14px; height: 14px; border: 2px solid #dce6fb; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }


.choice-main-controls {
  display: flex;
  width: 100%;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.choice-main-controls .candidate-select {
  flex: 1 1 auto;
  min-width: 0;
}
.choice-cell .choice-group {
  width: 100%;
}
.choice-cell .ai-search-button {
  flex: 0 0 auto;
  align-self: flex-start;
}

@media (max-width: 760px) {
  .choice-main-controls { flex-wrap: wrap; }
}
