:root {
  --navy: #101939;
  --accent: #38469a;
  --line: #e2e5ec;
  --bg: #f5f6f8;
  --muted: #6b7280;
  --warn-bg: #fff7ed;
  --warn-line: #fdba74;
  --warn-text: #9a3412;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--navy);
  font: 14px/1.5 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}
header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 20px 24px;
}
header h1 { margin: 0; font-size: 17px; letter-spacing: -0.2px; }
header p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }

main {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 24px;
  max-width: 1400px;
}
@media (max-width: 900px) {
  main { grid-template-columns: 1fr; }
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
}
.panel h2 {
  margin: 0 0 16px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-head h2 { margin: 0; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.segmented {
  display: inline-flex;
  margin: 0;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
}
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; width: 0; height: 0; }
.segmented span {
  display: block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.segmented input:checked + span { background: #fff; color: var(--navy); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.field { margin-bottom: 14px; }
.field > label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}
.field input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d6d9e0;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
}
.field input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 70, 154, 0.12);
}
.field .hint { margin-top: 5px; font-size: 11px; color: var(--muted); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  cursor: pointer;
}

.entries { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.entry-rows { display: flex; flex-direction: column; gap: 6px; width: 100%; }
/* 패널 폭에 따라 칸이 접힌다. 좁으면 주소가 한 줄을 통째로 차지한다. */
.entry-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.entry-row input[type="text"] { width: auto; min-width: 0; }
.entry-row [data-part="label"] { flex: 1 1 110px; }
.entry-row [data-part="address"] { flex: 3 1 220px; }
.entry-row [data-part="phone"] { flex: 1 1 130px; }
.entry-row .entry-remove,
.entries .entry-add { padding: 6px 10px; font-size: 12px; font-weight: 500; }
.entry-row .entry-remove { background: #fff; color: var(--muted); border-color: #d6d9e0; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
button {
  padding: 9px 14px;
  border: 1px solid var(--navy);
  border-radius: 6px;
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
button.secondary { background: #fff; color: var(--navy); }
button:hover { opacity: 0.88; }

.status {
  min-height: 18px;
  margin-top: 10px;
  font-size: 12px;
  color: #15803d;
}
.status[data-tone="error"] { color: #b91c1c; }

.notice {
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid var(--warn-line);
  border-radius: 6px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 12px;
  line-height: 1.6;
}
.notice[data-tone="info"] {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1e40af;
}
.notice[hidden] { display: none; }
.notice code {
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.06);
  font-size: 11px;
}

#preview {
  display: block;
  width: 100%;
  height: 440px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
#preview[data-theme="dark"] { background: #2b2b2b; }
.scroll-note { margin: 8px 0 0; font-size: 11px; color: var(--muted); }

details { margin-top: 16px; }
details summary { font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
textarea {
  width: 100%;
  height: 200px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: vertical;
}
