:root {
  --ink: #142235;
  --paper: #eef3f8;
  --line: #d5dde7;
  --accent: #073b74;
  --accent-2: #0e5f52;
  --accent-soft: #e8f2f8;
  --yellow: #ffe600;
  --bad: #b3432b;
  --bad-soft: #fbe9e4;
  --warn: #946200;
  --warn-soft: #fdf3dd;
  --ok: #2f6b3a;
  --ok-soft: #e9f3ea;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  color-scheme: light;
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}

button,
select,
input { font: inherit; }

.wrap {
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: 28px 24px 80px;
}

.top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--ink);
}

.brand-link {
  display: inline-block;
  margin-bottom: 14px;
}

.brand-link img {
  display: block;
  width: min(100%, 250px);
  height: auto;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

h1 {
  margin: 0;
  font-size: clamp(22px, 4vw, 30px);
  line-height: 1.2;
}

.top p {
  margin: 7px 0 0;
  color: #657287;
  font-size: 13px;
}

.top .creator-credit {
  display: inline-flex;
  margin-top: 11px;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--yellow);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .02em;
}

.branch-badge {
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--yellow);
  font-size: 12px;
  font-weight: 900;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex: none;
}

.top-actions a {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--accent);
  background: #fff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.step { margin-bottom: 28px; }

.step-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  color: #657287;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.step-label span {
  display: inline-flex;
  width: 21px;
  height: 21px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  background: var(--ink);
  font-size: 11px;
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.dropzone {
  position: relative;
  min-height: 154px;
  padding: 22px;
  border: 1.5px dashed #acbac9;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}

.dropzone:hover,
.dropzone.drag,
.dropzone:focus-visible {
  border-color: var(--accent-2);
  background: #f1f8f6;
  outline: none;
  transform: translateY(-1px);
}

.dropzone h2 {
  margin: 0 0 5px;
  font-size: 16px;
}

.dropzone p {
  margin: 0;
  color: #657287;
  font-size: 12px;
}

.dropzone input[type="file"] { display: none; }

.status-icon {
  position: absolute;
  top: 17px;
  right: 18px;
}

.filename {
  min-height: 18px;
  margin-top: 12px;
  color: var(--accent-2);
  font-family: var(--mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.sheet-picker {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  font-size: 12px;
}

.sheet-picker[hidden] { display: none; }

.sheet-picker select {
  min-width: 140px;
  max-width: 260px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.run-options {
  margin-top: 14px;
  color: #59677b;
  font-size: 12px;
}

.run-options label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.run-btn,
.export-btn {
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 900;
}

.run-btn {
  margin-top: 14px;
  padding: 12px 24px;
  color: #fff;
  background: var(--ink);
}

.run-btn:not(:disabled):hover { background: var(--accent-2); }

.run-btn:disabled {
  color: #f2f2f2;
  background: #aeb9c5;
  cursor: not-allowed;
}

.hint {
  min-height: 20px;
  margin-top: 8px;
  color: var(--bad);
  font-size: 12px;
  white-space: pre-line;
}

#results {
  margin-top: 34px;
}

#results[hidden] { display: none; }

.summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(105px, 1fr));
  gap: 10px;
  margin: 0 0 22px;
}

.card {
  min-width: 0;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.card .count {
  font-family: var(--mono);
  font-size: 23px;
  font-weight: 900;
}

.card .label {
  margin-top: 2px;
  color: #657287;
  font-size: 11px;
}

.card.ok .count { color: var(--ok); }
.card.bad .count { color: var(--bad); }
.card.warn .count { color: var(--warn); }

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

.filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filters button {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-size: 12px;
}

.filters button.active {
  border-color: var(--ink);
  color: #fff;
  background: var(--ink);
}

.export-btn {
  flex: none;
  padding: 9px 14px;
  color: #fff;
  background: var(--accent);
  font-size: 12px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  padding: 10px 9px;
  border-bottom: 1px solid #e6ebf0;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  color: #4d5e73;
  background: #f5f7fa;
  font-size: 11px;
}

td.note {
  min-width: 300px;
  max-width: 430px;
  white-space: normal;
}

.num {
  font-family: var(--mono);
  text-align: right;
}

.diff-pos { color: var(--bad); }
.diff-neg { color: #2454a6; }

.badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.badge.ok { color: var(--ok); background: var(--ok-soft); }
.badge.bad { color: var(--bad); background: var(--bad-soft); }
.badge.warn { color: var(--warn); background: var(--warn-soft); }
.badge.pending { color: #5f4b8b; background: #eee9f8; }

.copy-button {
  display: inline-flex;
  margin-top: 7px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent);
  background: #fff;
  cursor: pointer;
  font-size: 11px;
}

.empty-state {
  padding: 48px 20px;
  color: #748195;
  text-align: center;
}

.empty-state[hidden] { display: none; }

footer {
  margin-top: 34px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: #7b8798;
  font-size: 11px;
}

footer p { margin: 3px 0; }

@media (max-width: 920px) {
  .summary { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 720px) {
  .wrap { padding: 20px 15px 60px; }
  .top { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; }
  .top-actions a { flex: 1; text-align: center; }
  .upload-grid { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .export-btn { width: 100%; }
}

@media (max-width: 470px) {
  .summary { grid-template-columns: repeat(2, 1fr); }
}
