/* ──────────────────────────────────────────────────────────
   바른인증 인센티브 시뮬레이터 — 모던 미니멀 톤
   Pretendard 가변폰트 + 큰 여백 + 둥근 모서리 + 차분한 그림자
   ────────────────────────────────────────────────────────── */
:root {
  --primary:        #2563eb;
  --primary-dark:   #1e3a8a;
  --primary-light:  #eff6ff;
  --bg:             #f8fafc;
  --card:           #ffffff;
  --text:           #0f172a;
  --text-2:         #334155;
  --muted:          #64748b;
  --border:         #e2e8f0;
  --border-strong:  #cbd5e1;
  --ok:             #16a34a;
  --ok-bg:          #dcfce7;
  --warn:           #d97706;
  --warn-bg:        #fef3c7;
  --err:            #dc2626;
  --err-bg:         #fee2e2;
  --info-bg:        #dbeafe;
  --shadow-sm:      0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow:         0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --radius:         12px;
  --radius-sm:      8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: "Pretendard Variable", Pretendard, -apple-system,
               BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 14px;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
small { font-size: 0.78rem; color: var(--muted); }

/* ── 헤더 ─────────────────────────────────────────── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.85);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.brand-logo { width: 28px; height: 28px; border-radius: 7px; }

.topbar nav { display: flex; gap: 18px; align-items: center; }
.topbar nav a {
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 500;
}
.topbar nav a:hover { color: var(--primary); text-decoration: none; }
.topbar .user {
  color: var(--muted);
  font-size: 0.82rem;
  padding: 3px 10px;
  background: var(--bg);
  border-radius: 999px;
}

.container {
  max-width: 1100px;
  margin: 28px auto;
  padding: 0 24px;
}
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 32px 0 40px;
}

/* ── 핵심 수치 위젯 그리드 ───────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.stat:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.stat-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}
.stat-sub {
  font-size: 0.82rem;
  color: var(--muted);
}

/* ── 카드 ─────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card h2 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}
.card-head .muted { font-size: 0.82rem; }
.muted { color: var(--muted); }

.divider {
  height: 1px;
  background: var(--border);
  margin: 20px -24px;
}

/* ── 자료 진행 체크리스트 ────────────────────────── */
.checklist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.check-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
}
.check-item.done {
  background: var(--ok-bg);
  border-color: #86efac;
}
.check-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--card);
  color: var(--muted);
  font-size: 0.85rem;
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
}
.check-item.done .check-mark {
  background: var(--ok);
  color: #fff;
  border-color: var(--ok);
  font-weight: 700;
}
.check-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 2px;
}
.check-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ── 폼 ──────────────────────────────────────────── */
.row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
}
.row .grow { flex: 1 1 200px; min-width: 0; }

input[type="text"], input[type="password"], select, input[type="file"] {
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input[type="file"] { padding: 7px 10px; }
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  background: #fff;
  border: 1px solid var(--border-strong);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
  letter-spacing: -0.01em;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

/* ── 테이블 ──────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.88rem;
}
.data-table th, .data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.data-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.data-table tbody tr:hover { background: var(--bg); }
.data-table small { color: var(--muted); font-size: 0.74rem; }
.data-table a { margin-right: 10px; }
.data-table.compact th, .data-table.compact td {
  padding: 7px 10px;
  font-size: 0.82rem;
}

.upload-history { margin-top: 18px; }
.upload-history summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 6px 0;
  user-select: none;
}
.upload-history summary:hover { color: var(--text); }

/* ── 상태 뱃지 ────────────────────────────────────── */
.status {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.status-ok      { background: var(--ok-bg);   color: var(--ok); }
.status-pending { background: var(--warn-bg); color: var(--warn); }
.status-running { background: var(--info-bg); color: var(--primary); }
.status-error   { background: var(--err-bg);  color: var(--err); }

/* ── 플래시 ──────────────────────────────────────── */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 0.88rem;
  font-weight: 500;
  border: 1px solid transparent;
}
.flash-success { background: var(--ok-bg);   color: var(--ok);    border-color: #86efac; }
.flash-error   { background: var(--err-bg);  color: var(--err);   border-color: #fca5a5; }
.flash-message { background: var(--info-bg); color: var(--primary); border-color: #93c5fd; }

/* ── 로그인 ──────────────────────────────────────── */
.login-card {
  max-width: 360px;
  margin: 100px auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow);
}
.login-card h1 {
  margin: 0 0 24px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}
.login-card button {
  margin-top: 10px;
  padding: 11px;
}
.login-card .hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 18px;
  text-align: center;
}
.login-card label.remember-row {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  margin-top: 4px;
  color: var(--text, #1f2937);
  cursor: pointer;
  user-select: none;
}
.login-card label.remember-row input[type=checkbox] {
  width: 16px; height: 16px; margin: 0;
  accent-color: #2563eb;
}

/* ── 결과 상세 ────────────────────────────────────── */
.kv {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 18px;
  margin: 18px 0;
  font-size: 0.88rem;
}
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; }
.actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ── 업로드 이력 행 (검토 결과 + 메모 + 삭제) ─────── */
.upload-row td { padding: 12px 12px; vertical-align: top; }
.upload-row .file-name {
  font-weight: 500;
  color: var(--text);
  word-break: break-all;
  max-width: 220px;
}
.upload-row.row-attention {
  background: #fffbeb;
}
.upload-row.row-attention:hover {
  background: #fef3c7;
}

.review-cell { max-width: 420px; }
.review-line {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-2);
  margin-bottom: 4px;
}
.flag-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 6px 0;
}
.flag-tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  background: var(--warn-bg);
  color: var(--warn);
  font-weight: 600;
  border: 1px solid #fcd34d;
}

.memo-edit {
  margin-top: 6px;
  font-size: 0.82rem;
}
.memo-edit summary {
  cursor: pointer;
  color: var(--primary);
  user-select: none;
  padding: 4px 0;
  display: inline-block;
}
.memo-edit summary:hover { text-decoration: underline; }
.memo-edit[open] summary { color: var(--text); font-weight: 600; }

.memo-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  padding: 10px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.memo-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.86rem;
  resize: vertical;
  min-height: 50px;
  background: #fff;
  color: var(--text);
}
.memo-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.memo-form button {
  align-self: flex-end;
  padding: 6px 14px;
  font-size: 0.82rem;
}

.actions-cell { white-space: nowrap; text-align: right; width: 60px; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
}
.btn-ghost:hover {
  background: var(--err-bg);
  color: var(--err);
  border-color: #fca5a5;
}

/* ── 결과 KPI / 성장목표 / 정합성 ──────────────────── */
.result-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.kpi-label { font-size: 0.78rem; color: var(--muted); margin-bottom: 6px; }
.kpi-value { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; }

.judge-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.judge {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
}
.judge-label { font-size: 0.84rem; color: var(--text-2); font-weight: 500; }
.judge-val { font-size: 0.84rem; font-weight: 600; }

.sub-head {
  font-size: 0.88rem;
  font-weight: 600;
  margin: 18px 0 4px;
  color: var(--text-2);
}

/* ── 강제 재계산 경고 박스 ─────────────────────────── */
.confirm-box {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.confirm-title { font-weight: 700; color: var(--warn); margin-bottom: 6px; }
.confirm-box p { margin: 4px 0; font-size: 0.86rem; }

.btn-danger {
  background: var(--err);
  border-color: var(--err);
  color: #fff;
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

/* ── 그래프 ───────────────────────────────────────── */
.chart-wrap {
  position: relative;
  height: 320px;
  margin-top: 8px;
}

/* ── 게이트율 비교 ────────────────────────────────── */
.compare-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 14px;
}
.compare-col {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.compare-col.highlight { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.12); }
.compare-col h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  text-align: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.compare-metric {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.85rem;
  border-bottom: 1px dashed var(--border);
}
.compare-metric .m-label { color: var(--muted); }
.compare-metric .m-value { font-weight: 600; }

/* ── 변동 표시 ────────────────────────────────────── */
.delta-up { color: var(--ok); font-weight: 600; }
.delta-down { color: var(--err); font-weight: 600; }

/* ── 개인별 명세서 ────────────────────────────────── */
.payslip {
  max-width: 620px;
  margin: 16px auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 36px;
  box-shadow: var(--shadow);
}
.payslip-head {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 16px;
  margin-bottom: 20px;
}
.payslip-logo {
  width: 44px; height: 44px;
  background: linear-gradient(180deg, #1e3a8a, #2563eb);
  color: #fff;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 800;
}
.payslip-title { font-size: 1.15rem; font-weight: 700; }
.payslip-period { font-size: 0.85rem; color: var(--muted); }
.payslip-name {
  font-size: 1.05rem;
  margin-bottom: 16px;
}
.payslip-name span { font-size: 0.85rem; color: var(--muted); }

.payslip-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.payslip-table th, .payslip-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.payslip-table .amt { text-align: right; font-variant-numeric: tabular-nums; }
.payslip-table .deduct th, .payslip-table .deduct td { color: var(--muted); }
.payslip-table .subtotal th, .payslip-table .subtotal td {
  font-weight: 600; background: var(--bg);
}
.payslip-table .total th, .payslip-table .total td {
  font-weight: 700;
  font-size: 1.05rem;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-bottom: 2px solid var(--primary);
}
.payslip-foot {
  margin-top: 18px;
  font-size: 0.76rem;
  color: var(--muted);
}
.payslip-foot p { margin: 3px 0; }

/* ── 연간 종합 리포트 ─────────────────────────────── */
.report {
  max-width: 760px;
  margin: 16px auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 40px;
  box-shadow: var(--shadow);
}
.report-head {
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 16px;
  margin-bottom: 8px;
}
.report-title { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; }
.report-sub { font-size: 0.85rem; color: var(--muted); }
.report-section {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 22px 0 8px;
  color: var(--primary-dark);
}
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.report-table th, .report-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.report-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--muted);
  font-size: 0.78rem;
}
.report-table .amt { text-align: right; font-variant-numeric: tabular-nums; }
.report-table .strong { font-weight: 700; color: var(--text); }
.report-table .judge-cell { font-weight: 600; }
.report-foot {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.76rem;
  color: var(--muted);
}
.report-foot p { margin: 3px 0; }

/* ── 매뉴얼 ───────────────────────────────────────── */
.manual-list { padding-left: 22px; font-size: 0.9rem; line-height: 1.8; }
.manual-list li { margin: 2px 0; }
.manual-list code, .manual-block code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.84rem;
  font-family: "Consolas", "Menlo", monospace;
}
.manual-block {
  margin: 22px 0;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.manual-block:last-child { border-bottom: none; }
.manual-block h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
}
.manual-block p { margin: 8px 0; font-size: 0.9rem; }
.manual-block ul {
  margin: 4px 0 8px;
  padding-left: 22px;
  font-size: 0.88rem;
  line-height: 1.7;
}
.manual-block ul li { margin: 2px 0; }

.critical {
  color: var(--err);
  font-weight: 700;
}

.example-good {
  background: #f0fdf4;
  border-left: 4px solid var(--ok);
  padding: 12px 16px;
  margin: 10px 0;
  border-radius: 6px;
}
.example-good strong { color: var(--ok); }
.example-good ul, .example-bad ul { margin: 6px 0 0; padding-left: 18px; }

.example-bad {
  background: #fef2f2;
  border-left: 4px solid var(--err);
  padding: 12px 16px;
  margin: 10px 0;
  border-radius: 6px;
}
.example-bad strong { color: var(--err); }

.manual-faq dt {
  font-weight: 600;
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--text);
}
.manual-faq dd {
  margin: 4px 0 0 12px;
  font-size: 0.88rem;
  color: var(--text-2);
}

/* ── 인쇄 ─────────────────────────────────────────── */
@media print {
  .topbar, .footer, .no-print { display: none !important; }
  body { background: #fff; }
  .container { margin: 0; padding: 0; max-width: none; }
  .payslip {
    border: none;
    box-shadow: none;
    margin: 0;
    max-width: none;
    page-break-after: always;
  }
  .payslip:last-child { page-break-after: auto; }
  .report {
    border: none;
    box-shadow: none;
    margin: 0;
    max-width: none;
  }
}

/* ── 화면 폭이 좁을 때 ───────────────────────────── */
@media (max-width: 720px) {
  .container { padding: 0 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .checklist { grid-template-columns: 1fr; }
  .compare-grid { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  .topbar nav { gap: 12px; }
  .card { padding: 16px 18px; }
  .upload-row .file-name { max-width: 140px; }
  .review-cell { max-width: 220px; }
  .chart-wrap { height: 260px; }
}
