/* 디자인 토큰 — 고객관리 화면과 같은 템플릿 (Pretendard · 파랑 #2f6bff · 둥근 카드) */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --border: #e3e7ef;
  --text: #1b2433;
  --muted: #6b7587;
  --primary: #2f6bff;
  --primary-ink: #ffffff;
  --primary-soft: #e9f0ff;
  --danger: #e5484d;
  --danger-soft: #fff1f1;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --c-contract: #16a34a;
  --c-prospect: #f59e0b;
  --c-none: #8b95a7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 50, .05), 0 4px 16px rgba(20, 30, 50, .05);
  --nav-h: 60px;
  --top-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-synthesis-weight: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10141b;
    --surface: #1a2029;
    --surface-2: #232b37;
    --border: #2f3a49;
    --text: #e7ecf3;
    --muted: #9aa8bb;
    --primary: #6b96ff;
    --primary-ink: #0b1220;
    --primary-soft: #1c2945;
    --danger: #ff8a85;
    --danger-soft: #3a1f21;
    --warn: #fcd34d;
    --warn-soft: #3a2d14;
    --ok: #6ee7a0;
    --ok-soft: #173326;
    --c-none: #6f7a8d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Pretendard, -apple-system, "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: contain;
}

button, input, select, textarea { font: inherit; color: inherit; }

.app { min-height: 100vh; min-height: 100dvh; }
.boot { padding: 3rem 1rem; text-align: center; color: var(--muted); }

/* ---------------------------------------------------------------- 레이아웃 */

.topbar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; gap: .6rem;
  min-height: var(--top-h);
  padding: calc(.55rem + env(safe-area-inset-top, 0px)) 1rem .55rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: var(--text); border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 16px; font-weight: 700; flex: none;
}
.topbar h1 { margin: 0; font-size: 1.02rem; font-weight: 700; flex: 1; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .back {
  background: var(--surface-2); border: 0; color: inherit;
  width: 32px; height: 32px; border-radius: 9px; font-size: 1.05rem; cursor: pointer;
  display: grid; place-items: center; flex: none;
}
.topbar .who { font-size: .82rem; font-weight: 600; color: var(--muted); white-space: nowrap; }

/* 넓은 화면: 상단 탭 / 좁은 화면: 하단 탭 */
.toptabs { display: none; gap: 4px; }
.toptabs a {
  padding: .5rem .85rem; border-radius: 10px; font-weight: 600; font-size: .92rem;
  color: var(--muted); text-decoration: none; white-space: nowrap;
}
.toptabs a:hover { background: var(--surface-2); }
.toptabs a.on { background: var(--primary-soft); color: var(--primary); }

main {
  padding: 1rem 1rem calc(var(--nav-h) + var(--safe-b) + 1.5rem);
  max-width: 820px; margin: 0 auto;
}
main.wide { max-width: 1280px; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: var(--safe-b);
}
.nav a {
  padding: .55rem .25rem; text-align: center; text-decoration: none;
  color: var(--muted); font-size: .72rem; line-height: 1.3;
}
.nav a .ico { display: block; font-size: 1.2rem; line-height: 1.25; }
.nav a.on { color: var(--primary); font-weight: 700; }

@media (min-width: 900px) {
  .toptabs { display: flex; }
  .topbar h1 { flex: 0 1 auto; margin-right: .6rem; }
  .topbar .toptabs { flex: 1; }
  .nav { display: none; }
  main { padding: 1.4rem 1.4rem 2rem; }
  .toasts { bottom: 1.5rem !important; }
}

/* ------------------------------------------------------------------ 카드 */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.15rem; margin-bottom: .9rem;
}
.card.flat { box-shadow: none; }
.card h2 { margin: 0 0 .7rem; font-size: 1rem; }
.card h3 { margin: 1.1rem 0 .5rem; font-size: .9rem; color: var(--muted); }
.card h3:first-child { margin-top: 0; }

.section-title {
  margin: 1.4rem 0 .6rem; font-size: .8rem; font-weight: 700;
  color: var(--muted); text-transform: none; letter-spacing: .02em;
}
.section-title:first-child { margin-top: 0; }

/* ------------------------------------------------------------------ 폼 */

.field { margin-bottom: .8rem; }
.field > label {
  display: block; font-size: .8rem; font-weight: 600;
  color: var(--muted); margin-bottom: .3rem;
}
.field .hint { font-size: .74rem; color: var(--muted); margin-top: .3rem; }
.field.req > label::after { content: " *"; color: var(--danger); }

/* type 속성이 없는 <input>도 포함해야 합니다.
   input[type=text]는 속성이 실제로 있을 때만 매칭되므로, <input id="x">처럼
   type을 생략한 칸이 기본 너비(약 20자)로 남아 레이아웃을 밀어냅니다. */
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),
select, textarea {
  width: 100%; padding: .65rem .7rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
input[readonly] { background: var(--surface-2); }
textarea { min-height: 72px; resize: vertical; }

.row { display: flex; gap: .6rem; }
.row > * { flex: 1; min-width: 0; }
.row.tight { gap: .4rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .7rem 1rem; border-radius: 10px; border: 1px solid transparent;
  background: var(--surface-2); color: var(--text);
  font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-block { width: 100%; }
.btn-sm { padding: .4rem .6rem; font-size: .8rem; border-radius: 8px; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 auto; }

/* ------------------------------------------------------------------ 배지 */

.badge {
  display: inline-block; padding: .14rem .45rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700; white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--primary-soft); color: var(--primary); }
.badge-muted { background: var(--surface-2); color: var(--muted); }

.note {
  padding: .7rem .8rem; border-radius: 10px; font-size: .85rem;
  border-left: 3px solid; margin-bottom: .7rem;
  overflow-wrap: anywhere;
}

/* 조사된 후보 번호 버튼 — 라벨+번호+배지가 길어 줄바꿈이 필요합니다. */
.btn-opt {
  white-space: normal;
  text-align: left;
  justify-content: flex-start;
  line-height: 1.45;
  padding: .5rem .6rem;
  font-weight: 500;
}
/* 팩스번호가 중간에서 끊기면 잘못 읽을 수 있으므로 한 덩어리로 유지합니다. */
.btn-opt .mono { white-space: nowrap; }
.note-warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.note-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.note-ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.note-info { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.note ul { margin: .4rem 0 0; padding-left: 1.1rem; }

/* ------------------------------------------------------------ 목록/리스트 */

.list { display: flex; flex-direction: column; gap: .6rem; }

.item {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .8rem; box-shadow: var(--shadow);
}
.item:active { background: var(--surface-2); }
.item-top { display: flex; align-items: center; gap: .5rem; margin-bottom: .25rem; }
.item-name { font-weight: 700; }
.item-sub { font-size: .82rem; color: var(--muted); }
.item-meta { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .45rem; }
.spacer { flex: 1; }

.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .3rem; margin-bottom: .8rem; }
.chip {
  flex: none; padding: .35rem .7rem; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  font-size: .82rem; color: var(--muted);
}
.chip.on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); font-weight: 700; }

.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }
.empty .big { font-size: 2rem; display: block; margin-bottom: .5rem; }

/* ---------------------------------------------------------------- 썸네일 */

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .6rem; }
.thumb {
  position: relative; border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; background: var(--surface-2); aspect-ratio: 3 / 4;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .pdf { display: grid; place-items: center; height: 100%; font-size: .8rem; color: var(--muted); }
.thumb .seq {
  position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,.65); color: #fff;
  border-radius: 6px; padding: 0 .35rem; font-size: .72rem; font-weight: 700;
}
.thumb .kind {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.65); color: #fff; font-size: .68rem;
  padding: .2rem .3rem; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.thumb .ops { position: absolute; top: 4px; right: 4px; display: flex; gap: 3px; }
.thumb .ops button {
  width: 24px; height: 24px; border: 0; border-radius: 6px; cursor: pointer;
  background: rgba(0,0,0,.65); color: #fff; font-size: .72rem; display: grid; place-items: center;
}

.capture { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: .8rem; }
.capture label {
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  padding: 1rem .5rem; border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; text-align: center;
  font-weight: 600; font-size: .85rem;
}
.capture label:active { background: var(--surface-2); }
.capture label .ico { font-size: 1.6rem; }
.capture input { display: none; }

/* ------------------------------------------------------------------ 표 */

.kv { display: grid; grid-template-columns: 7.5rem 1fr; gap: .35rem .6rem; font-size: .88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }

table.tbl { width: 100%; border-collapse: collapse; font-size: .84rem; }
table.tbl th, table.tbl td {
  padding: .45rem .4rem; text-align: left; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.tbl th { color: var(--muted); font-size: .78rem; font-weight: 600; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ------------------------------------------------------------- 토스트/모달 */

.toasts {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + var(--safe-b) + 1rem);
  z-index: 60; display: flex; flex-direction: column; gap: .4rem;
  width: min(92vw, 420px); pointer-events: none;
}
.toast {
  padding: .7rem .9rem; border-radius: 10px; font-size: .88rem;
  background: #16202e; color: #fff; box-shadow: var(--shadow);
  animation: pop .18s ease-out;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }

.modal { border: 0; padding: 0; background: transparent; max-width: min(92vw, 460px); }
.modal::backdrop { background: rgba(10, 16, 24, .55); }
.modal-inner {
  background: var(--surface); color: var(--text); border-radius: 14px;
  padding: 1.1rem; box-shadow: var(--shadow);
}
.modal-inner h3 { margin: 0 0 .6rem; font-size: 1rem; }
.modal-actions { display: flex; gap: .5rem; margin-top: 1rem; }
.modal-actions .btn { flex: 1; }
#modal-body { font-size: .9rem; }
#modal-body ul { margin: .5rem 0 0; padding-left: 1.1rem; }
#modal-body li { margin-bottom: .3rem; }

/* -------------------------------------------------------------- 로그인 */

.login-wrap {
  min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem;
}
.login-card { width: min(100%, 380px); }
.login-card .brand { text-align: center; margin-bottom: 1.2rem; }
.login-card .brand .logo { font-size: 2.2rem; }
.login-card .brand h1 { margin: .3rem 0 .1rem; font-size: 1.2rem; }
.login-card .brand p { margin: 0; color: var(--muted); font-size: .85rem; }

/* -------------------------------------------------------------- 유틸 */

.mt0 { margin-top: 0; } .mt1 { margin-top: .6rem; } .mt2 { margin-top: 1.2rem; }
.mb0 { margin-bottom: 0; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .82rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 700; }
.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------- 필요서류 점검표 */

ul.doc-check {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .25rem .8rem;
}
ul.doc-check li {
  display: flex; align-items: baseline; gap: .4rem; font-size: .88rem;
  padding: .12rem 0;
}
.doc-mark { font-weight: 700; width: 1em; flex: none; }
.doc-ok { color: var(--muted); }
.doc-ok .doc-mark { color: var(--ok); }
.doc-miss { color: var(--text); font-weight: 600; }
.doc-miss .doc-mark { color: var(--warn); }

.linklike {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--primary); text-decoration: underline; font: inherit; text-align: left;
}

/* ------------------------------------------------- 번호 확인 체크리스트 */

.progress {
  height: 10px; border-radius: 999px; background: var(--surface-2);
  overflow: hidden; border: 1px solid var(--border);
}
.progress-bar { height: 100%; background: var(--ok); transition: width .3s ease; }

ol.script {
  margin: 0; padding-left: 1.2rem; font-size: .86rem;
}
ol.script li { margin-bottom: .25rem; }

.verify-card .item-name { flex: 1; }

/* 통화용 인쇄 — 화면 전용 요소는 숨기고 적을 칸을 보여줍니다. */
.print-only { display: none; }
.write-line {
  margin-top: .6rem; padding-top: .5rem;
  border-top: 1px dashed #999; font-size: .85rem;
}

@media print {
  :root { --bg: #fff; --surface: #fff; --text: #000; --muted: #444; --border: #999; }
  html, body { background: #fff; color: #000; }
  .no-print, .nav, .topbar, .toasts, .chips, .btn, dialog { display: none !important; }
  .print-only { display: block; }
  main { padding: 0; max-width: none; }
  .card {
    box-shadow: none; border: 1px solid #999; border-radius: 0;
    margin-bottom: .5rem; padding: .6rem; page-break-inside: avoid;
  }
  .print-head { border-bottom: 2px solid #000; margin-bottom: .8rem; }
  .print-head h2 { margin: 0; }
  .badge { border: 1px solid #666; background: #fff !important; color: #000 !important; }
  .note { border: 1px solid #999; border-left-width: 3px; background: #fff; color: #000; }
  a { color: #000; text-decoration: none; }
}

.pdf-frame {
  width: 100%; height: min(70vh, 560px); border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface-2);
}
.preview-img {
  width: 100%; border: 1px solid var(--border); border-radius: 10px; background: #fff;
}

/* ================================================================ 고객 관리 */

.grid-form { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.grid-form .sticky { position: sticky; top: calc(var(--top-h) + 1rem); }
@media (max-width: 899px) { .grid-form { grid-template-columns: 1fr; } .grid-form .sticky { position: static; } }

.card .sec { font-size: .8rem; letter-spacing: .02em; color: var(--primary); font-weight: 700;
  margin: 1.2rem 0 .6rem; padding-top: 1rem; border-top: 1px dashed var(--border); }
.card .sec:first-of-type { border-top: 0; padding-top: 0; margin-top: .4rem; }

.rrn { display: flex; align-items: center; gap: .5rem; }
.rrn input.front { flex: 1; max-width: 190px; letter-spacing: .08em; }
.rrn input.one { width: 52px !important; text-align: center; padding-left: 0 !important; padding-right: 0 !important; }
.rrn .dash { color: var(--muted); font-weight: 700; }
.rrn .mask { color: var(--c-none); letter-spacing: .15em; font-size: .9rem; user-select: none; }
.addr-row { display: flex; gap: .5rem; }
.addr-row .zip { max-width: 130px; }

/* 세그먼트(고객 구분) */
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; }
.seg > label, .seg > button { flex: 1; margin: 0; }
.seg input, .pick input, .step input[type=checkbox] { position: absolute; opacity: 0; pointer-events: none; }
.seg span, .seg > button {
  display: block; text-align: center; padding: .55rem .25rem; border-radius: 9px; border: 0; background: transparent;
  font-weight: 600; color: var(--muted); cursor: pointer;
}
.seg input:checked + span, .seg > button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg input:checked + .s-계약 { color: var(--c-contract); }
.seg input:checked + .s-가망 { color: var(--warn); }
.seg input:focus-visible + span, .pick input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* 칩 선택(계약 경로) */
.pick { display: flex; flex-wrap: wrap; gap: .5rem; }
.pick label { margin: 0; position: relative; }
.pick span {
  display: inline-block; padding: .5rem 1rem; border: 1px solid var(--border); border-radius: 999px;
  font-weight: 600; background: var(--surface); cursor: pointer;
}
.pick input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }

/* 진행 사항 */
.steps { display: grid; gap: .5rem; }
.step {
  position: relative; display: flex; align-items: center; gap: .65rem; margin: 0; padding: .7rem .9rem;
  border: 1px solid var(--border); border-radius: 12px; font-weight: 600; cursor: pointer;
}
.step .num {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 700;
}
.step:has(input:checked) { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); background: var(--primary-soft); }
.step input:checked ~ .num { background: var(--primary); color: #fff; font-size: 0; }
.step input:checked ~ .num::before { content: "✓"; font-size: 13px; }
.step.meet { cursor: default; flex-wrap: wrap; }
.stepper { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.stepper button { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); font-size: 1.1rem; line-height: 1; cursor: pointer; }
.stepper input { width: 64px !important; text-align: center; padding: .4rem !important; }

/* 상태 배지 · 진행 아이콘 */
.badge.s-계약 { background: var(--ok-soft); color: var(--ok); }
.badge.s-가망 { background: var(--warn-soft); color: var(--warn); }
.badge.s-미계약 { background: var(--surface-2); color: var(--muted); }
.prog { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.prog i { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center;
  font-style: normal; font-size: 11px; font-weight: 700; background: var(--surface-2); color: var(--c-none); }
.prog i.on { background: var(--primary); color: #fff; }
.prog .meet { margin-left: 4px; font-size: 12px; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin-bottom: .9rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .7rem .85rem; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.35rem; line-height: 1.2; }
.stat span { font-size: .75rem; color: var(--muted); }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .8rem; }
.toolbar input[type=search] { flex: 1; min-width: 200px; }
.toolbar .chips { margin: 0; padding: 0; }

/* 고객 표 — 좁은 화면에서는 카드처럼 */
table.ctable { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.ctable th { text-align: left; font-size: .75rem; color: var(--muted); font-weight: 600; padding: .6rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.ctable td { padding: .7rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.ctable td.addr { color: var(--muted); max-width: 280px; }
table.ctable .acts { white-space: nowrap; text-align: right; }
table.ctable tr.sel td { background: var(--primary-soft); }
@media (max-width: 760px) {
  table.ctable thead { display: none; }
  table.ctable, table.ctable tbody, table.ctable tr, table.ctable td { display: block; width: 100%; }
  table.ctable tr { border: 1px solid var(--border); border-radius: 12px; padding: .6rem .8rem; margin-bottom: .6rem; background: var(--surface); }
  table.ctable td { border: 0; padding: .15rem 0; max-width: none !important; }
  table.ctable td[data-l]::before { content: attr(data-l); display: inline-block; width: 70px; font-size: .75rem; color: var(--muted); }
  table.ctable .acts { text-align: left; padding-top: .5rem; }
}

/* 지도 */
.map { width: 100%; height: 380px; border-radius: 12px; overflow: hidden; background: var(--surface-2); z-index: 0; }
.map-card { position: relative; padding: .6rem; }
.map-tools { position: absolute; top: 1.1rem; right: 1.1rem; z-index: 500; display: flex; gap: .4rem; }
.map-tools .btn { box-shadow: var(--shadow); background: var(--surface); border: 1px solid var(--border); }
.legend {
  position: absolute; right: 1.1rem; bottom: 1.1rem; z-index: 500; background: var(--surface); border-radius: 10px;
  padding: .4rem .7rem; display: flex; gap: .7rem; font-size: .8rem; font-weight: 600; box-shadow: var(--shadow);
}
.legend span { display: flex; align-items: center; gap: 5px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; background: var(--primary); }
.dot.s-계약 { background: var(--c-contract); } .dot.s-가망 { background: var(--c-prospect); } .dot.s-미계약 { background: var(--c-none); }

/* 전체화면: 지도 카드를 화면 전체로 (iOS Safari도 동작하도록 CSS로 처리) */
.map-card.full {
  position: fixed; inset: 0; z-index: 2000; margin: 0; border-radius: 0; padding: 0; border: 0;
}
.map-card.full .map { height: 100% !important; border-radius: 0; }
.map-card.full .map-tools { top: calc(.8rem + env(safe-area-inset-top, 0px)); right: .8rem; }
.map-card.full .legend { right: .8rem; bottom: calc(.8rem + env(safe-area-inset-bottom, 0px)); }
.map-card .side { display: none; }
.map-card.full .side {
  display: block; position: absolute; z-index: 600; left: .8rem; top: calc(.8rem + env(safe-area-inset-top, 0px));
  width: min(300px, calc(100vw - 1.6rem)); max-height: calc(100% - 5rem); overflow: auto;
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: .6rem;
}
.map-card.full .side.collapsed ul { display: none; }
body.map-open { overflow: hidden; }

/* 지도 탭: 화면 전체를 지도로 */
main.mapview { max-width: none; padding: 0; }
main.mapview .map-card { margin: 0; border: 0; border-radius: 0; padding: 0; box-shadow: none; }
main.mapview .map { height: calc(100dvh - var(--top-h) - var(--nav-h) - var(--safe-b)); border-radius: 0; }
main.mapview .map-card .side {
  display: block; position: absolute; z-index: 600; left: .8rem; top: .8rem;
  width: min(300px, calc(100vw - 1.6rem)); max-height: calc(100% - 5rem); overflow: auto;
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: .6rem;
}
main.mapview .map-card .side.collapsed ul { display: none; }
@media (min-width: 900px) { main.mapview .map { height: calc(100dvh - var(--top-h)); } }

.side .chips { margin-bottom: .3rem; }
.side-head { display: flex; align-items: center; gap: .4rem; }
.side-list { list-style: none; margin: .3rem 0 0; padding: 0; }
.side-list li { padding: .5rem; border-radius: 10px; cursor: pointer; display: flex; gap: .6rem; align-items: center; }
.side-list li:hover { background: var(--surface-2); }
.side-list li.nopin { opacity: .55; }
.side-list .who2 { flex: 1; min-width: 0; }
.side-list .who2 b { display: block; font-size: .92rem; }
.side-list .who2 small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pin-wrap { background: none; border: 0; }
.pin { width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); background: var(--primary); }
.pin.s-계약 { background: var(--c-contract); } .pin.s-가망 { background: var(--c-prospect); } .pin.s-미계약 { background: var(--c-none); }
.pin-label { position: absolute; left: 50%; top: -22px; transform: translateX(-50%); white-space: nowrap; color: #1b2433;
  background: #fff; padding: 1px 7px; border-radius: 6px; font-size: 12px; font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.leaflet-popup-content { font-family: inherit; font-size: 14px; min-width: 200px; }
.pop h4 { margin: 0 0 6px; font-size: 16px; display: flex; align-items: center; gap: 6px; }
.pop p { margin: 3px 0; color: #5d6b7f; }
.pop .btn-row { margin-top: 8px; }
.hint.ok { color: var(--ok); } .hint.warn { color: var(--warn); }

/* 로그인 화면 탭 */
.login-card .seg { margin-bottom: 1rem; }

/* 전체화면·지도 탭에서는 사이드 목록이 왼쪽 위를 쓰므로 확대 버튼을 왼쪽 아래로 */
.map-card.full .leaflet-top.leaflet-left,
main.mapview .leaflet-top.leaflet-left { top: auto; bottom: calc(1.4rem + env(safe-area-inset-bottom, 0px)); }

/* ---- 지도 겹침 수정 ---- */
/* 범례가 오른쪽 아래 저작권 표기(Leaflet | OpenStreetMap)를 가리지 않도록 위로 올립니다. */
.legend { bottom: 2.1rem; }
.map-card.full .legend { bottom: calc(2rem + env(safe-area-inset-bottom, 0px)); }
main.mapview .legend { bottom: 2rem; right: .8rem; }
main.mapview .map-tools { top: .8rem; right: .8rem; }
/* 좁은 화면: 위쪽 줄은 버튼, 그 아래에 고객 목록 패널 */
@media (max-width: 640px) {
  .map-card.full .side, main.mapview .map-card .side {
    left: .6rem; right: .6rem; width: auto;
    top: calc(3.3rem + env(safe-area-inset-top, 0px));
    max-height: 42%;
  }
  main.mapview .map-card .side { top: 3.3rem; }
  .map-card.full .map-tools, main.mapview .map-tools { left: .6rem; right: .6rem; justify-content: flex-end; }
  .legend { font-size: .72rem; gap: .45rem; padding: .3rem .55rem; }
}

/* 주소 검색 창(팝업 대신 화면 안에 띄움 — 휴대폰·홈화면 앱에서 팝업이 막히는 문제 방지) */
.post-layer { position: fixed; inset: 0; z-index: 3000; background: rgba(10,16,24,.55); display: grid; place-items: center; padding: 1rem; }
.post-box { width: min(520px, 100%); height: min(620px, 92dvh); background: var(--surface); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.post-head { display: flex; align-items: center; padding: .6rem .8rem; border-bottom: 1px solid var(--border); font-weight: 700; }
.post-body { flex: 1; min-height: 0; }

/* ---- 홈 ---- */
a.brand-mark { text-decoration: none; cursor: pointer; transition: transform .12s; }
a.brand-mark:hover { transform: scale(1.06); }
a.stat { text-decoration: none; color: inherit; }
a.stat:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.home-hello h2 { margin: .2rem 0 .2rem; font-size: 1.3rem; }
.home-hello p { margin: 0 0 1rem; font-size: .9rem; }
/* 메뉴: 가로형 버튼(아이콘 왼쪽 · 글자 오른쪽), 4개씩 두 줄 */
.home-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; }
@media (max-width: 760px) { .home-grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; } }
.home-tile {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto;
  column-gap: .75rem; align-items: center; padding: .9rem 1rem; min-height: 72px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); text-decoration: none; color: var(--text); transition: border-color .15s, transform .12s;
}
.home-tile:hover { border-color: var(--primary); transform: translateY(-1px); }
.home-tile:active { background: var(--surface-2); }
.home-tile .ico {
  grid-row: 1 / 3; width: 44px; height: 44px; border-radius: 12px; background: var(--primary-soft);
  display: grid; place-items: center; font-size: 1.35rem; line-height: 1;
}
.home-tile b { font-size: 1rem; align-self: end; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-tile small { color: var(--muted); font-size: .78rem; align-self: start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 380px) { .home-tile { padding: .75rem .7rem; column-gap: .55rem; } .home-tile .ico { width: 38px; height: 38px; font-size: 1.15rem; } }

/* ---- 지도 스타일 선택 ---- */
.leaflet-bar.map-style { border: 0; box-shadow: 0 1px 5px rgba(0,0,0,.25); border-radius: 9px; overflow: hidden; }
.map-style select {
  width: auto !important; padding: .32rem 1.6rem .32rem .55rem !important; border: 0 !important; border-radius: 9px !important;
  font-size: .8rem; font-weight: 600; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7587'/%3E%3C/svg%3E") no-repeat right .55rem center;
  color: #1b2433; cursor: pointer; box-shadow: none !important;
}
.map.map-dark { background: #262626; }

/* ---- 네이버 지도용 ----
   Leaflet은 컨트롤을 자기 레이어에 넣어주지만 네이버 SDK는 그런 자리가 없어서,
   스타일 선택 상자를 지도 칸 위에 직접 얹습니다(Leaflet과 같은 위치). */
.map { position: relative; }
.map-style-float { position: absolute; top: 10px; left: 10px; z-index: 100; }
.map-card.full .map-style-float,
main.mapview .map-style-float { top: auto; bottom: calc(1.4rem + env(safe-area-inset-bottom, 0px)); }
/* 네이버 InfoWindow는 배경·테두리를 꺼 두고 말풍선을 직접 그립니다(브이월드 쪽과 같은 모양). */
.naver-pop { background: #fff; border-radius: 10px; padding: .7rem .85rem;
  box-shadow: 0 3px 14px rgba(0,0,0,.25); font-size: 14px; min-width: 200px; }

/* ---- 홈: 보험 뉴스 · 이슈 랭킹 (뉴스 포털 형식) ---- */
.news { padding: 1.1rem 1.2rem; }
.news-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; border-bottom: 2px solid var(--text); padding-bottom: .7rem; margin-bottom: .4rem; }
.news-head h2 { margin: 0; font-size: 1.1rem; }
.news-tabs { margin: 0; padding: 0; }
.news-body { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 1.4rem; }
@media (max-width: 860px) { .news-body { grid-template-columns: 1fr; gap: .6rem; } }
.news-rank { list-style: none; margin: 0; padding: 0; }
.news-rank > li { display: flex; gap: .8rem; padding: .75rem 0; border-bottom: 1px solid var(--border); }
.news-rank > li:last-child { border-bottom: 0; }
.news-rank .rk { flex: none; width: 1.6rem; text-align: center; font-size: 1.15rem; font-weight: 800; color: var(--muted); font-style: italic; line-height: 1.35; }
.news-rank li.top .rk { color: var(--primary); font-size: 1.35rem; }
.news-rank .nw { min-width: 0; flex: 1; }
.news-rank .nt { color: var(--text); text-decoration: none; font-weight: 600; line-height: 1.45; }
.news-rank li.top .nt { font-weight: 700; font-size: 1.02rem; }
.news-rank .nt:hover, .news-kw a:hover, .nr a:hover { text-decoration: underline; color: var(--primary); }
.news-rank .nm { font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.news-rank .nr { list-style: none; margin: .35rem 0 0; padding: .1rem 0 0 .7rem; border-left: 2px solid var(--border); font-size: .82rem; }
.news-rank .nr li { margin: .15rem 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.news-rank .nr a { color: var(--text); text-decoration: none; }
.news-kw { border-left: 1px solid var(--border); padding-left: 1.2rem; }
@media (max-width: 860px) { .news-kw { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: .8rem; } }
.news-kw h3 { margin: .7rem 0 .5rem; font-size: .95rem; color: var(--text); }
.news-kw ol { list-style: none; margin: 0 0 .8rem; padding: 0; display: grid; grid-template-columns: 1fr; gap: .1rem; }
@media (max-width: 860px) { .news-kw ol { grid-template-columns: 1fr 1fr; } }
.news-kw li { display: flex; gap: .55rem; align-items: center; padding: .3rem 0; }
.news-kw .rk { width: 1.4rem; height: 1.4rem; border-radius: 6px; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; font-size: .75rem; font-weight: 800; flex: none; }
.news-kw li:nth-child(-n+3) .rk { background: var(--primary); color: #fff; }
.news-kw a { color: var(--text); text-decoration: none; font-weight: 600; }

/* 1~3위 기사 사진 (포털처럼 왼쪽 썸네일) */
.news-rank .nthumb {
  flex: none; order: 0; width: 132px; height: 88px; border-radius: 10px; overflow: hidden;
  background: linear-gradient(110deg, var(--surface-2) 30%, var(--border) 50%, var(--surface-2) 70%);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite; display: block;
}
.news-rank .nthumb.ok, .news-rank .nthumb.none { animation: none; background: var(--surface-2); }
.news-rank .nthumb.none { display: none; }
.news-rank .nthumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.news-rank .nthumb:hover img { transform: scale(1.04); }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (max-width: 520px) { .news-rank .nthumb { width: 96px; height: 68px; } }

/* ---- 보험 계약 · 면책/감액 ---- */
.grid-form .side-col > .card { margin-bottom: .9rem; }
.pol-list { display: grid; gap: .6rem; }
.pol { border: 1px solid var(--border); border-radius: 12px; padding: .7rem .8rem; }
.pol-top { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-bottom: .2rem; }
.pol .btn-row .btn { flex: 0 0 auto; }

/* ---- 홈: 면책·감액 알림 ---- */
.alerts .news-head { border-bottom-width: 1px; border-color: var(--border); }
.alerts .news-head .small { margin-left: auto; }
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-list li { display: flex; gap: .8rem; align-items: flex-start; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.alert-list li:last-child { border-bottom: 0; }
.alert-list .dday { flex: none; min-width: 68px; text-align: center; font-weight: 800; font-size: .82rem;
  padding: .25rem .4rem; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
.alert-list li.today .dday { background: var(--danger); color: #fff; }
.alert-list li.soon .dday { background: var(--warn-soft); color: var(--warn); }
.alert-list li.past { opacity: .6; }
.alert-list .aw { min-width: 0; flex: 1; }
.alert-list .al-ck { flex: none; width: 18px; height: 18px; margin-top: .3rem; accent-color: var(--primary); }
.alert-list .al-kk1 { flex: none; margin-left: auto; }
.al-kk { display: flex; align-items: center; gap: .6rem; padding: .3rem 0 .5rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.al-kk .al-all { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); cursor: pointer; }
.al-kk .al-all input { width: 18px; height: 18px; accent-color: var(--primary); }
.alert-list .aw a { color: var(--text); text-decoration: none; }
.alert-list .aw a:hover { color: var(--primary); text-decoration: underline; }

#pf-presets { flex-wrap: wrap; overflow: visible; padding-bottom: 0; }

/* ---- 계산기 ---- */
.calc-head h2 { margin: .2rem 0 .1rem; font-size: 1.3rem; }
.calc-head p { margin: 0 0 1rem; }
.calc-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .calc-grid { grid-template-columns: 1fr; } }
.calc-in { position: relative; display: flex; align-items: center; }
.calc-in input { padding-right: 3.6rem !important; text-align: right; font-variant-numeric: tabular-nums; }
.calc-in span { position: absolute; right: .7rem; color: var(--muted); font-size: .82rem; pointer-events: none; }
.calc-in.sm input { padding: .4rem 2.1rem .4rem .5rem !important; min-width: 74px; }
.calc-in.sm span { right: .5rem; }
.calc-out { margin-top: .4rem; padding-top: .8rem; border-top: 1px dashed var(--border); }
.calc-total { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem;
  background: var(--primary-soft); border-radius: 12px; padding: .8rem 1rem; margin: .7rem 0 .4rem; }
.calc-total span { font-weight: 600; color: var(--primary); }
.calc-total b { font-size: 1.35rem; color: var(--primary); }
.calc-check { display: flex; align-items: center; gap: .45rem; font-size: .85rem; color: var(--text); font-weight: 500; }
.calc-check input { width: 18px; height: 18px; }
#fx-chips { margin: .2rem 0 .6rem; flex-wrap: wrap; }
.calc-rows td, .calc-cmp td { vertical-align: middle; }
.calc-cmp th, .calc-cmp td { white-space: nowrap; }
.calc-cmp td:first-child { font-size: .95rem; }
.up { color: var(--ok); } .down { color: var(--danger); }
.calc-notes { margin: .9rem 0 0; padding-left: 1.1rem; }
.calc-notes li { margin: .25rem 0; }

.calc-verdict { font-size: 1.05rem; font-weight: 600; padding: .8rem 1rem; border-radius: 12px; margin-bottom: .8rem;
  background: var(--surface-2); }
.calc-verdict.ins { background: var(--primary-soft); color: var(--primary); }
.calc-verdict.sav { background: var(--ok-soft); color: var(--ok); }
.calc-cmp th:first-child { color: var(--muted); font-weight: 600; width: 7rem; }
.calc-cmp thead th { font-size: .9rem; color: var(--text); }
.calc-cmp tr.big td { font-size: 1.05rem; }
/* 계산기 챕터 — 패널은 모두 만들어 두고 고른 것만 보입니다.
   .card 가 display 를 따로 잡는 경우에도 숨김이 확실히 먹도록 !important 를 둡니다. */
/* 챕터 칩은 가로 스크롤 대신 줄바꿈합니다 — 좁은 폰에서 '비교하기'가 잘려
   안 보이면 비교 기능이 있는 줄 모르게 되기 때문입니다. */
.calc-tabs { margin: 0 0 1rem; flex-wrap: wrap; overflow-x: visible; }
.calc-tabs .chip { font-size: .92rem; padding: .45rem .85rem; }
@media (max-width: 420px) { .calc-tabs .chip { font-size: .85rem; padding: .4rem .6rem; } }
[hidden] { display: none !important; }
.calc-panel h2 { margin-top: 0; }

/* 고객 화면: 보험나이 · 상령일 · 생일 */
.age-strip { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; margin-top: .7rem; padding: .6rem .8rem;
  background: var(--surface-2); border-radius: 10px; font-size: .88rem; align-items: center; }
.age-strip > span { display: inline-flex; align-items: center; gap: .3rem; }
#alert-tabs { flex: 1; }

/* ---- 홈 메뉴: 한 줄에 4개 ---- */
.home-grid { grid-template-columns: repeat(4, 1fr); }
/* 마지막 줄이 덜 차면 맨 끝 메뉴를 가로로 늘려 빈칸을 없앱니다 */
@media (min-width: 761px) {
  .home-grid .home-tile:last-child:nth-child(4n+1) { grid-column: span 4; }
  .home-grid .home-tile:last-child:nth-child(4n+2) { grid-column: span 3; }
  .home-grid .home-tile:last-child:nth-child(4n+3) { grid-column: span 2; }
}
@media (max-width: 760px) {
  .home-grid .home-tile:last-child:nth-child(2n+1) { grid-column: 1 / -1; }
}

/* ---- 보험사전산 ---- */
.terms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .8rem; }
.terms-card { margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.terms-card .tc-head { display: flex; align-items: center; gap: .5rem; justify-content: space-between; }
.terms-card .tc-head b { font-size: 1.02rem; }
.terms-card .tc-dl { display: grid; grid-template-columns: auto 1fr; gap: .25rem .7rem; margin: 0; font-size: .9rem; }
.terms-card .tc-dl dt { color: var(--muted); }
.terms-card .tc-dl dd { margin: 0; }
.terms-card .tc-dl a { text-decoration: none; }
.terms-card .tc-go { margin-top: auto; text-align: center; }
/* 약관 보기 + 전산 두 버튼을 카드 맨 아래에 나란히 둡니다. */
.terms-card .tc-btns { margin-top: auto; display: flex; gap: .4rem; align-items: center; }
.terms-card .tc-btns .btn { flex: 1; text-align: center; }
.terms-card .tc-nosales { flex: 1; text-align: center; }
@media (max-width: 760px) { .home-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---- 카톡 발송 도우미 ---- */
.kk-agent { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; padding: .55rem .75rem; margin-bottom: .7rem;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.kk-agent .btn { margin-left: auto; }
.kk-dot { width: 10px; height: 10px; border-radius: 50%; background: #c62828; flex: none; }
.kk-dot.on { background: #1a9e48; box-shadow: 0 0 0 3px rgba(26,158,72,.18); }
.kk-speed { flex-wrap: wrap; overflow: visible; }
.kh-step { margin: .7rem 0 0; }
.kh-step h2 { font-size: 1rem; margin-bottom: .5rem; }
.kh-howto { margin: .7rem 0 .4rem; padding-left: 1.2rem; line-height: 1.7; }
.kh-list { list-style: none; margin: 0; padding: 0; }
.kh-list li { display: flex; align-items: center; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--border); }
.kh-list li:last-child { border-bottom: 0; }
.kh-list .kh-main { flex: 1; min-width: 0; }

/* ---- 자료실 ---- */
.lib-files { list-style: none; margin: 0; padding: 0; }
.lib-files li { display: flex; align-items: center; gap: .4rem; padding: .6rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.lib-files li:last-child { border-bottom: 0; }
.lib-files .lf-main { flex: 1; min-width: 200px; }

/* ---- 고객 화면: 이 고객이 소개한 사람 ---- */
.ref-kids { margin-top: .5rem; font-size: .88rem; padding: .5rem .7rem; background: var(--primary-soft); border-radius: 10px; }
.ref-kids a { color: var(--primary); font-weight: 600; }

/* ---- 기고객 마인드맵 ---- */
.mm-top { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .8rem 1rem; }
.mm-top > b { margin-right: .3rem; }
.mm-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .75rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none;
  font-weight: 600; font-size: .88rem; cursor: pointer; }
.mm-chip .rk { width: 1.3rem; height: 1.3rem; border-radius: 50%; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: .72rem; }
.mm-chip.s-계약 { border-left: 4px solid var(--c-contract); }
.mm-chip.s-가망 { border-left: 4px solid var(--c-prospect); }
.mm-chip.s-미계약 { border-left: 4px solid var(--c-none); }
.mm-chip.hit, .mm-node.hit { outline: 3px solid var(--primary); outline-offset: 2px; }
.mm-loners { display: flex; flex-wrap: wrap; gap: .45rem; }
.mm-card { padding: .6rem; }
.mm-wrap { overflow: auto; min-height: 160px; border-radius: 10px;
  background: radial-gradient(circle, var(--border) 1px, transparent 1px) 0 0 / 18px 18px; }
.mm-canvas { position: relative; transform-origin: 0 0; margin: 12px; }
.mm-lines { position: absolute; inset: 0; overflow: visible; }
.mm-lines path { fill: none; stroke: var(--primary); stroke-opacity: .45; stroke-width: 2; }
.mm-node { position: absolute; display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding: .3rem .7rem; border-radius: 12px; border: 1px solid var(--border); border-left: 5px solid var(--primary);
  background: var(--surface); box-shadow: var(--shadow); cursor: pointer; text-align: left; color: var(--text); }
.mm-node:hover { border-color: var(--primary); transform: translateY(-1px); }
.mm-node b { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.mm-node small { font-size: .72rem; color: var(--muted); }
.mm-node.s-계약 { border-left-color: var(--c-contract); }
.mm-node.s-가망 { border-left-color: var(--c-prospect); }
.mm-node.s-미계약 { border-left-color: var(--c-none); }
.mm-arrow { text-align: center; color: var(--primary); font-weight: 700; margin: -.2rem 0 .4rem; }

/* ---- 카카오톡 보내기 ---- */
table.ctable th.ck, table.ctable td.ck { width: 34px; text-align: center; }
table.ctable td.ck input, #ck-all { width: 18px; height: 18px; cursor: pointer; }
.kk-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + .8rem);
  z-index: 1500; display: flex; gap: .7rem; align-items: center; padding: .6rem .8rem .6rem 1.1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
@media (min-width: 900px) { .kk-bar { bottom: 1.4rem; } }
.kk-bar.hidden { display: none; }
.kk-box { height: auto; max-height: 92dvh; width: min(560px, 100%); }
.kk-body { padding: .9rem 1rem; overflow: auto; }
.kk-foot { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; border-top: 1px solid var(--border); }
.kk-preview { display: grid; gap: .5rem; }
.kk-msg { background: #fee500; color: #191919; border-radius: 12px; padding: .5rem .7rem; }
.kk-msg b { display: block; font-size: .75rem; opacity: .7; }
.kk-test { margin-top: .4rem; font-size: .88rem; }
.kk-test summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.kk-list { list-style: none; margin: .6rem 0; padding: 0; max-height: 46vh; overflow: auto; }
.kk-list li { padding: .35rem 0; border-bottom: 1px solid var(--border); }
.kk-list li.skipped b, .kk-list li.failed b { color: var(--danger); }
#kk-text { overflow-x: hidden; white-space: pre-wrap; }
#kk-vars { flex-wrap: wrap; overflow: visible; }
