/* 연세올데이치과 환자경험 설문 — 공통 + 설문 + 관리자 */
:root {
  --navy: #16324f;
  --navy-2: #0f2438;
  --blue: #2f6df0;
  --blue-soft: #eef3ff;
  --ink: #1c2530;
  --muted: #6b7787;
  --line: #e6eaf0;
  --bg: #f6f8fb;
  --card: #ffffff;
  --good: #1f8a5b;
  --bad: #d1493f;
  --warn: #b7791f;
  --shadow: 0 1px 2px rgba(16, 40, 70, .04), 0 8px 24px rgba(16, 40, 70, .06);
  --radius: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Malgun Gothic", "맑은 고딕", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
a { color: var(--blue); }

/* ───────────── 환자 설문 ───────────── */
.survey-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 40px;
  background:
    radial-gradient(1200px 400px at 50% -140px, #ffffff, transparent),
    var(--bg);
}
.survey-card {
  width: 100%;
  max-width: 460px;
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 30px 24px 28px;
  animation: rise .35s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; }
.brand img { height: 40px; width: auto; }
.brand .brand-fallback {
  font-weight: 800; letter-spacing: -.4px; color: var(--navy); font-size: 18px;
}
.brand small { color: var(--muted); font-size: 12px; letter-spacing: .3px; }

.progress { display: flex; gap: 7px; justify-content: center; margin-bottom: 20px; }
.progress i { width: 26px; height: 4px; border-radius: 4px; background: var(--line); transition: background .3s; }
.progress i.on { background: var(--blue); }
.progress i.done { background: var(--navy); }

.q { font-size: 21px; font-weight: 800; letter-spacing: -.5px; text-align: center; margin: 4px 0 6px; }
.q-sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 22px; }

.ratings { display: flex; flex-direction: column; gap: 10px; }
.rating-btn {
  display: flex; align-items: center; gap: 14px;
  border: 1.5px solid var(--line); background: #fff;
  border-radius: 14px; padding: 15px 16px; width: 100%;
  transition: transform .12s, border-color .15s, background .15s;
}
.rating-btn:active { transform: scale(.98); }
.rating-btn .face { width: 30px; height: 30px; flex: none; color: var(--muted); }
.rating-btn .label { font-weight: 700; font-size: 16px; }
.rating-btn[data-score="1"]:hover, .rating-btn[data-score="2"]:hover { border-color: var(--bad); }
.rating-btn[data-score="4"]:hover, .rating-btn[data-score="5"]:hover { border-color: var(--good); }
.rating-btn.sel { border-color: var(--navy); background: var(--blue-soft); }

.chips { display: flex; flex-direction: column; gap: 9px; margin-bottom: 6px; }
.chip {
  display: flex; align-items: center; gap: 11px;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 13px 14px; background: #fff;
  font-size: 15px; transition: border-color .15s, background .15s;
}
.chip .box {
  width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line);
  flex: none; display: grid; place-items: center; color: #fff;
}
.chip.on { border-color: var(--blue); background: var(--blue-soft); }
.chip.on .box { background: var(--blue); border-color: var(--blue); }

textarea, .ta {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 13px 14px;
  font: inherit; resize: vertical; min-height: 92px; margin-top: 12px; background: #fff; color: var(--ink);
}
textarea:focus { outline: none; border-color: var(--blue); }

.btn {
  width: 100%; border: none; border-radius: 14px; padding: 16px; font-weight: 800; font-size: 16px;
  background: var(--navy); color: #fff; margin-top: 18px; transition: transform .12s, opacity .15s;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .55; }
.btn.blue { background: var(--blue); }
.btn.big { padding: 18px; font-size: 17px; }
.btn.ghost { background: #fff; color: var(--navy); border: 1.5px solid var(--line); }

.done-mark { width: 56px; height: 56px; margin: 6px auto 14px; display: grid; place-items: center;
  background: #e9f6ef; color: var(--good); border-radius: 50%; }
.done-title { text-align: center; font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.done-text { text-align: center; color: var(--muted); font-size: 14.5px; margin-bottom: 18px; }

.review-emo {
  background: linear-gradient(135deg, #f2f7ff, #eef3ff);
  border: 1px solid #dfe8fb; border-radius: 14px; padding: 15px 16px; margin-bottom: 14px;
  font-size: 14.5px; color: #2b3d5c; text-align: center;
}
.draft-box {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 13px 14px; font-size: 14px;
  white-space: pre-wrap; background: #fafbfd; color: var(--ink); margin-bottom: 4px;
}
.small-link { display: block; text-align: center; color: var(--muted); font-size: 13px; margin: 10px 0; background: none; border: none; width: 100%; }

.refer {
  margin-top: 18px; border: 1px dashed var(--line); border-radius: 14px; overflow: hidden;
}
.refer summary {
  list-style: none; cursor: pointer; padding: 13px 15px; font-weight: 700; font-size: 14px;
  color: var(--navy); background: #fbfcfe; display: flex; align-items: center; gap: 8px;
}
.refer summary::-webkit-details-marker { display: none; }
.refer .refer-body { padding: 4px 16px 16px; font-size: 13.5px; color: var(--muted); }
.refer .refer-body b { color: var(--ink); }

.notice { text-align: center; color: var(--bad); font-size: 13.5px; margin-top: 12px; }
.foot { text-align: center; color: #9aa5b3; font-size: 11.5px; margin-top: 22px; }
.hidden { display: none !important; }

/* ───────────── 관리자 ───────────── */
.admin { min-height: 100dvh; background: var(--bg); }
.admin-top {
  background: var(--navy); color: #fff; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 20;
}
.admin-top .t { font-weight: 800; letter-spacing: -.3px; display: flex; align-items: center; gap: 10px; }
.admin-top .t small { font-weight: 500; opacity: .7; font-size: 12px; }
.admin-top button { background: rgba(255,255,255,.14); color: #fff; border: none; border-radius: 9px; padding: 8px 12px; font-size: 13px; font-weight: 600; }
.admin-top .top-link { color: #fff; text-decoration: none; font-size: 13px; font-weight: 600; background: rgba(255,255,255,.14); border-radius: 9px; padding: 8px 12px; display: inline-block; }
.admin-wrap { max-width: 1080px; margin: 0 auto; padding: 20px; }

.login-box { max-width: 360px; margin: 12vh auto; background: #fff; border-radius: 18px; box-shadow: var(--shadow); padding: 30px 26px; }
.login-box h1 { font-size: 18px; margin: 0 0 4px; color: var(--navy); }
.login-box p { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.field input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 12px; font: inherit; background: #fff; color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--blue); }

.filters {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 18px;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
}
.filters .seg { display: flex; background: var(--bg); border-radius: 10px; padding: 3px; }
.filters .seg button { border: none; background: none; padding: 7px 13px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.filters .seg button.on { background: var(--navy); color: #fff; }
.filters select, .filters input[type=text] {
  border: 1.5px solid var(--line); border-radius: 9px; padding: 8px 10px; font: inherit; background: #fff; color: var(--ink);
}
.filters .fx { display: flex; flex-direction: column; gap: 4px; }
.filters .fx span { font-size: 11px; color: var(--muted); font-weight: 700; }
.filters button.apply { background: var(--blue); color: #fff; border: none; border-radius: 9px; padding: 9px 16px; font-weight: 700; font-size: 13px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.kpi.dark { background: var(--navy); color: #fff; }
.kpi .kv { font-size: 24px; font-weight: 800; letter-spacing: -.5px; margin-top: 4px; }
.kpi .kl { font-size: 12px; color: var(--muted); font-weight: 700; }
.kpi.dark .kl { color: rgba(255,255,255,.7); }

.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.panel h2 { font-size: 15px; margin: 0 0 4px; }
.panel .hint { font-size: 12px; color: var(--muted); margin: 0 0 14px; }
.warn-badge { display: inline-block; background: #fdf3e3; color: var(--warn); font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; margin-left: 8px; }

.dist-row { display: flex; align-items: center; gap: 12px; margin: 7px 0; font-size: 13px; }
.dist-row .dl { width: 72px; color: var(--muted); font-weight: 600; flex: none; }
.dist-row .track { flex: 1; height: 10px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.dist-row .fill { display: block; height: 100%; min-width: 2px; border-radius: 6px; background: var(--blue); }
.dist-row.neg .fill { background: var(--bad); }
.dist-row .dn { width: 88px; text-align: right; color: var(--ink); flex: none; font-variant-numeric: tabular-nums; }

table.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
table.mini th, table.mini td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.mini th { color: var(--muted); font-size: 11px; font-weight: 700; }
table.mini td.num { text-align: right; font-variant-numeric: tabular-nums; }

.tag-list { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.tag { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font-size: 12.5px; font-weight: 600; }
.tag b { color: var(--blue); margin-left: 4px; }
.cat-block { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.cat-block .cat-head { display: flex; justify-content: space-between; font-weight: 700; font-size: 13.5px; margin-bottom: 8px; }
.cat-block .q-line { font-size: 13px; color: var(--muted); padding: 4px 0; border-top: 1px dashed var(--line); }
.cat-block .q-line:first-of-type { border-top: none; }
.cat-block .q-line .sc { color: var(--ink); font-weight: 700; margin-right: 6px; }

.resp-row {
  border-bottom: 1px solid var(--line); padding: 12px 4px; display: grid;
  grid-template-columns: 92px 1fr auto; gap: 12px; align-items: start; font-size: 13.5px;
}
.resp-row .rs { font-weight: 800; }
.resp-row .rs.b { color: var(--bad); }
.resp-row .rs.g { color: var(--good); }
.resp-row .meta { color: var(--muted); font-size: 11.5px; }
.resp-row .rc { color: var(--ink); }
.resp-row .rc.dim { color: #b6bfca; }
.resp-row .rtags { margin-top: 3px; }
.resp-row .rtags em { font-style: normal; background: var(--bg); border-radius: 5px; padding: 1px 6px; font-size: 11px; color: var(--muted); margin-right: 4px; }
.resp-row .rr { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.resp-row .rr input[type=checkbox] { width: 16px; height: 16px; }
.fu {
  font-size: 11px; border: 1px solid var(--line); border-radius: 7px; padding: 4px 7px; background: #fff; color: var(--muted); font-weight: 600;
}
.fu.pending { background: #fdf3e3; color: var(--warn); border-color: #f0dfc0; }
.fu.contacted { background: var(--blue-soft); color: var(--blue); border-color: #cfdefb; }
.fu.resolved { background: #e9f6ef; color: var(--good); border-color: #c8e7d5; }

.pager { display: flex; justify-content: center; gap: 10px; align-items: center; margin-top: 14px; font-size: 13px; color: var(--muted); }
.pager button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 12px; }
.bulkbar { display: flex; gap: 10px; align-items: center; margin: 10px 0; font-size: 13px; }
.bulkbar button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 12px; font-weight: 600; }
.bulkbar button.danger { color: var(--bad); border-color: #f0cbc7; }

.modal-bg { position: fixed; inset: 0; background: rgba(15,30,50,.4); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 16px; padding: 22px; max-width: 380px; width: 100%; box-shadow: var(--shadow); }
.modal h3 { margin: 0 0 12px; font-size: 16px; }

.nav-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.nav-tabs button { border: none; background: #fff; border-radius: 10px; padding: 9px 15px; font-weight: 700; font-size: 13px; color: var(--muted); box-shadow: var(--shadow); }
.nav-tabs button.on { background: var(--navy); color: #fff; }

/* ── 관리자 대시보드 개편 (탭 분리 + < 월 > 네비) ── */
.pnav { display: flex; align-items: center; gap: 12px; }
.pnav b { font-size: 15px; font-weight: 800; letter-spacing: -.3px; min-width: 96px; text-align: center; }
.pnav button { border: 1.5px solid var(--line); background: #fff; color: var(--navy); width: 34px; height: 34px; border-radius: 9px; font-size: 18px; font-weight: 800; line-height: 1; display: grid; place-items: center; }
.pnav button:active { background: var(--bg); }
.pnav-label { font-size: 15px; font-weight: 800; }

.kpi .unit { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi.dark .unit { color: rgba(255,255,255,.6); }
.panel h2 .sub { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 6px; }
.foot-note { font-size: 11.5px; color: #9aa5b3; margin: 12px 0 0; line-height: 1.5; }
.empty { color: #9aa5b3; font-size: 13px; padding: 12px 4px; }

.alert-card { background: #fdecea; border: 1px solid #f4c9c3; border-radius: 12px; padding: 13px 15px; font-size: 13px; color: #8a2c22; margin-bottom: 16px; line-height: 1.55; }
.alert-card.soft { background: #f3f6fc; border-color: #d8e2f5; color: #35507e; }

.dist-row.neg .dl { color: var(--bad); }
.cat-block .q-line.neg { color: #a3382e; }
.cat-block .q-line.pos { color: #1f7a52; }
.negtag { font-style: normal; background: #fdecea; color: var(--bad); font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }

.list-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); font-weight: 700; padding: 2px 4px 8px; }
.del-sel { border: 1px solid #f0cbc7; background: #fff; color: var(--bad); border-radius: 8px; padding: 6px 12px; font-weight: 700; font-size: 12px; }

.resp-row em.sent { font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; margin-left: 6px; }
.resp-row em.sent.neg { background: #fdecea; color: var(--bad); }
.resp-row em.sent.pos { background: #e9f6ef; color: var(--good); }
.resp-row em.sent.neu { background: var(--bg); color: var(--muted); }

.modal .fu-quote { background: var(--bg); border-radius: 10px; padding: 11px 13px; font-size: 13px; color: var(--ink); margin-bottom: 14px; line-height: 1.5; }
.modal .modal-btns { display: flex; gap: 8px; margin-top: 16px; }
.modal .modal-btns .btn { margin-top: 0; }
.modal select, .modal textarea, .modal input { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; background: #fff; color: var(--ink); }
.modal .notice.hidden { display: none; }
.modal .notice { text-align: left; margin-top: 10px; }

@media (max-width: 640px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .admin-wrap { padding: 14px; }
  .resp-row { grid-template-columns: 70px 1fr; }
  .resp-row .rr { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: flex-end; }
  .filters { gap: 8px; }
  .pnav b { min-width: 78px; font-size: 14px; }
}
