:root {
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: #172230;
  background: #f2f6f8;
  font-synthesis: none;
  --navy: #15334d;
  --blue: #276b8b;
  --sky: #eaf4f8;
  --mint: #58b3a5;
  --line: #dce5ea;
  --muted: #687887;
  --warning: #fff4cf;
  --warning-strong: #9b6700;
  --shadow: 0 18px 50px rgba(26, 57, 75, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(85, 179, 165, 0.10), transparent 26rem),
    linear-gradient(180deg, #f8fbfc 0, #f2f6f8 28rem);
}

button, input { font: inherit; }
button { cursor: pointer; }

.page-shell { width: min(1160px, calc(100% - 40px)); margin: 0 auto; padding-bottom: 72px; }

.topbar {
  min-height: 104px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid rgba(21, 51, 77, 0.10);
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: white;
  background: linear-gradient(145deg, var(--navy), var(--blue));
  box-shadow: 0 8px 20px rgba(21, 51, 77, 0.22);
}

.brand-mark svg { width: 30px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.eyebrow { margin: 0 0 3px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: 0.14em; }
.topbar h1 { margin: 0; font-size: 20px; line-height: 1.2; letter-spacing: -0.03em; }

.connection {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.connection-dot { width: 8px; height: 8px; border-radius: 50%; background: #b7c2c9; box-shadow: 0 0 0 4px rgba(183,194,201,.18); }
.connection.ready .connection-dot { background: #32a575; box-shadow: 0 0 0 4px rgba(50,165,117,.14); }
.connection.error .connection-dot { background: #d76464; box-shadow: 0 0 0 4px rgba(215,100,100,.14); }

main { padding-top: 56px; }
.intro { display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 80px; align-items: end; margin-bottom: 34px; }
.section-kicker { margin: 0 0 12px; color: var(--blue); font-size: 13px; font-weight: 800; }
.intro h2 { margin: 0; color: var(--navy); font-size: clamp(32px, 4vw, 49px); line-height: 1.18; letter-spacing: -0.055em; }
.intro-copy { margin: 0 0 4px; color: var(--muted); font-size: 15px; line-height: 1.8; word-break: keep-all; }
.intro-copy strong { color: var(--navy); }

.workspace-card, .table-card, .progress-card, .error-card {
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(21, 51, 77, 0.10);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.workspace-card { padding: 30px; }
.step-heading { display: flex; align-items: center; gap: 14px; }
.step-number { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 11px; background: var(--sky); color: var(--blue); font-weight: 800; }
.step-number.done { background: #e5f5ef; color: #238365; }
.step-heading h3 { margin: 0 0 4px; font-size: 18px; letter-spacing: -0.025em; }
.step-heading p { margin: 0; color: var(--muted); font-size: 13px; }

.dropzone {
  min-height: 248px;
  margin-top: 24px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1.5px dashed #a9c4d1;
  border-radius: 18px;
  color: var(--muted);
  background: linear-gradient(180deg, #fbfdfe, #f6fafb);
  transition: 160ms ease;
}

.dropzone:hover, .dropzone.dragging { border-color: var(--blue); background: #f0f8fb; transform: translateY(-1px); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone strong { color: var(--navy); font-size: 17px; }
.dropzone > span:last-child { font-size: 13px; }
.upload-icon { width: 58px; height: 58px; display: grid; place-items: center; margin-bottom: 4px; border-radius: 18px; color: var(--blue); background: white; border: 1px solid #dbe8ee; box-shadow: 0 8px 24px rgba(39,107,139,.10); }
.upload-icon svg { width: 30px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.selected-area { margin-top: 22px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.selected-header { min-height: 48px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; background: #f8fafb; border-bottom: 1px solid var(--line); font-size: 13px; }
.selected-header strong { color: var(--navy); }
.selected-header span { margin-left: 8px; color: var(--muted); }
.text-button { border: 0; background: transparent; color: var(--blue); font-size: 13px; font-weight: 700; }
.file-list { margin: 0; padding: 0; list-style: none; max-height: 248px; overflow: auto; }
.file-item { min-height: 52px; padding: 9px 14px 9px 16px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; border-bottom: 1px solid #edf1f3; }
.file-item:last-child { border-bottom: 0; }
.file-icon { width: 30px; height: 34px; display: grid; place-items: center; border-radius: 7px; color: var(--blue); background: var(--sky); font-size: 9px; font-weight: 900; text-transform: uppercase; }
.file-meta { min-width: 0; }
.file-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.file-meta span { color: var(--muted); font-size: 11px; }
.remove-file { width: 30px; height: 30px; border: 0; border-radius: 8px; color: #7c8994; background: transparent; font-size: 19px; line-height: 1; }
.remove-file:hover { color: #b24444; background: #fff0f0; }

.action-row { min-height: 66px; margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.action-row p { margin: 0; color: var(--muted); font-size: 12px; }
.info-dot { display: inline-grid; place-items: center; width: 17px; height: 17px; margin-right: 4px; border: 1px solid #a9bbc5; border-radius: 50%; font-size: 10px; font-weight: 800; }
.primary-button, .download-button { border: 0; color: white; background: linear-gradient(135deg, var(--navy), var(--blue)); box-shadow: 0 9px 22px rgba(21,51,77,.18); font-weight: 750; }
.primary-button { min-width: 214px; height: 48px; padding: 0 20px; display: flex; align-items: center; justify-content: center; gap: 12px; border-radius: 13px; }
.primary-button svg, .download-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.primary-button:disabled { cursor: not-allowed; color: #9ca9b1; background: #e7ecef; box-shadow: none; }

.progress-card, .error-card { margin-top: 22px; padding: 24px 28px; display: flex; align-items: center; gap: 18px; }
.progress-card strong, .error-card strong { display: block; margin-bottom: 4px; }
.progress-card p, .error-card p { margin: 0; color: var(--muted); font-size: 13px; }
.spinner { width: 34px; height: 34px; border: 3px solid #dcecf2; border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-card { border-color: #f1c4c4; background: #fffafa; }
.error-card strong { color: #a93f3f; }

.results { margin-top: 42px; }
.results-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.download-button { height: 44px; padding: 0 18px; display: flex; align-items: center; gap: 9px; border-radius: 12px; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.summary-card { min-height: 112px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 17px; background: white; box-shadow: 0 10px 28px rgba(27,54,70,.05); }
.summary-card span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.summary-card strong { color: var(--navy); font-size: 31px; line-height: 1; }
.summary-card small { margin-left: 5px; color: var(--muted); }
.warning-summary strong { color: var(--warning-strong); }

.document-details { margin-bottom: 16px; border: 1px solid var(--line); border-radius: 14px; background: white; overflow: hidden; }
.document-details summary { padding: 14px 18px; cursor: pointer; color: var(--navy); font-size: 13px; font-weight: 750; }
.document-list { border-top: 1px solid var(--line); }
.document-row { min-height: 54px; padding: 10px 18px; display: grid; grid-template-columns: minmax(180px, 1fr) 110px minmax(220px, 1fr); align-items: center; gap: 16px; border-bottom: 1px solid #edf1f3; font-size: 12px; }
.document-row:last-child { border-bottom: 0; }
.document-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.document-reason { color: var(--muted); }
.status-chip { justify-self: start; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.status-chip.read { color: #14694f; background: #e4f5ee; }
.status-chip.skip { color: #667681; background: #edf1f3; }
.status-chip.unknown { color: #9b4c37; background: #fff0eb; }

.table-card { overflow: hidden; }
.table-scroll { overflow: auto; max-height: 660px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
th { position: sticky; top: 0; z-index: 1; height: 48px; padding: 0 16px; color: white; background: var(--navy); text-align: right; font-size: 12px; letter-spacing: .02em; }
th:first-child, th:nth-child(2), th:last-child { text-align: left; }
td { height: 45px; padding: 0 16px; border-bottom: 1px solid #e6ecef; background: white; text-align: right; font-variant-numeric: tabular-nums; }
td:first-child { width: 70px; text-align: center; color: var(--muted); }
td:nth-child(2) { min-width: 150px; text-align: left; font-weight: 700; color: var(--navy); }
td:last-child { min-width: 170px; text-align: left; }
tr:nth-child(even) td { background: #f9fbfc; }
tr.warning-row td { background: var(--warning); }
.value-missing { color: #a1aeb7; }
.ok-label { color: #39816d; font-size: 11px; font-weight: 750; }
.warning-label { display: inline-block; color: var(--warning-strong); font-size: 11px; font-weight: 750; line-height: 1.45; }

.hidden { display: none !important; }

@media (max-width: 760px) {
  .page-shell { width: min(100% - 24px, 1160px); }
  .topbar { min-height: 84px; }
  .connection span:last-child { display: none; }
  main { padding-top: 34px; }
  .intro { grid-template-columns: 1fr; gap: 22px; }
  .intro h2 { font-size: 34px; }
  .workspace-card { padding: 20px; border-radius: 18px; }
  .dropzone { min-height: 205px; }
  .action-row, .results-heading { align-items: stretch; flex-direction: column; }
  .primary-button, .download-button { width: 100%; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-card { min-height: 88px; }
  .document-row { grid-template-columns: 1fr auto; gap: 7px 12px; }
  .document-reason { grid-column: 1 / -1; }
}
