:root {
  --bg: #f3f1eb;
  --panel: #fffcf7;
  --ink: #1c2430;
  --muted: #5d6672;
  --line: #d7d0c4;
  --accent: #0f5c4c;
  --accent-soft: #d8efe8;
  --warn: #8a4b12;
  --danger: #8b2e2e;
  --shadow: 0 10px 30px rgba(28, 36, 48, 0.08);
  --font: "IBM Plex Sans KR", "Noto Sans KR", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, #e7f2ee 0%, transparent 40%),
    radial-gradient(circle at 90% 10%, #f7e8d8 0%, transparent 35%),
    var(--bg);
  min-height: 100vh;
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

header.app-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 22px;
}
header h1 {
  margin: 0 0 6px;
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}
header p {
  margin: 0;
  color: var(--muted);
  max-width: 62ch;
  line-height: 1.5;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 0.85rem;
  color: var(--muted);
}
.badge i {
  width: 8px; height: 8px; border-radius: 50%;
  background: #1f9d6e; display: inline-block;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.tab {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
}
.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
}
@media (max-width: 960px) {
  .grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 70vh;
  overflow: auto;
}
.list button.customer {
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
}
.list button.customer.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.list .meta {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 4px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
input[type="text"], input[type="number"], textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 220px; resize: vertical; line-height: 1.45; }

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  cursor: pointer;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.danger {
  color: var(--danger);
  border-color: #e2b5b5;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.category {
  margin: 18px 0 8px;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.pattern {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
  background: #fff;
}
.pattern-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}
.pattern-head strong { display: block; }
.pattern-head .desc {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 4px;
  line-height: 1.4;
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.switch input { width: auto; }

.value-box {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.value-box.disabled { opacity: 0.45; pointer-events: none; }
.inline-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
@media (max-width: 720px) {
  .inline-grid { grid-template-columns: 1fr 1fr; }
}

.hint {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}
label .req {
  color: var(--danger);
  margin-left: 2px;
  font-weight: 700;
}
input.required-empty {
  border-color: #d98989;
  background: #fff7f7;
}
.evidence {
  margin-top: 8px;
  padding: 8px 10px;
  background: #f7f3ea;
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--warn);
  white-space: pre-wrap;
}

.split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
}
@media (max-width: 960px) {
  .split { grid-template-columns: 1fr; }
}

.hidden { display: none !important; }
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #17352f;
  color: #fff;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: .2s ease;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translateY(0); }
