:root {
  --blue: #2a64d6;
  --blue-weak: #e9f0fc;
  --ink: #1d2128;
  --ink-2: #4a515c;
  --ink-3: #7b828d;
  --line: #e3e6ea;
  --line-2: #cfd4da;
  --bg: #ffffff;
  --bg-2: #f6f7f9;
  --warn: #b4441c;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", "맑은 고딕", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.55;
  word-break: keep-all;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
.hidden { display: none !important; }

.demo-banner {
  background: #222831;
  color: #fff;
  text-align: center;
  font-size: 12.5px;
  padding: 5px 12px;
  letter-spacing: 0.01em;
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.logo-mark {
  width: 14px; height: 14px;
  border: 2px solid var(--blue);
  border-radius: 3px;
  position: relative;
}
.logo-mark::after {
  content: "";
  position: absolute;
  inset: 3px;
  background: var(--blue);
  border-radius: 1px;
}
.tabs { display: flex; gap: 2px; height: 100%; overflow-x: auto; }
.tab {
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 0;
  background: none;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  font-size: 14.5px;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--blue); font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-3); }
.topbar-right select { font-size: 13px; padding: 4px 6px; border: 1px solid var(--line-2); border-radius: 4px; background: #fff; }
.linkbtn { border: 0; background: none; color: var(--ink-3); cursor: pointer; font-size: 13px; padding: 4px; text-decoration: underline; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 20px 16px 48px; }
.narrow { max-width: 440px; }

h1 { font-size: 20px; margin: 4px 0 14px; font-weight: 700; }
h2 { font-size: 16px; margin: 0 0 10px; font-weight: 700; }
h3 { font-size: 14.5px; margin: 0 0 8px; font-weight: 600; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }

.notice {
  font-size: 13px;
  color: var(--ink-2);
  border-left: 3px solid var(--blue);
  padding: 4px 10px;
  margin: 0 0 16px;
  background: var(--bg-2);
}

.card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 14px;
  background: #fff;
}
.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card-head .right { margin-left: auto; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; }
.input, select.input, textarea.input {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  padding: 10px 12px;
  background: #fff;
  font-size: 15px;
}
.input:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue); }
.code-input { font-size: 22px; letter-spacing: 0.12em; text-align: center; text-transform: uppercase; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; padding: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 5px;
  border: 1px solid var(--line-2);
  background: #fff;
  cursor: pointer;
  font-size: 15px;
}
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.btn-primary:disabled { background: #9db6e6; border-color: #9db6e6; cursor: default; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-danger { color: var(--warn); border-color: #e2b8a8; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.msg { font-size: 13.5px; margin-top: 10px; min-height: 1.2em; }
.msg.err { color: var(--warn); }
.msg.ok { color: var(--blue); }

/* 요약 띠 */
.summary-line { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.type-band { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 16px; font-size: 13.5px; color: var(--ink-2); }
.type-band b { color: var(--ink); font-weight: 700; margin-left: 2px; }

/* 유형 점 */
.tdot { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tdot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; background: var(--ink-3); }
.t-hub::before { background: var(--blue); }
.t-task::before { background: #1b3f86; }
.t-emotional::before { background: #8fb0ea; }
.t-balanced::before { background: #b9bec6; }
.t-independent::before { background: #5c636d; }
.t-support::before { background: #fff; border: 2px solid var(--blue); width: 7px; height: 7px; }
.t-nonresp::before { background: #fff; border: 1.5px dashed var(--ink-3); width: 7px; height: 7px; }

/* 표 */
.table-wrap { overflow-x: auto; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 8px 8px; text-align: left; white-space: nowrap; }
.tbl th { font-weight: 600; color: var(--ink-2); font-size: 12.5px; background: var(--bg-2); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.nonresp td { color: var(--ink-3); }
.tbl tr.nonresp td:first-child { border-left: 2px dashed var(--line-2); }

.kv { display: flex; flex-wrap: wrap; gap: 4px 22px; font-size: 13.5px; color: var(--ink-2); margin-bottom: 12px; }
.kv b { color: var(--ink); }

.warn-box { border: 1px solid #ecc9bb; border-radius: 5px; padding: 10px 12px; font-size: 13.5px; color: var(--warn); margin: 10px 0; }

.progress-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 13px; padding: 3px 9px; border: 1px solid var(--line-2); border-radius: 4px; }
.chip.pending { border-style: dashed; color: var(--ink-3); }

.type-group { margin-bottom: 12px; }
.type-group h3 { display: flex; align-items: center; gap: 8px; }
.type-group .desc { font-size: 12.5px; color: var(--ink-3); margin: -4px 0 6px; }
.people { display: flex; flex-wrap: wrap; gap: 6px; }
.person { font-size: 13.5px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 4px; }
.person .bal { color: var(--ink-3); font-size: 12px; margin-left: 4px; }
.person.nonresp { border-style: dashed; color: var(--ink-3); }

.sociogram { width: 100%; max-width: 520px; height: auto; display: block; margin: 0 auto; }
.legend { font-size: 12.5px; color: var(--ink-3); display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }

/* 설정 화면 */
.settings { display: grid; grid-template-columns: 220px 1fr; gap: 18px; }
.side-list { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; align-self: start; }
.side-item { display: block; width: 100%; text-align: left; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 14px; }
.side-item:last-child { border-bottom: 0; }
.side-item[aria-current="true"] { background: var(--blue-weak); color: var(--blue); font-weight: 600; }
.side-item .sub { display: block; font-size: 12px; color: var(--ink-3); font-weight: 400; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.roster-row { display: grid; grid-template-columns: 110px 1fr 36px; gap: 6px; margin-bottom: 6px; }
.roster-row .input { padding: 8px 10px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.check input { width: 18px; height: 18px; }

/* 코드 배부 시트 */
.slips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; }
.slip { border: 1px dashed #999; padding: 14px; font-size: 14px; }
.slip .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 20px; letter-spacing: 0.08em; margin: 6px 0; }
.slip .hint { font-size: 11.5px; color: #555; }

/* 응답 화면 (모바일 우선) */
.survey { display: flex; flex-direction: column; min-height: calc(100vh - 82px); min-height: calc(100dvh - 82px); }
.pbar { height: 4px; background: var(--line); }
.pbar > div { height: 100%; background: var(--blue); width: 0; transition: width .2s; }
.q-head { padding: 18px 16px 6px; max-width: 560px; margin: 0 auto; width: 100%; }
.q-meta { font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; }
.q-text { font-size: 17px; font-weight: 600; line-height: 1.5; margin: 0; }
.q-hint { font-size: 12.5px; color: var(--ink-3); margin-top: 8px; }
.plist { list-style: none; margin: 0 auto; padding: 8px 16px 110px; max-width: 560px; width: 100%; }
.plist li { border-bottom: 1px solid var(--line); }
.plist label { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 4px; cursor: pointer; font-size: 16px; }
.plist input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--blue); flex: 0 0 auto; }
.plist .rank { color: var(--ink-3); font-size: 14px; min-width: 34px; }
.plist li.disabled label { color: var(--ink-3); }
.bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
.bottom-inner { max-width: 560px; margin: 0 auto; display: flex; gap: 8px; align-items: center; }
.bottom-inner .count { font-size: 13px; color: var(--ink-3); min-width: 64px; }
.bottom-inner .btn { min-height: 50px; }
.bottom-inner .btn-primary { flex: 1; }

.center-box { text-align: center; padding: 56px 16px; }
.center-box .mark { width: 40px; height: 40px; border: 2px solid var(--blue); border-radius: 50%; margin: 0 auto 14px; position: relative; }
.center-box .mark::after { content: ""; position: absolute; left: 13px; top: 7px; width: 9px; height: 16px; border-right: 2px solid var(--blue); border-bottom: 2px solid var(--blue); transform: rotate(45deg); }

.foot-link { text-align: center; margin-top: 26px; font-size: 13px; }
.foot-link a { color: var(--ink-3); }

@media (max-width: 720px) {
  .settings { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .topbar-inner { gap: 10px; }
  .logo span.full { display: none; }
}

@media print {
  .demo-banner, .topbar, .no-print, .notice { display: none !important; }
  body { font-size: 13px; }
  .wrap { padding: 0; max-width: none; }
  .print-only { display: block !important; }
  .card { border: 0; padding: 0; }
  .slip { break-inside: avoid; }
  body.print-codes .wrap > *:not(#codeSheet) { display: none !important; }
  body.print-codes #codeSheet .no-print { display: none !important; }
}
.print-only { display: none; }
