:root {
  --bg: #f3efe6;
  --ink: #1c2420;
  --muted: #5d6a63;
  --panel: #fffdf8;
  --line: #d7d0c3;
  --accent: #0f6b5c;
  --accent-ink: #f7fffc;
  --warn: #9a5b00;
  --danger: #8b2e2e;
  --ok: #1f6b3a;
  --shadow: 0 10px 30px rgba(28, 36, 32, 0.08);
  --radius: 14px;
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #e7f2ee 0, transparent 28%),
    linear-gradient(180deg, #efe8da, var(--bg));
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand a {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.brand .sub {
  margin-left: 0.75rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.meta { color: var(--muted); font-size: 0.9rem; }

.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.panel-head.tight { margin-bottom: 0.75rem; align-items: center; }
.panel-head h1, .card h2 { margin: 0.2rem 0; letter-spacing: -0.03em; }
.muted { color: var(--muted); font-size: 0.92rem; }

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  cursor: pointer;
  font: inherit;
}
.btn:hover { border-color: #b9b1a2; }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn.link {
  border: 0;
  background: transparent;
  padding-left: 0;
  color: var(--accent);
}
.actions { display: flex; gap: 0.5rem; }

.card, .list > article, .queue article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card { padding: 1rem 1.1rem; margin-bottom: 1rem; }
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
}

.stack { display: grid; gap: 0.7rem; }
.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
label { display: grid; gap: 0.35rem; font-size: 0.92rem; }
label.check { display: flex; align-items: center; gap: 0.4rem; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  background: #fff;
}

.list { display: grid; gap: 0.7rem; }
.list.compact { max-height: 280px; overflow: auto; margin-top: 0.75rem; }
.list article, .queue article {
  padding: 0.9rem 1rem;
}
.list article {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}
.list article button { flex: 0 0 auto; }

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
}
.stat .n { font-size: 1.4rem; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 0.85rem; }

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  background: #f7f3ea;
}
.badge.unmapped { background: #f8e8e8; color: var(--danger); }
.badge.needs_review { background: #fff1d9; color: var(--warn); }
.badge.auto_suggested { background: #e7f2ee; color: var(--accent); }
.badge.confirmed { background: #e8f6ec; color: var(--ok); }

.queue { display: grid; gap: 0.7rem; }
.queue article {
  display: grid;
  grid-template-columns: 1.2fr 1.4fr auto;
  gap: 0.8rem;
  align-items: start;
}
@media (max-width: 900px) {
  .queue article { grid-template-columns: 1fr; }
}
.queue .target { color: var(--muted); font-size: 0.9rem; }
.log {
  background: #1c2420;
  color: #e8f2ec;
  border-radius: 10px;
  padding: 0.75rem;
  min-height: 3rem;
  overflow: auto;
  font-size: 0.82rem;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem;
  width: min(520px, calc(100vw - 2rem));
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(28, 36, 32, 0.35); }

.candidate {
  cursor: pointer;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.candidate:hover, .candidate.active {
  border-color: var(--accent);
  background: #eef7f4;
}
