:root {
  --ink: #18231f;
  --muted: #65716c;
  --line: #dde4e0;
  --surface: #ffffff;
  --canvas: #f4f7f5;
  --green: #176b4d;
  --green-dark: #0e5139;
  --green-soft: #e8f4ee;
  --amber: #a76309;
  --amber-soft: #fff4dc;
  --red: #b13b35;
  --red-soft: #fff0ee;
  --blue: #315e9b;
  --blue-soft: #edf4ff;
  --shadow: 0 12px 36px rgba(24, 35, 31, 0.07);
  --radius: 16px;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

a { color: inherit; }

button, input, select, textarea { font: inherit; }

.skip-link {
  position: fixed;
  top: -80px;
  left: 16px;
  z-index: 100;
  padding: 10px 16px;
  color: white;
  background: var(--ink);
  border-radius: 8px;
}

.skip-link:focus { top: 12px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1180px;
  min-height: 72px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--green);
  border-radius: 11px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; line-height: 1.25; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 10px; letter-spacing: 0.08em; }

.account-area { display: flex; align-items: center; gap: 16px; }
.account-copy { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.account-copy span { color: var(--muted); }
.account-copy span::after { content: ""; display: inline-block; height: 12px; margin-left: 8px; border-right: 1px solid var(--line); vertical-align: -1px; }

.page-shell {
  width: min(1124px, calc(100% - 48px));
  min-height: calc(100vh - 150px);
  margin: 0 auto;
  padding: 52px 0 72px;
}

.site-footer {
  max-width: 1124px;
  margin: 0 auto;
  padding: 22px 0 30px;
  display: flex;
  justify-content: space-between;
  color: #7a8580;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(28px, 4vw, 40px); line-height: 1.25; letter-spacing: -0.045em; }
h2 { margin-bottom: 6px; font-size: 20px; letter-spacing: -0.025em; }
h3 { margin-bottom: 5px; font-size: 17px; }

.page-heading { margin-bottom: 30px; }
.page-heading > p:last-child, .detail-heading > div > p:last-child { margin-bottom: 0; color: var(--muted); }
.heading-with-action { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.compact-heading { margin-bottom: 26px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-heading { padding: 24px 26px 18px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.row-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.record-count { padding: 4px 10px; color: var(--green); background: var(--green-soft); border-radius: 99px; font-size: 12px; font-weight: 700; }

.button {
  min-height: 44px;
  padding: 10px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.button:hover { transform: translateY(-1px); }
.button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid rgba(23, 107, 77, 0.28); outline-offset: 2px; }
.button:disabled { cursor: wait; opacity: 0.65; transform: none; }
.button-primary { color: white; background: var(--green); border-color: var(--green); }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { color: var(--green-dark); background: white; border-color: #a9c9bb; }
.button-secondary:hover { background: var(--green-soft); }
.button-quiet { color: #4e5a55; background: transparent; border-color: var(--line); }
.button-quiet:hover { background: #f3f6f4; }
.button-small { min-height: 34px; padding: 7px 11px; font-size: 12px; }
.button-full { width: 100%; }
.button-danger { color: white; background: var(--red); border-color: var(--red); }
.button-danger:hover { background: #9b2424; border-color: #9b2424; }
.history-actions { display: flex; gap: 8px; }
.history-delete-link { color: var(--red); }
.history-management-form { max-width: 620px; margin-top: 24px; }

.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { padding: 12px 18px; color: var(--muted); background: #f8faf9; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 11px; text-align: left; white-space: nowrap; }
.data-table td { padding: 17px 18px; border-bottom: 1px solid #edf1ef; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfcfb; }
.table-link, .text-link { color: var(--green-dark); font-weight: 700; text-decoration: none; }
.table-link:hover, .text-link:hover { text-decoration: underline; }
.text-link { white-space: nowrap; }
.warning-text { color: var(--amber); }
.muted { color: #89928e; }

.status, .document-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.status-succeeded, .document-processed { color: var(--green-dark); background: var(--green-soft); }
.status-review_required { color: var(--amber); background: var(--amber-soft); }
.status-partial_failed, .status-failed, .document-failed { color: var(--red); background: var(--red-soft); }
.status-processing, .status-uploading, .status-queued, .document-uploaded { color: var(--blue); background: var(--blue-soft); }
.document-skipped { color: #6a625b; background: #f1efec; }

.empty-state { padding: 68px 24px 72px; text-align: center; }
.empty-state p { color: var(--muted); }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 18px; display: grid; place-items: center; color: var(--green); background: var(--green-soft); border-radius: 50%; font-size: 25px; font-weight: 800; }

.message-stack { width: min(1124px, calc(100% - 48px)); margin: 18px auto -24px; }
.message { padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; font-weight: 650; }
.message-success { color: var(--green-dark); background: var(--green-soft); border-color: #c7e0d5; }
.message-warning { color: #825009; background: var(--amber-soft); border-color: #efd5a1; }
.message-error { color: #8f302b; background: var(--red-soft); border-color: #efc7c3; }

.auth-layout { min-height: 620px; display: grid; grid-template-columns: 1.1fr 0.75fr; align-items: center; gap: clamp(48px, 9vw, 120px); }
.auth-intro { padding-left: 24px; }
.auth-intro h1 { max-width: 620px; font-size: clamp(38px, 5vw, 58px); line-height: 1.18; }
.auth-intro > p:not(.eyebrow) { max-width: 540px; color: var(--muted); font-size: 17px; }
.feature-list { margin: 34px 0 0; padding: 0; list-style: none; }
.feature-list li { margin: 12px 0; display: flex; align-items: center; gap: 12px; color: #45504c; }
.feature-list span { color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: 0.06em; }
.auth-card { padding: 36px; }
.auth-card .panel-heading { padding: 0 0 26px; }
.auth-card .panel-heading h2 { font-size: 28px; }
.help-copy { margin: 20px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

.stack-form { display: grid; gap: 20px; }
.field-group { margin-bottom: 26px; }
.field-group label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 750; }
.field-group input[type="text"], .field-group input[type="password"] { width: 100%; min-height: 48px; padding: 10px 13px; color: var(--ink); background: white; border: 1px solid #cbd4cf; border-radius: 9px; }
.field-group input[type="text"]::placeholder { color: #a1aaa6; }
.field-hint { margin: -3px 0 9px; color: var(--muted); font-size: 12px; }
.required-mark { margin-left: 5px; color: var(--green); font-size: 10px; }
.field-error { margin: 8px 0 0; color: var(--red); font-size: 12px; font-weight: 650; }
.form-alert { margin-bottom: 20px; padding: 12px 14px; color: #8f302b; background: var(--red-soft); border: 1px solid #efc7c3; border-radius: 9px; font-size: 13px; }
.form-alert p { margin: 0; }

.breadcrumb { margin: -12px 0 28px; display: flex; gap: 9px; color: var(--muted); font-size: 12px; }
.breadcrumb a { color: var(--green); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; align-items: start; gap: 24px; }
.upload-panel { padding: 30px; }
.drop-zone { position: relative; min-height: 245px; padding: 36px 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); background: #f9fbfa; border: 1.5px dashed #afc3ba; border-radius: 13px; text-align: center; }
.drop-zone strong { margin-bottom: 2px; color: var(--ink); font-size: 17px; }
.drop-zone > span:not(.upload-symbol) { margin-bottom: 18px; font-size: 12px; }
.upload-symbol { width: 54px; height: 54px; margin-bottom: 15px; display: grid; place-items: center; color: var(--green); background: var(--green-soft); border-radius: 14px; font-size: 12px; font-weight: 900; }
.drop-zone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.selected-files { margin-top: 10px; padding: 10px 12px; color: var(--muted); background: #f8faf9; border-radius: 8px; font-size: 11px; overflow-wrap: anywhere; }
.form-actions { padding-top: 6px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); }
.submit-note { margin: 12px 0 0; color: var(--muted); font-size: 11px; text-align: right; }
.guidance-card { padding: 26px; background: #1d2d27; color: white; border-radius: var(--radius); box-shadow: var(--shadow); }
.guidance-card h2 { font-size: 18px; }
.numbered-guide { margin: 22px 0 24px; padding: 0; list-style: none; }
.numbered-guide li { padding: 14px 0; display: flex; gap: 13px; border-top: 1px solid rgba(255,255,255,0.12); }
.numbered-guide li > span { width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; color: #bfe5d3; background: rgba(255,255,255,0.08); border-radius: 50%; font-size: 10px; font-weight: 800; }
.numbered-guide strong { display: block; margin-bottom: 2px; font-size: 13px; }
.numbered-guide p { margin: 0; color: #b9c5bf; font-size: 11px; line-height: 1.55; }
.privacy-note { padding: 15px; color: #cdd7d2; background: rgba(255,255,255,0.06); border-radius: 10px; font-size: 11px; }
.privacy-note strong { color: white; }
.privacy-note p { margin: 3px 0 0; }

.detail-heading { margin-bottom: 28px; display: flex; justify-content: space-between; align-items: end; gap: 24px; }
.title-status-row { display: flex; align-items: center; gap: 13px; }
.title-status-row h1 { margin-bottom: 7px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.summary-grid { margin-bottom: 22px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.summary-card { padding: 19px 20px; background: white; border: 1px solid var(--line); border-radius: 13px; }
.summary-card span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.summary-card strong { margin: 4px 5px 0 0; display: inline-block; font-size: 29px; line-height: 1.2; }
.summary-card small { color: var(--muted); }
.summary-warning { border-color: #ecd29f; background: #fffbf3; }
.summary-warning strong { color: var(--amber); }
.summary-error { border-color: #edcac6; background: #fff9f8; }
.summary-error strong { color: var(--red); }
.result-banner { margin-bottom: 22px; padding: 20px 22px; display: flex; align-items: center; gap: 15px; }
.processing-banner { margin-bottom: 22px; padding: 20px 22px; display: flex; align-items: center; gap: 16px; border-color: #bfd6cb; }
.processing-banner > div:nth-child(2) { flex: 1; }
.processing-banner h2 { margin: 0 0 2px; font-size: 16px; }
.processing-banner p { margin: 0; color: var(--muted); font-size: 12px; }
.processing-spinner { width: 34px; height: 34px; flex: 0 0 34px; border: 3px solid #dbe9e2; border-top-color: var(--green); border-radius: 50%; animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.file-icon { width: 48px; height: 48px; flex: 0 0 48px; display: grid; place-items: center; color: var(--green-dark); background: var(--green-soft); border-radius: 11px; font-size: 10px; font-weight: 900; }
.result-file-copy { flex: 1; min-width: 0; }
.result-file-copy h2 { margin: 0 0 2px; font-size: 16px; }
.result-file-copy p { margin: 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.issues-panel { margin-bottom: 22px; overflow: hidden; }
.issue-list { border-top: 1px solid var(--line); }
.issues-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; }
.issues-heading h2 { margin: 0; }
.issues-more > summary { padding: 12px 24px; color: var(--green); font-size: 13px; font-weight: 700; cursor: pointer; }
.issues-collapse, .issues-more[open] > summary .issues-expand { display: none; }
.issues-more[open] > summary .issues-collapse { display: inline; }
.issues-more > summary:focus-visible { outline: 2px solid var(--green); outline-offset: -3px; }
.issue-item { padding: 16px 24px; display: flex; gap: 13px; border-bottom: 1px solid #edf1ef; }
.issue-item:last-child { border-bottom: 0; }
.issue-marker { width: 25px; height: 25px; flex: 0 0 25px; display: grid; place-items: center; color: var(--amber); background: var(--amber-soft); border-radius: 50%; font-size: 12px; font-weight: 900; }
.issue-high .issue-marker { color: var(--red); background: var(--red-soft); }
.issue-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.issue-title-row code { padding: 2px 6px; color: #69736e; background: #eff2f0; border-radius: 4px; font-size: 9px; }
.issue-item p { margin: 3px 0 0; color: #4e5954; font-size: 12px; }
.issue-item small { color: var(--muted); font-size: 10px; }
.metadata-panel { margin-top: 20px; padding: 0 22px; background: white; border: 1px solid var(--line); border-radius: 12px; }
.metadata-panel summary { padding: 15px 0; cursor: pointer; color: #4d5853; font-size: 12px; font-weight: 700; }
.metadata-grid { margin: 0; padding: 4px 0 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.metadata-grid div { padding: 10px 12px; background: #f7f9f8; border-radius: 8px; }
.metadata-grid dt { color: var(--muted); font-size: 10px; }
.metadata-grid dd { margin: 2px 0 0; font-size: 12px; font-weight: 650; overflow-wrap: anywhere; }
.empty-cell { color: var(--muted); text-align: center; }
.account-form { padding: 24px; max-width: 620px; }
.account-form .form-field { margin-bottom: 18px; }
.account-form label { display: block; margin-bottom: 6px; font-weight: 650; }
.account-form input:not([type="checkbox"]) { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.account-form .help-text { color: var(--muted); font-size: 12px; }
.account-form .errorlist { color: var(--red); padding-left: 20px; }
.panel[aria-labelledby="accounts-heading"], .panel[aria-labelledby="create-heading"] { margin-bottom: 24px; }
.panel > h2 { padding: 20px 24px 0; }
.guide-panel { padding: 28px 30px; margin-bottom: 24px; line-height: 1.85; }
.guide-panel > h2 { padding: 0; margin-bottom: 18px; font-size: 19px; line-height: 1.4; }
.guide-panel > ol { margin: 0 0 20px; padding-left: 1.5em; }
.guide-panel li { margin: 0 0 10px; padding-left: 4px; }
.guide-panel li:last-child { margin-bottom: 0; }
.guide-panel p, .guide-panel li, .guide-example dd { word-break: keep-all; overflow-wrap: anywhere; }
.guide-panel > p { max-width: 76ch; margin: 0; }
.guide-panel > p + p { margin-top: 14px; }
.guide-example, .feedback-context { padding: 16px; margin-bottom: 22px; background: var(--green-soft); border-radius: 10px; }
.guide-example { padding: 20px; }
.guide-example h3 { margin: 0 0 12px; font-size: 15px; }
.guide-example-details { margin: 0; }
.guide-example-details > div { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 16px; margin-top: 8px; }
.guide-example-details > div:first-child { margin-top: 0; }
.guide-example-details dt { color: var(--green-dark); font-weight: 700; }
.guide-example-details dd { margin: 0; }
.feedback-context p { margin: 6px 0 0; }
.feedback-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.feedback-history { margin-bottom: 22px; }
.field-group textarea, .field-group select, .feedback-filters input, .feedback-filters select { width: 100%; padding: 10px 13px; font: inherit; color: var(--ink); background: white; border: 1px solid #cbd4cf; border-radius: 9px; }
.field-group textarea { display: block; min-width: 0; max-width: 100%; resize: vertical; min-height: 90px; }
.feedback-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; padding: 0 24px 22px; }
.feedback-filters > div:first-child { flex: 1 1 240px; }
.feedback-filters label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 700; }
.filter-note { padding: 0 24px; overflow-wrap: anywhere; }
.pagination { display: flex; justify-content: center; gap: 20px; padding: 20px; font-size: 13px; }
.account-area { flex-wrap: wrap; justify-content: flex-end; }
.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: 900px) {
  .auth-layout { grid-template-columns: 1fr; gap: 28px; }
  .auth-intro { padding: 18px 4px 0; }
  .feature-list { display: none; }
  .form-layout { grid-template-columns: 1fr; }
  .guidance-card { order: -1; }
  .numbered-guide { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .numbered-guide li { border-top: 0; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .header-inner { min-height: 64px; padding: 0 16px; }
  .header-inner { flex-wrap: wrap; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
  .account-area { gap: 6px; }
  .brand small, .account-copy span { display: none; }
  .account-copy { display: none; }
  .page-shell { width: min(100% - 28px, 1124px); padding: 34px 0 52px; }
  .site-footer { margin: 0 14px; }
  .heading-with-action, .detail-heading { align-items: stretch; flex-direction: column; }
  .heading-with-action .button { align-self: flex-start; }
  .detail-actions .button { flex: 1; }
  .summary-grid { gap: 8px; }
  .summary-card { padding: 15px; }
  .summary-card strong { font-size: 25px; }
  .numbered-guide { display: block; }
  .auth-card, .upload-panel { padding: 23px 19px; }
  .guide-panel { padding: 22px 20px; }
  .guide-example { padding: 16px; }
  .guide-example-details > div { grid-template-columns: 1fr; gap: 2px; margin-top: 12px; }
  .auth-intro h1 { font-size: 35px; }
  .result-banner { align-items: flex-start; flex-wrap: wrap; }
  .result-banner .button { width: 100%; }
  .metadata-grid { grid-template-columns: 1fr 1fr; }
  .site-footer { flex-direction: column; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
