@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;600;700;800&display=swap');

:root {
  --bg:     #FFFFFF;
  --panel:  #FFFFFF;
  --border: #E4E4E7;
  --border2:#D4D4D8;

  --text:   #09090B;
  --sub:    #3F3F46;
  --muted:  #71717A;
  --hint:   #A1A1AA;

  --blue:      #2563EB;
  --blue-h:    #1D4ED8;
  --blue-soft: #EFF6FF;
  --blue-mid:  #BFDBFE;

  --green:     #16A34A;
  --green-soft:#F0FDF4;
  --green-mid: #BBF7D0;

  --red-soft:  #FEF2F2;
  --red-mid:   #FECACA;

  --r:  12px;
  --r2: 8px;
  --max: 1400px;

  --s1: 0 1px 4px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --s2: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --s3: 0 10px 24px rgba(0,0,0,.09);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17px; }
body {
  font-family: "Noto Sans KR", system-ui, sans-serif;
  background: #FFFFFF; color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  color-scheme: light;
  line-height: 1.5;
}
button { font: inherit; cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
input, textarea, select { font: inherit; color-scheme: light; }

.app { max-width: var(--max); margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

/* ── Header ── */
.header {
  height: 76px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 40px; gap: 0;
  position: sticky; top: 0; z-index: 50;
}
.header__logo { display: flex; align-items: center; gap: 10px; margin-right: 36px; }
.header__logo img { height: 40px; width: auto; }
.header__logo-sep { width: 1px; height: 20px; background: var(--border); margin: 0 14px; }
.header__logo-name { font-size: 18px; font-weight: 700; color: var(--sub); }
.header__nav { display: flex; align-items: center; gap: 2px; flex: 1; }
.header__nav-link {
  font-size: 17px; font-weight: 500; color: var(--muted);
  padding: 8px 16px; border-radius: var(--r2);
  transition: background .12s, color .12s;
}
.header__nav-link:hover { background: #FFFFFF; color: var(--text); }
.header__nav-link.active { background: #FFFFFF; color: var(--text); font-weight: 700; border-radius: var(--r2); }
.header__right { margin-left: auto; }
.header__badge {
  font-size: 16px; font-weight: 500; color: var(--muted);
  padding: 8px 18px; border: 1px solid var(--border);
  border-radius: var(--r2); background: var(--panel);
  transition: all .12s;
}
.header__badge:hover { border-color: var(--border2); color: var(--sub); background: #F0F0F2; }

/* ── Page ── */
.page { flex: 1; padding: 48px 40px 80px; display: flex; flex-direction: column; gap: 32px; }

.page-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.page-title { font-size: 36px; font-weight: 800; color: var(--text); letter-spacing: -.025em; }
.page-subtitle { font-size: 17px; color: var(--muted); margin-top: 8px; }
.issue-chip {
  padding: 18px 28px; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--s1); flex-shrink: 0; text-align: right;
}
.issue-chip__label { font-size: 13px; font-weight: 700; color: var(--hint); letter-spacing: .08em; text-transform: uppercase; }
.issue-chip__val { font-size: 30px; font-weight: 800; color: var(--text); letter-spacing: -.03em; margin-top: 3px; }

/* ── Steps ── */
.steps {
  display: flex; align-items: stretch;
  border: 1px solid var(--border); border-radius: var(--r);
  background: #F6F6F8; overflow: hidden;
}
.step {
  display: flex; align-items: center; gap: 14px;
  flex: 1; padding: 20px 28px;
  border-right: 1px solid var(--border);
  transition: background .15s;
}
.step:last-child { border-right: none; }
.step__n {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg); border: 1.5px solid var(--border2);
  font-size: 15px; font-weight: 700; color: var(--hint);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: all .2s;
}
.step__label { font-size: 17px; font-weight: 500; color: var(--muted); }
.step.active { background: #EFF6FF; }
.step.active .step__n { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.step.active .step__label { color: var(--blue); font-weight: 700; }
.step.done .step__n { background: var(--green-soft); border-color: var(--green-mid); color: var(--green); }
.step.done .step__label { color: var(--green); }

/* ── Grid ── */
.grid { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.section { display: flex; flex-direction: column; gap: 20px; }

/* ── Alert ── */
.alert { padding: 14px 18px; border-radius: var(--r2); font-size: 15px; border: 1px solid transparent; }
.alert--error   { background: var(--red-soft);   border-color: var(--red-mid);   color: #B91C1C; }
.alert--success { background: var(--green-soft);  border-color: var(--green-mid); color: #166534; }
.alert--info    { background: var(--blue-soft);   border-color: var(--blue-mid);  color: #1D4ED8; }

/* ── Card ── */
.card {
  background: #FAFAFA; border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden;
  transition: border-color .15s;
}
.card:hover { border-color: var(--border2); background: #F5F5F7; }

.card-title {
  padding: 22px 28px;
  display: flex; align-items: center; gap: 14px;
  background: transparent;
}
.card-title h2 { font-size: 20px; font-weight: 700; color: var(--text); }
.card-title p  { font-size: 16px; color: var(--muted); margin-top: 3px; }
.card-title__icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--blue-soft); color: var(--blue);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.card-title__icon svg { width: 22px; height: 22px; }
.card-title__icon--green { background: var(--green-soft); color: var(--green); }
.card-title__icon--eye { background: var(--blue-soft); color: var(--blue); }

.card-divider { border-top: 1px solid var(--border); }
.card-body { padding: 24px 28px 32px; }

/* ── Form ── */
.field { display: flex; flex-direction: column; gap: 7px; }
.field + .field { margin-top: 20px; }
.field label { font-size: 15px; font-weight: 600; color: var(--sub); }
.field label .opt { font-weight: 400; color: var(--hint); margin-left: 6px; font-size: 14.5px; }

.input, .textarea {
  width: 100%;
  padding: 13px 16px;
  background: #FFFFFF !important;
  border: 1px solid var(--border);
  border-radius: var(--r2);
  color: #09090B !important;
  outline: none;
  font-size: 16px;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  color-scheme: light;
}
.textarea {
  min-height: 148px; resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px; line-height: 1.7;
}
.input::placeholder, .textarea::placeholder { color: #A1A1AA; }
.input:hover, .textarea:hover { border-color: var(--border2); }
.input:focus, .textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

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

.form-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 24px; padding-top: 24px;
  border-top: 1px solid var(--border); gap: 14px; flex-wrap: wrap;
}
.check-wrap {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; color: var(--muted); cursor: pointer;
}
.check-wrap input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--blue); cursor: pointer; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; border-radius: var(--r2); font-weight: 600;
  transition: all .15s; white-space: nowrap; cursor: pointer;
  font-size: 17px; padding: 13px 28px;
}
.btn-primary {
  background: var(--blue); color: #fff;
  box-shadow: 0 1px 3px rgba(37,99,235,.3);
}
.btn-primary:hover:not(:disabled) { background: var(--blue-h); box-shadow: 0 3px 10px rgba(37,99,235,.35); transform: translateY(-1px); }
.btn-primary:active:not(:disabled) { transform: scale(.98); }
.btn-primary svg { width: 16px; height: 16px; opacity: .85; }
.btn-ghost {
  background: var(--panel); color: var(--sub);
  border: 1px solid var(--border); font-size: 16px; padding: 11px 20px;
}
.btn-ghost:hover { border-color: var(--border2); background: var(--bg); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-row { display: flex; gap: 8px; margin-left: auto; }
.btn--block { width: 100%; }
.btn--sm { font-size: 15px; padding: 10px 16px; }
.btn-send {
  background: var(--green); color: #fff;
  box-shadow: 0 1px 3px rgba(22,163,74,.3);
}
.btn-send:hover:not(:disabled) { background: #15803d; transform: translateY(-1px); }
.side-card--mail { border-color: var(--blue-mid); background: linear-gradient(180deg, #FAFCFF 0%, #FAFAFA 100%); }
.mail-from { display: flex; flex-direction: column; gap: 2px; }
.mail-from__label { font-size: 12px; font-weight: 600; color: var(--hint); text-transform: uppercase; letter-spacing: .04em; }
.mail-from__addr { font-size: 15px; font-weight: 600; color: var(--sub); word-break: break-all; }
.mail-hint { font-size: 14px; color: var(--muted); line-height: 1.5; margin: 4px 0 8px; }
.cnt-pill--warn { color: #b45309; background: #fffbeb; border-color: #fde68a; }
.cnt-pill--ok { color: var(--green); background: var(--green-soft); border-color: var(--green-mid); }

/* ── Preview ── */
.preview-header {
  padding: 22px 28px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
}
.preview-header h2 { font-size: 20px; font-weight: 700; color: var(--text); }
.preview-wrap {
  min-height: 480px; display: flex; align-items: center; justify-content: center;
  background: #F8F8FA;
  background-image: radial-gradient(var(--border) 1px, transparent 0);
  background-size: 20px 20px;
  padding: 32px;
}
.preview-empty { text-align: center; max-width: 220px; }
.preview-icon {
  width: 60px; height: 60px; margin: 0 auto 18px;
  border-radius: 16px; background: var(--panel);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--hint); box-shadow: var(--s1);
}
.preview-icon svg { width: 28px; height: 28px; }
.preview-empty p { font-size: 16px; color: var(--muted); line-height: 1.65; }
.preview-frame { width: 100%; height: 560px; border: 0; border-radius: var(--r2); box-shadow: var(--s3); }
.preview-wrap.active { align-items: stretch; }

/* ── Result ── */
.result-list { list-style: none; display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }
.result-list li { font-size: 14px; color: var(--muted); padding: 9px 13px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r2); word-break: break-all; }
.meta { margin-top: 10px; font-size: 14px; color: var(--hint); }
.badge { display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 999px; border: 1px solid transparent; }
.badge-ok { background: var(--green-soft); color: var(--green); border-color: var(--green-mid); }

/* ── Sidebar ── */
.sidebar { display: flex; flex-direction: column; gap: 16px; }
.side-card { background: #FAFAFA; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.side-card-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.side-card-title { font-size: 16px; font-weight: 700; color: var(--sub); }
.side-card-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.cnt-pill { font-size: 14px; font-weight: 600; color: var(--blue); background: var(--blue-soft); border: 1px solid var(--blue-mid); padding: 3px 10px; border-radius: 999px; }

.flow-item { display: flex; align-items: flex-start; gap: 12px; }
.flow-n { width: 26px; height: 26px; border-radius: 50%; background: var(--bg); border: 1.5px solid var(--border2); font-size: 12.5px; font-weight: 700; color: var(--muted); display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
.flow-text { font-size: 16px; color: var(--muted); line-height: 1.5; }
.flow-text b { color: var(--sub); font-weight: 700; }

.url-list { list-style: none; }
.url-list li { font-size: 14px; color: var(--muted); padding: 12px 22px; border-bottom: 1px solid var(--border); word-break: break-all; line-height: 1.5; }
.url-list li:last-child { border-bottom: none; }
.url-list .empty { text-align: center; color: var(--hint); padding: 24px; font-size: 15px; }

/* Spinner */
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 960px) {
  .grid { grid-template-columns: 1fr; }
  .sidebar { order: -1; }
}
/* ── View panels ── */
#viewCreate, #viewRecipients { display: block; }
#viewRecipients[hidden], #viewCreate[hidden] { display: none !important; }

/* ── Recipients editor ── */
.recipient-editor { padding-top: 0 !important; }
.recipient-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r2);
}
.recipient-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.recipient-table thead th {
  text-align: left;
  padding: 12px 14px;
  background: #F8F8FA;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.recipient-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.recipient-table tr:last-child td { border-bottom: none; }
.recipient-table .col-check { width: 56px; text-align: center; }
.recipient-table .col-act { width: 48px; }
.recipient-table input[type="text"],
.recipient-table input[type="email"] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--r2);
  font-size: 14px;
}
.recipient-table input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(37,99,235,.1);
  outline: none;
}
.recipient-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
  cursor: pointer;
}
.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r2);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { background: var(--red-soft); color: #B91C1C; border-color: var(--red-mid); }
.recipient-empty {
  text-align: center;
  padding: 28px;
  color: var(--hint);
  font-size: 15px;
}
.card-title code {
  font-size: 13px;
  background: #F0F0F2;
  padding: 2px 6px;
  border-radius: 4px;
}

@media (max-width: 640px) {
  .page { padding: 24px 16px 40px; }
  .header { padding: 0 16px; height: 60px; }
  .page-title { font-size: 22px; }
  .header__nav-link { font-size: 14px; padding: 6px 10px; }
  .form-foot { flex-direction: column; align-items: stretch; }
  .btn-primary { width: 100%; justify-content: center; }
}
