:root {
  --ink: #07152f;
  --muted: #65738a;
  --line: #dde5ef;
  --soft: #f6f8fb;
  --panel: #ffffff;
  --brand: #2563eb;
  --brand-dark: #102148;
  --ok: #21b56f;
  --warn: #f5b82e;
  --danger: #ef4444;
  --shadow: 0 12px 32px rgba(12, 26, 54, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--soft);
  color: var(--ink);
  font-family:
    Inter, Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", system-ui,
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1280px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: start;
  margin-bottom: 28px;
}

.eyebrow {
  display: inline-flex;
  margin: 0 0 10px;
  padding: 7px 13px;
  color: #ffffff;
  background: var(--ink);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  font-size: 21px;
  line-height: 1.2;
}

.subtitle {
  max-width: 760px;
  margin-top: 10px;
  color: #31415b;
  line-height: 1.55;
}

.score-summary {
  min-width: 150px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.score-summary span,
.score-summary small {
  display: block;
  color: var(--muted);
}

.score-summary strong {
  display: block;
  margin-top: 8px;
  font-size: 32px;
  line-height: 1;
}

.score-summary small {
  margin-top: 8px;
  color: #d27d00;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 410px) minmax(420px, 1fr) minmax(280px, 320px);
  gap: 24px;
  align-items: stretch;
}

.left-column,
.right-column {
  display: grid;
  gap: 22px;
  height: 100%;
}

.left-column {
  grid-template-rows: auto 1fr;
}

.right-column {
  align-self: start;
  grid-template-rows: auto;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.left-column .panel,
.right-column .panel,
.document-panel {
  min-height: 0;
}

.document-panel {
  display: flex;
  flex-direction: column;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef3f9;
  color: #31415b;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill.success {
  background: #dff8ea;
  color: #087847;
}

.pill.blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.pill.warning {
  background: #fff2c3;
  color: #9a5b00;
}

.pill.danger {
  background: #fee2e2;
  color: #b91c1c;
}

.upload-dropzone {
  display: grid;
  place-items: center;
  min-height: 235px;
  padding: 28px;
  border: 2px dashed #cbd7e8;
  border-radius: 8px;
  background: #fbfdff;
  text-align: center;
}

.upload-dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.file-icon {
  width: 44px;
  height: 52px;
  margin-bottom: 12px;
  border-radius: 4px;
  background:
    linear-gradient(135deg, transparent 0 28%, #c7b5d9 29% 100%),
    linear-gradient(#ded2eb, #ded2eb);
  position: relative;
}

.file-icon::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 18px;
  width: 22px;
  height: 16px;
  border-top: 2px solid #8d7aa3;
  border-bottom: 2px solid #8d7aa3;
}

.upload-dropzone strong {
  display: block;
  margin-bottom: 6px;
  font-size: 16px;
}

.upload-dropzone span:last-child,
.status-line,
.legend,
.special-note {
  color: var(--muted);
  font-size: 13px;
}

.document-type-field {
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.document-type-field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.document-type-field select {
  width: 100%;
  min-height: 36px;
  border: 1px solid #cbd7e8;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.primary-button,
.secondary-button,
.mini-button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button {
  min-height: 50px;
  margin-top: 16px;
  background: var(--brand);
  color: #ffffff;
}

.secondary-button {
  min-height: 48px;
  margin-top: 16px;
  background: #ffffff;
  color: var(--ink);
}

.mini-button {
  min-height: 36px;
  padding: 0 12px;
  background: var(--brand-dark);
  color: #ffffff;
}

.mini-button.ghost {
  background: #eef3f9;
  color: var(--ink);
}

.mini-button:disabled {
  background: #d9e7df;
  color: #0b7a48;
  cursor: default;
}

.status-line {
  margin-top: 10px;
}

.info-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.info-list div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 8px;
}

.info-list div.needs-review {
  background: #fff8e5;
}

.info-list dt {
  color: var(--muted);
  font-size: 13px;
}

.info-list dd {
  margin: 0;
  font-weight: 800;
  text-align: right;
}

.document-panel {
  min-width: 0;
}

.document-viewer {
  position: relative;
  flex: 1;
  min-height: 620px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  overflow: auto;
}

.doc-toolbar {
  display: inline-flex;
  align-items: center;
  width: auto;
  min-width: 190px;
  height: 32px;
  margin-bottom: 16px;
  padding: 0 12px;
  border-radius: 4px;
  background: #dbe3ee;
  color: #41516a;
  font-size: 12px;
  font-weight: 800;
}

.doc-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.doc-cell,
.doc-wide {
  min-height: 64px;
  padding: 12px;
  border: 1px solid #d9e3ef;
  border-radius: 4px;
  background: #ffffff;
  color: #5c687a;
  font-size: 12px;
  line-height: 1.45;
  overflow: hidden;
}

.doc-wide {
  margin-bottom: 12px;
  min-height: 86px;
}

.doc-cell.has-ocr-text,
.doc-wide.has-ocr-text {
  color: #17233a;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.08), transparent 70%),
    #ffffff;
}

.mapped {
  border-color: #93c5fd;
  box-shadow: inset 0 0 0 1px #bfdbfe;
}

.warning {
  border-color: #f8c34c;
  box-shadow: inset 0 0 0 1px #fde68a;
}

.danger {
  border-color: #fca5a5;
  box-shadow: inset 0 0 0 1px #fecaca;
}

.redaction-box,
.highlight-box,
.field-evidence-box {
  position: absolute;
  border-radius: 3px;
  pointer-events: none;
}

.redaction-box {
  background: #08152f;
  z-index: 4;
}

.redaction-box.mosaic {
  background:
    repeating-linear-gradient(
      45deg,
      rgba(8, 21, 47, 0.82) 0 4px,
      rgba(8, 21, 47, 0.58) 4px 8px
    );
}

.redaction-box.translucent {
  background: rgba(37, 99, 235, 0.28);
  border: 1px solid rgba(37, 99, 235, 0.55);
}

.preview-stack {
  display: grid;
  gap: 18px;
}

.preview-page {
  position: relative;
  width: min(100%, 860px);
  margin: 0 auto;
  border: 1px solid #cbd7e8;
  border-radius: 4px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(12, 26, 54, 0.12);
  overflow: hidden;
  cursor: zoom-in;
}

.preview-page img {
  display: block;
  width: 100%;
  height: auto;
}

.preview-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.modal-open {
  overflow: hidden;
}

.preview-zoom-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.preview-zoom-modal.hidden {
  display: none;
}

.preview-zoom-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 21, 47, 0.72);
}

.preview-zoom-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(96vw, 1180px);
  max-height: 94vh;
  border-radius: 8px;
  background: #f8fafc;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.preview-zoom-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #dbe5f2;
  background: #ffffff;
}

.preview-zoom-title {
  color: var(--ink);
  font-size: 15px;
}

.preview-zoom-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: #edf3fb;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  font-weight: 800;
}

.preview-zoom-body {
  overflow: auto;
  padding: 18px;
}

.preview-zoom-body .preview-page {
  width: min(1120px, 100%);
  cursor: default;
  box-shadow: 0 10px 28px rgba(12, 26, 54, 0.16);
}

.page-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(7, 21, 47, 0.82);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.field-evidence-box {
  border: 2px solid rgba(37, 99, 235, 0.9);
  background: rgba(37, 99, 235, 0.1);
  border-radius: 3px;
  z-index: 3;
}

.field-evidence-box.payment {
  border-color: rgba(245, 184, 46, 0.95);
  background: rgba(245, 184, 46, 0.14);
}

.field-evidence-box.property {
  border-color: rgba(37, 99, 235, 0.9);
  background: rgba(37, 99, 235, 0.1);
}

.field-evidence-box.special {
  border-color: rgba(22, 163, 74, 0.95);
  background: rgba(22, 163, 74, 0.18);
}

.highlight-box.high {
  border: 2px solid var(--danger);
  background: rgba(239, 68, 68, 0.08);
}

.highlight-box.medium {
  border: 2px solid var(--warn);
  background: rgba(245, 184, 46, 0.12);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-mapped {
  background: #93c5fd;
}

.legend-warning {
  background: #f8c34c;
}

.legend-danger {
  background: #fca5a5;
}

.special-terms {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.special-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.special-card strong {
  display: block;
  margin-bottom: 6px;
}

.risk-score {
  padding: 18px;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
}

.risk-score strong {
  display: block;
  font-size: 42px;
  line-height: 1;
}

.risk-score span {
  display: block;
  margin-top: 10px;
  color: #d8e4f5;
  font-size: 13px;
}

.checklist-groups {
  display: grid;
  gap: 16px;
  max-height: 420px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
}

.checklist-groups::-webkit-scrollbar {
  width: 8px;
}

.checklist-groups::-webkit-scrollbar-track {
  background: #eef3f9;
  border-radius: 999px;
}

.checklist-groups::-webkit-scrollbar-thumb {
  background: #b9c7db;
  border-radius: 999px;
}

.checklist-groups::-webkit-scrollbar-thumb:hover {
  background: #8fa1bc;
}

.checklist-group h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.check-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.check-item + .check-item {
  margin-top: 10px;
}

.check-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
}

.check-toggle {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 2px solid #a9b8cc;
  border-radius: 5px;
  background: #ffffff;
}

.check-item.completed .check-toggle {
  border-color: var(--ok);
  background:
    linear-gradient(135deg, transparent 0 45%, #ffffff 46% 55%, transparent 56%),
    var(--ok);
}

.check-title {
  display: grid;
  gap: 4px;
}

.check-title strong {
  font-size: 14px;
}

.check-title span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.check-points {
  color: #0b7a48;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.check-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-panel {
  background: var(--ink);
  color: #ffffff;
}

.action-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.action-list li {
  padding: 13px 14px;
  border-radius: 8px;
  background: #24324b;
  line-height: 1.45;
  font-size: 14px;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .document-panel {
    grid-column: 1 / -1;
    order: 3;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 24px, 460px);
    padding-top: 18px;
  }

  .topbar,
  .workspace {
    grid-template-columns: 1fr;
  }

  .left-column,
  .right-column {
    height: auto;
    grid-template-rows: none;
  }

  .document-panel,
  .checklist-panel {
    display: block;
  }

  .score-summary {
    width: 100%;
  }

  .document-panel {
    order: 0;
  }

  .document-viewer {
    min-height: 440px;
  }

  .checklist-groups {
    max-height: 420px;
  }

  .doc-row {
    grid-template-columns: 1fr;
  }

  .check-actions {
    grid-template-columns: 1fr;
  }
}
.topbar-actions {
  display: grid;
  grid-template-columns: minmax(320px, 420px) auto;
  gap: 16px;
  align-items: start;
}

.auth-panel {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-forms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.auth-form {
  display: grid;
  gap: 8px;
}

.auth-form strong {
  font-size: 14px;
}

.auth-form input {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #cbd7e8;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
}

.auth-button {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.auth-button.secondary {
  background: var(--brand-dark);
}

.auth-button.ghost {
  width: auto;
  padding: 0 14px;
  background: #eef3f9;
  color: var(--ink);
}

.auth-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-message {
  min-height: 18px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-message.success {
  color: #087847;
}

.auth-message.error {
  color: #b91c1c;
}

.hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .topbar-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .auth-forms {
    grid-template-columns: 1fr;
  }
}

.redaction-box {
  position: absolute;
  display: block;
  background: #000 !important;
  border: 2px solid #000 !important;
  z-index: 50;
  pointer-events: none;
  opacity: 1 !important;
}

.preview-page {
  position: relative;
}

.preview-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}
