/* 상담 수신함 — 견적 관리 시스템과 같은 톤(흰 바탕·검정 글·가는 선), 왼쪽 메뉴는 채널톡과 비슷한 구조. */
:root {
  --canvas: #ffffff; --soft: #f8f9fa; --hover: #f1f3f5; --line: #e5e7eb; --line-strong: #d1d5db;
  --ink: #111111; --body: #374151; --sub: #6b7280; --primary: #0e0daf; --on-primary: #ffffff;
  /* 블랭커 포인트 색: 파랑(버튼·선택·링크)과 형광(강조 표시) */
  --brand: #0e0daf; --brand-soft: #eef0ff; --brand-line: #c7caf5; --neon: #cefe01;
  --danger: #b42318; --ok: #1a7f37; --note-bg: #fff7db; --note-text: #6b4e00;
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --shadow: 0 1px 2px rgba(17, 17, 17, .05);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--canvas); color: var(--ink); font: 14px/1.5 Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
h1, h2, h3, p { margin: 0; }
code { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--soft); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }

/* ── 기본 부품 ── */
button, input, textarea, select { font: inherit; color: inherit; }
button { border: 1px solid var(--line); background: var(--canvas); border-radius: var(--r-md); padding: 6px 12px; cursor: pointer; font-weight: 500; white-space: nowrap; }
button:hover:not([disabled]) { background: var(--soft); border-color: var(--line-strong); }
button[disabled] { opacity: .45; cursor: default; }
button.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); font-weight: 600; }
button.primary:hover:not([disabled]) { background: #0b0b8f; border-color: #0b0b8f; }
button.quiet { border-color: transparent; background: none; color: var(--sub); padding: 4px 8px; }
button.quiet:hover:not([disabled]) { background: var(--hover); border-color: transparent; color: var(--ink); }
button.link { border: 0; background: none; padding: 0; color: var(--brand); text-decoration: underline; text-underline-offset: 2px; font-size: 12px; font-weight: 400; }
button.link:hover:not([disabled]) { background: none; color: var(--ink); }
button.danger { color: var(--danger); }
button.small { font-size: 12px; padding: 3px 8px; }
input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="tel"], input[type="url"], input[type="number"], input[type="date"], textarea, select {
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 7px 10px; background: var(--canvas); min-width: 0;
}
textarea { width: 100%; resize: vertical; display: block; }
input::placeholder, textarea::placeholder { color: #9ca3af; }
input:disabled, textarea:disabled, select:disabled { background: var(--soft); color: var(--sub); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, li:focus-visible, tr:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); }
.hint { color: var(--sub); font-size: 13px; margin: 8px 0; white-space: pre-wrap; }
.sub { color: var(--sub); font-size: 12px; font-weight: 400; }
.center { text-align: center; margin-top: 30vh; }
.error { color: var(--danger); font-size: 13px; margin: 6px 16px; }
.error.ok { color: var(--ink); }
.msgline { font-size: 13px; margin: 10px 0 0; color: var(--brand); }
.msgline.bad { color: var(--danger); }
.notice { background: var(--soft); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 14px; font-size: 13px; color: var(--body); margin-bottom: 16px; }
.pad { padding: 0 16px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 6px; }
.row input { flex: 1; }
.row.narrow { max-width: 340px; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
.badge { background: #e02424; color: #fff; border-radius: 10px; font-size: 11px; font-weight: 600; padding: 1px 7px; margin-left: 6px; }
.tag { font-size: 11px; font-weight: 500; color: var(--body); background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; margin-left: 6px; white-space: nowrap; }
.tag.hot { color: var(--ink); border-color: var(--neon); background: var(--neon); font-weight: 600; }
.tag.live { color: var(--ink); background: var(--neon); border-color: var(--neon); font-weight: 600; }
/* 자동 배지(문의 종류) 색 — 목록·상담 머리글에 같이 쓴다 */
.tag.b-gray { background: #f3f4f6; border-color: #d1d5db; color: #374151; }
.tag.b-blue { background: #e8ebff; border-color: #b9bff5; color: #0e0daf; }
.tag.b-green { background: #e3f6ea; border-color: #a6dfbb; color: #146c3a; }
.tag.b-orange { background: #fff1dd; border-color: #f5c98a; color: #9a4b00; }
.tag.b-red { background: #ffe3e3; border-color: #f5a3a3; color: #a11919; }
.tag.b-purple { background: #f0e6ff; border-color: #cdb3f5; color: #5a1fa8; }
.tag.b-neon { background: var(--neon); border-color: var(--neon); color: var(--ink); font-weight: 600; }
.thread header .badge-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 4px; overflow: visible; }
.badge-row .tag { margin-left: 0; display: inline-flex; align-items: center; gap: 2px; }
/* 떼기 단추: 손가락·키보드로 잡을 수 있게 18px, 포커스 테두리 유지 */
.badge-row .tag button { all: unset; cursor: pointer; font-size: 13px; line-height: 18px; width: 18px; text-align: center; border-radius: 50%; opacity: .65; }
.badge-row .tag button:hover { opacity: 1; background: rgba(0, 0, 0, .08); }
.badge-row .tag button:focus-visible { opacity: 1; outline: 2px solid var(--brand); outline-offset: 1px; }
#badge-rules input[type="text"] { width: 100%; min-width: 120px; font-size: 13px; }
#badge-rules td.kw textarea { width: 100%; min-width: 320px; min-height: 52px; font-size: 13px; resize: vertical; }
#badge-rules select { font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip { font-size: 12px; padding: 2px 9px; border-radius: 999px; }
.card { background: var(--canvas); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card.scroll-x { overflow-x: auto; }
.card h2 { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.stack { display: flex; flex-direction: column; gap: 4px; max-width: 360px; }
.stack.wide { max-width: 520px; }
.stack label { font-size: 13px; font-weight: 500; margin-top: 8px; }
.stack button { margin-top: 12px; align-self: flex-start; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
/* 화면에는 안 보이는 머리글(.sr)이 표 밖 기준으로 놓이면 넓은 표에서 페이지가 가로로 늘어난다 — 칸 안에 붙잡아 둔다. */
.table th { position: relative; text-align: left; color: var(--sub); font-weight: 500; font-size: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--soft); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .ops { white-space: nowrap; text-align: right; }
.table .ops button { font-size: 12px; padding: 3px 8px; margin-left: 4px; }
.table.rows td { white-space: nowrap; }
.table.rows tbody tr { cursor: pointer; }
.table.rows tbody tr:hover, .table.rows tbody tr[aria-current="true"] { background: var(--soft); }
.wrap { white-space: normal; max-width: 320px; }
dl { margin: 0; display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 5px 8px; font-size: 13px; }
dt { color: var(--sub); }
dd { margin: 0; word-break: break-all; }

/* ── 로그인 ── */
.login { max-width: 340px; margin: 16vh auto 0; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 28px; display: flex; flex-direction: column; gap: 6px; }
.login h1 { font-size: 20px; margin: 14px 0 8px; letter-spacing: -.2px; }
.login label { font-size: 13px; font-weight: 500; margin-top: 6px; }
.login button { margin-top: 14px; padding: 9px; }
.login .login-alt { margin: 10px 0 0; font-size: 13px; color: var(--muted, #666); text-align: center; }
.login .login-alt button.link { margin: 0; padding: 0; font-size: 13px; }
.login .sub { font-weight: 400; }

/* ── 틀: 왼쪽 메뉴 + 본문 ── */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); height: 100vh; }
.conn { position: fixed; top: 0; left: 0; right: 0; z-index: 40; padding: 8px 16px; background: var(--danger); color: #fff; font-size: 13px; text-align: center; }
.topbar, .nav-shade { display: none; }
.sidebar { background: var(--soft); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; letter-spacing: -.2px; }
.sidebar .brand { padding: 18px 16px 14px; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: var(--brand); color: var(--neon); display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; }
#nav { flex: 1; overflow-y: auto; padding: 0 8px 12px; display: flex; flex-direction: column; gap: 1px; }
.nav-label { font-size: 11px; font-weight: 600; color: var(--sub); padding: 16px 10px 5px; letter-spacing: .2px; }
#nav button { border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: var(--r-sm); color: var(--body); display: flex; align-items: center; }
#nav button .badge { margin-left: auto; }
#nav button:hover { background: var(--hover); color: var(--ink); }
#nav button[aria-current="page"] { background: var(--brand-soft); color: var(--brand); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.side-foot { border-top: 1px solid var(--line); padding: 10px 12px 12px; display: flex; flex-wrap: wrap; gap: 2px 4px; align-items: center; }
.side-foot .me { width: 100%; font-size: 13px; font-weight: 600; padding: 0 6px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot button { font-size: 12px; }
.main { min-width: 0; height: 100vh; overflow: hidden; }
.view { height: 100%; }

/* ── 페이지 모양(통계·고객·설정 등) ── */
.page { overflow-y: auto; background: var(--canvas); }
.page-in { max-width: 920px; margin: 0 auto; padding: 32px 32px 64px; }
.page-in.wide { max-width: 1360px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -.3px; display: flex; align-items: center; }
.page-head .sub { font-size: 13px; margin-top: 4px; max-width: 640px; }
.page-head input[type="search"] { width: min(320px, 70vw); }
.head-ops { display: flex; align-items: center; gap: 12px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.two .card { padding: 20px 0 0; overflow: hidden; }
.two .card h2 { padding: 0 20px; }

/* ── 수신함 ── */
.inbox { display: grid; grid-template-columns: 320px minmax(0, 1fr) 320px; }
.list, .side { overflow-y: auto; min-height: 0; }
.list { border-right: 1px solid var(--line); }
.side { border-left: 1px solid var(--line); padding: 4px 16px 24px; background: var(--canvas); }
.tabs { display: flex; padding: 12px 12px 0; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; border-radius: 0; background: none; padding: 8px 4px 10px; color: var(--sub); border-bottom: 2px solid transparent; font-weight: 500; }
.tabs button:hover:not([disabled]) { background: none; color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--brand); font-weight: 600; border-bottom-color: var(--brand); }
.search { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.search input[type="search"] { width: 100%; background: var(--soft); }
.mine { color: var(--body); }
.filters { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#filter-tag { max-width: 130px; }
#snooze-pick { max-width: 150px; padding: 5px 6px; }
#macro-form > .compose-row:last-child { margin-top: 18px; }
.thread.drop { outline: 2px dashed var(--ink); outline-offset: -6px; }
#convs { list-style: none; margin: 0; padding: 0; }
#convs li { padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
#convs li:hover { background: var(--soft); }
#convs li[aria-current="true"] { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
#convs .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
#convs .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#convs .prev { color: var(--sub); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
/* 우선·자동 배지·태그 칩 줄 — 많으면 다음 줄로 */
#convs .chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
#convs .chips .tag { margin-left: 0; }

.thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--soft); }
/* 상담 칸이 좁으면(오른쪽 도구 칸이 열려 있을 때) 단추 줄이 아래로 내려간다 — 이름 칸이 세로로 찌그러지지 않게. */
.thread header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; padding: 12px 20px; background: var(--canvas); border-bottom: 1px solid var(--line); }
.thread header .grow { flex: 1 1 240px; }
.thread header .actions { margin-left: auto; }
.thread header strong { font-size: 15px; }
.thread header .sub { display: block; overflow: hidden; text-overflow: ellipsis; }
.actions { display: flex; gap: 6px; flex: none; align-items: center; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--canvas); }
.segmented button { border: 0; border-radius: 0; padding: 5px 12px; color: var(--sub); font-size: 13px; }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button[aria-pressed="true"] { background: var(--brand); color: #fff; }
.assign { font-size: 12px; padding: 2px 6px; max-width: 200px; border-radius: var(--r-sm); }
.viewers { color: var(--danger); }
.log { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 72%; padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; border: 1px solid var(--line); background: var(--canvas); }
.msg.customer { align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.agent { align-self: flex-end; background: var(--brand); color: #fff; border-color: var(--brand); border-bottom-right-radius: 4px; }
/* 보낸 쪽을 색으로 가른다: 상담원 = 파랑, 워크플로 자동 안내 = 회색 점선, AI = 연두 */
.msg.bot { align-self: flex-end; background: var(--soft); border-style: dashed; border-color: var(--line-strong); color: var(--body); }
.msg.bot.ai { background: #f7ffd1; border-style: solid; border-color: #b7cc00; }
.kind { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 600; line-height: 15px; vertical-align: 1px; }
.kind.agent { background: var(--brand); color: #fff; }
.kind.bot { background: #e5e7eb; color: #374151; }
.kind.ai { background: var(--neon); color: #1f2a00; }
.kind.customer { background: var(--ink); color: #fff; }
.legend { display: inline-flex; gap: 8px; align-items: center; font-size: 11px; color: var(--sub); }
.legend .kind { font-size: 10px; padding: 0 6px; line-height: 14px; }
.msg img { max-width: 260px; max-height: 260px; display: block; border-radius: 6px; margin-bottom: 4px; }
.msg a, .note a { color: inherit; text-decoration: underline; word-break: break-all; }
.meta { font-size: 11px; color: var(--sub); margin-bottom: 6px; }
.meta.agent, .meta.bot { align-self: flex-end; }
.note { align-self: center; font-size: 12px; color: var(--note-text); background: var(--note-bg); border-radius: var(--r-md); padding: 4px 10px; margin: 2px 0 6px; max-width: 90%; white-space: pre-wrap; word-break: break-word; }
.reply { position: relative; display: flex; gap: 8px; padding: 12px 20px; background: var(--canvas); border-top: 1px solid var(--line); align-items: flex-end; }
.compose { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.compose textarea { min-height: 68px; }
.compose-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.compose-row button { font-size: 13px; padding: 4px 10px; }
.reply.note-on textarea { background: var(--note-bg); color: var(--note-text); border-color: #e2c87a; }
.reply.note-on button.primary { background: var(--note-text); border-color: var(--note-text); }
.macro-pop { position: absolute; left: 20px; right: 110px; bottom: calc(100% - 4px); list-style: none; margin: 0; padding: 4px; background: var(--canvas); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 8px 24px rgba(17, 17, 17, .12); max-height: 260px; overflow-y: auto; z-index: 5; }
.macro-pop li { display: flex; gap: 10px; padding: 6px 8px; border-radius: var(--r-sm); cursor: pointer; }
.macro-pop li[aria-selected="true"] { background: var(--hover); }

.side section { padding: 16px 0; border-bottom: 1px solid var(--line); }
.side section:last-child { border-bottom: 0; }
.side h2 { font-size: 12px; margin-bottom: 8px; color: var(--sub); font-weight: 600; }
.side pre { white-space: pre-wrap; word-break: break-word; font: inherit; margin: 8px 0 0; }
.side input[type="search"] { width: 100%; }
#draft-text { background: var(--soft); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px; color: var(--ink); margin-bottom: 8px; }
.macro-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 38vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.macro-list:empty { display: none; }
.macro-list button { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; text-align: left; padding: 7px 10px; display: flex; justify-content: space-between; gap: 8px; font-weight: 400; }
.macro-list li:last-child button { border-bottom: 0; }
.mt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms { color: var(--sub); font-size: 12px; flex: none; }
.related, .orders, .events { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.related button { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; text-align: left; padding: 7px 0; display: flex; flex-direction: column; gap: 2px; font-weight: 400; }
.orders button { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; text-align: left; padding: 8px 0; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-weight: 400; white-space: normal; }
.orders .mt { font-weight: 600; }
.orders .oi { grid-column: 1 / -1; color: var(--body); white-space: normal; }
.events li { padding: 5px 0; border-bottom: 1px solid var(--line); word-break: break-all; }
.only-narrow { display: none; }

/* ── 상담 통계 ── */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .k { font-size: 12px; color: var(--sub); }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.5px; margin-top: 4px; font-variant-numeric: tabular-nums; color: var(--brand); }
.stat .v small { font-size: 13px; font-weight: 500; color: var(--sub); margin-left: 3px; }
.stat .d { font-size: 12px; color: var(--sub); margin-top: 2px; }
.heat { border-collapse: separate; border-spacing: 2px; font-size: 11px; color: var(--sub); width: 100%; min-width: 620px; table-layout: fixed; }
.heat th { font-weight: 500; text-align: center; padding: 0; }
.heat th[scope="row"] { width: 28px; text-align: left; }
.heat td { height: 22px; border-radius: 3px; background: var(--soft); text-align: center; color: #fff; font-size: 10px; padding: 0; }
.sidebar .brand { color: var(--brand); }
.heat td.lo { color: var(--ink); }
.scroll-x { overflow-x: auto; }
.two .card td.wrap { max-width: none; word-break: break-all; }
#tag-input { width: 130px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; border-bottom: 1px solid var(--line); }
.bars .bar { flex: 1; min-width: 0; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 1px; }
.bars .bar.zero { background: var(--line); }
.bars .bar:hover { background: #0b0b8f; }
#stat-days-note { display: flex; justify-content: space-between; margin-top: 6px; }

/* ── 고객 ── */
.pills { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pills button { border-radius: 999px; padding: 5px 12px; font-size: 13px; display: inline-flex; gap: 6px; align-items: baseline; color: var(--body); }
.pills button[aria-pressed="true"] { background: var(--brand); color: #fff; border-color: var(--brand); }
.pills button[aria-pressed="true"] .sub { color: #d1d5db; }
.seg-ops { margin: -6px 0 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#seg-form > .compose-row:last-child { margin-top: 18px; }
.cust-body { display: flex; gap: 16px; align-items: flex-start; }
.cust-table { flex: 1; min-width: 0; overflow-x: auto !important; margin-bottom: 0; }
/* 정렬 머리글: 누르면 오름/내림, 지금 정렬 열은 파랑 화살표 */
.table th button.sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; color: inherit; font: inherit; white-space: nowrap; }
.table th button.sort .arrow { font-size: 9px; color: var(--line-strong); }
.table th[aria-sort] button.sort { color: var(--ink); font-weight: 600; }
.table th[aria-sort] button.sort .arrow { color: var(--brand); }
.table th.num button.sort { float: right; }
.pager { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 13px; }
.pager select { font-size: 12px; padding: 2px 4px; }
.pager .pages { display: inline-flex; gap: 4px; margin-left: auto; }
.pager .pages button { min-width: 30px; padding: 3px 8px; font-size: 12px; }
.pager .pages button[aria-current="page"] { background: var(--brand); color: #fff; border-color: var(--brand); }
#cust-more { margin: 12px 14px; }
.cust-detail { width: 360px; flex: none; position: sticky; top: 0; max-height: calc(100vh - 64px); overflow-y: auto; margin-bottom: 0; }
.cust-detail > .quiet { float: right; }
.cust-detail h2 { font-size: 17px; margin-bottom: 12px; }
.cust-detail h3 { font-size: 12px; color: var(--sub); font-weight: 600; margin: 20px 0 8px; }
.cust-detail input, .cust-detail textarea { width: 100%; }
.cust-detail .row input { width: auto; }

/* ── 시작 메뉴 편집 ── */
.menu-body { display: flex; gap: 24px; align-items: flex-start; }
.menu-edit { flex: 1; min-width: 0; }
.menu-preview { width: 340px; flex: none; position: sticky; top: 0; display: flex; flex-direction: column; gap: 8px; }
#menu-add { margin-bottom: 16px; }
.mb { border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); margin-bottom: 12px; background: var(--canvas); }
.mb-head { display: flex; gap: 8px; align-items: center; padding: 12px 14px; background: var(--soft); border-bottom: 1px solid var(--line); border-radius: var(--r-lg) var(--r-lg) 0 0; flex-wrap: wrap; }
.mb-head .no { width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.mb-head input[type="text"] { flex: 1; min-width: 160px; font-weight: 600; }
.mb-head .ops { display: flex; gap: 4px; }
.mb-head .ops button { padding: 4px 8px; font-size: 12px; }
.mb-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.fl { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; }
.fl > input, .fl > textarea { font-weight: 400; }
.fl-row { display: flex; gap: 12px; flex-wrap: wrap; }
.fl-row .fl { flex: 1; min-width: 180px; }
.sub-box { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; background: var(--soft); display: flex; flex-direction: column; gap: 10px; }
.sub-box > strong { font-size: 13px; }
.kid { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--canvas); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.kid-head, .field-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kid-head input[type="text"], .field-row input[type="text"] { flex: 1; min-width: 140px; }
.kid-head button, .field-row button { padding: 4px 8px; font-size: 12px; }
.sub-box > button { align-self: flex-start; font-size: 13px; }
.phone { border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 24px rgba(17, 17, 17, .08); overflow: hidden; background: var(--canvas); }
.phone-head { background: var(--brand); color: #fff; padding: 12px 16px; font-weight: 600; }
.phone-log { height: 480px; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--soft); }
.pm { max-width: 88%; padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; font-size: 13px; }
.pm.bot { align-self: flex-start; background: var(--canvas); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.pm.me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.pm.sys { align-self: center; background: none; color: var(--sub); font-size: 12px; text-align: center; }
.popts { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.popts button { border-radius: 999px; font-size: 13px; padding: 6px 12px; white-space: normal; text-align: left; }
.pform { align-self: stretch; background: var(--canvas); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.pform strong { font-size: 13px; }
.pform input, .pform textarea { font-size: 13px; padding: 5px 8px; }
.pform button { align-self: flex-start; margin-top: 4px; }

/* ── 운영 시간·팀·캠페인 편집 ── */
.hours { display: flex; flex-wrap: wrap; gap: 14px; font-size: 14px; align-items: center; }
.hours input { width: 72px; }
.holidays { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.holidays li { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--r-md); padding: 3px 4px 3px 10px; font-size: 13px; }
.holidays li.hint { border: 0; padding: 0; margin: 0; }
.holidays li button { font-size: 12px; padding: 2px 8px; }
.preview { background: var(--soft); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; white-space: pre-wrap; font: inherit; font-size: 13px; margin: 0; }
.temp { margin: 0 0 16px; padding: 14px 16px; border: 1px solid var(--brand); border-radius: var(--r-lg); background: var(--soft); }
.temp p { margin-bottom: 8px; font-size: 13px; }
.temp code { font-size: 16px; letter-spacing: .5px; user-select: all; margin-right: 10px; padding: 2px 8px; background: var(--canvas); }
#agents select { padding: 4px 8px; font-size: 13px; }
#agents-msg { margin: 0 0 12px; }

dialog { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--canvas); color: var(--ink); padding: 24px 28px 28px; width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 20px 50px rgba(17, 17, 17, .2); }
dialog::backdrop { background: rgba(17, 17, 17, .45); }
dialog header { display: flex; justify-content: space-between; align-items: center; }
dialog h2 { font-size: 18px; }
dialog h3 { font-size: 14px; margin: 22px 0 8px; }
.conds { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.cond { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cond input { width: 130px; }
.cond button { font-size: 12px; padding: 3px 8px; }
#camp-form .hours input { width: 80px; }
#camp-form .hours { margin-bottom: 6px; }
#camp-form .wide-num { width: 120px; }
#camp-form .mini { width: 64px; padding: 3px 6px; }
.camp-msg { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.camp-msg .stack { flex: 1; min-width: 260px; }
.bubble-preview { width: 260px; }
.bubble { margin-top: 6px; border: 1px solid var(--line-strong); border-radius: var(--r-lg); padding: 12px; background: var(--canvas); white-space: pre-wrap; display: flex; flex-direction: column; gap: 10px; font-size: 14px; box-shadow: 0 6px 20px rgba(17, 17, 17, .1); }
.bubble-btn { background: var(--brand); color: #fff; border-radius: var(--r-md); padding: 8px; text-align: center; }
#camp-form > .compose-row:last-child { margin-top: 18px; }

/* ── 화면이 좁아질 때 ── */
@media (max-width: 1280px) {
  .inbox { grid-template-columns: 280px minmax(0, 1fr) 280px; }
  .shell { grid-template-columns: 208px minmax(0, 1fr); }
  .menu-preview { width: 300px; }
  .cust-detail { width: 320px; }
}
@media (max-width: 1024px) {
  .menu-body { flex-direction: column; }
  .menu-preview { position: static; width: 100%; max-width: 380px; }
  .cust-body { flex-direction: column; }
  .cust-table, .cust-detail { width: 100%; }
  .cust-detail { position: static; max-height: none; }
}
/* 휴대폰: 메뉴는 서랍으로, 수신함은 목록 → 대화 → 도구를 한 화면에 하나씩 */
@media (max-width: 820px) {
  .only-narrow { display: inline-block; }
  .shell { display: block; height: 100dvh; }
  .topbar { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 10px; border-bottom: 1px solid var(--line); background: var(--canvas); }
  .topbar button { border: 0; font-size: 18px; padding: 4px 10px; }
  .main { height: calc(100dvh - 48px); }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 260px; z-index: 30; transform: translateX(-100%); visibility: hidden; }
  body.nav-open .sidebar { transform: none; visibility: visible; box-shadow: 0 0 40px rgba(17, 17, 17, .25); }
  body.nav-open .nav-shade { display: block; position: fixed; inset: 0; background: rgba(17, 17, 17, .35); z-index: 25; }
  .inbox { display: block; }
  .inbox .list, .inbox .thread, .inbox .side { height: 100%; }
  .inbox .thread, .inbox .side { display: none; }
  body.view-thread .inbox .list { display: none; }
  body.view-thread .inbox .thread { display: flex; }
  body.view-tools .inbox .thread { display: none; }
  body.view-tools .inbox .side { display: block; border-left: 0; }
  .thread header { flex-wrap: wrap; padding: 8px 10px; gap: 6px; }
  /* 단추가 한 줄에 안 들어가면 다음 줄로 — 상태 단추(진행중·보류·종료)가 눌려 잘리지 않게 */
  .thread header .actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .thread header .segmented { flex: none; }
  /* 화면 머리의 검색칸·만들기 단추도 좁으면 줄바꿈(매크로 화면의 '매크로 만들기'가 화면 밖으로 나가던 문제) */
  .page-head .head-ops { width: 100%; flex-wrap: wrap; }
  .page-head input[type="search"] { width: 100%; }
  /* 팀 멤버 표의 이름이 한 글자씩 세로로 쪼개지지 않게(표는 카드 안에서 가로 스크롤) */
  #agents td, #team-list td { white-space: nowrap; }
  .log { padding: 12px; }
  .msg { max-width: 88%; }
  .reply { padding: 8px 10px; flex-direction: column; align-items: stretch; }
  .macro-pop { left: 10px; right: 10px; }
  input, textarea, select { font-size: 16px !important; }
  .page-in { padding: 20px 16px 48px; }
  .card { padding: 16px; }
  dialog { padding: 16px 16px 20px; }
}
@media (prefers-reduced-motion: no-preference) {
  .sidebar { transition: transform .16s ease-out; }
}
.pre { white-space: pre-wrap; word-break: break-word; }
.full { width: 100%; }
ul.plain { padding-left: 18px; white-space: normal; }
ul.plain li { margin: 4px 0; }
.mini-num { width: 90px; }
.mb.off .mb-head .no { background: var(--line-strong); }
.mb.hit { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
#rules-add { margin-top: 4px; }
#away-text, #away-auto { margin: 10px 0; }
.outline, .outline ul { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.outline ul { margin-left: 10px; padding-left: 12px; border-left: 1px solid var(--line); }
.outline li { padding: 2px 0; }
.outline button { border: 0; background: none; padding: 1px 4px; font-weight: 600; border-radius: 4px; }
.outline .via { color: var(--sub); }
.outline .back { color: var(--sub); font-style: normal; }
.mb-head .no.letter { width: auto; min-width: 22px; padding: 0 6px; border-radius: 11px; }
.act { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--canvas); }
.act-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.act-head .ops { display: flex; gap: 4px; }
.act-head .ops button { padding: 2px 7px; font-size: 12px; }
.act.plain { background: var(--soft); }
.btn-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.btn-row input[type="text"] { flex: 1; min-width: 140px; }
.btn-row select { max-width: 220px; }
.btn-row button { padding: 4px 8px; font-size: 12px; }
.btn-row .arrow { color: var(--sub); }
select.missing { border-color: var(--danger); }
.mb.flash { box-shadow: 0 0 0 2px var(--brand); }
.wf-tabs-row { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.wf-tabs-row .pills { margin: 0; }
#wf-new { padding: 5px 8px; max-width: 220px; }
#wf-trigger-card .fl { margin-bottom: 10px; }
#wf-delete { margin-left: auto; }
.canvas-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--soft); flex-wrap: wrap; }
.canvas { position: relative; height: 540px; overflow: auto; background-color: var(--canvas); background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 20px 20px; }
#wf-nodes { position: relative; }
#wf-sizer { position: relative; overflow: hidden; }
#wf-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.canvas-tools { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.canvas-tools .segmented button { padding: 3px 10px; font-size: 12px; min-width: 32px; font-variant-numeric: tabular-nums; }
#wf-lines { position: absolute; left: 0; top: 0; pointer-events: none; }
.edge { fill: none; stroke: #9ca3af; stroke-width: 1.5; }
.edge.hot { stroke: var(--brand); stroke-width: 2; }
.edge.tmp { stroke: var(--brand); stroke-dasharray: 5 4; }
.node { position: absolute; width: 240px; background: var(--canvas); border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow); cursor: grab; user-select: none; touch-action: none; font-size: 13px; }
.node.sel { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.node.start { border-top: 3px solid var(--neon); }
.node-head { display: flex; align-items: center; gap: 8px; padding: 9px 10px 4px; font-weight: 600; }
.node-head .no { width: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--brand); color: #fff; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.node-acts { padding: 0 10px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node .out { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 5px 6px 5px 10px; border-top: 1px solid var(--line); min-height: 28px; }
.node .out.missing .mt { color: var(--danger); }
.port { width: 14px; height: 14px; border-radius: 50%; background: var(--canvas); border: 2px solid var(--brand); flex: none; cursor: crosshair; margin-right: -13px; }
.port:hover { background: var(--brand); }
.sim-ctx { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 10px; background: var(--soft); }
.sim-ctx input[type="text"] { width: 110px; padding: 2px 6px; font-size: 12px; }
#wf-mode button { padding: 6px 12px; }

/* ── 아이콘(선 그림, 글자색 따라감) ── */
.ic { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; margin-right: 7px; }
h1 .ic { width: 22px; height: 22px; vertical-align: -4px; margin-right: 9px; }
#nav button .ic { color: var(--sub); }
#nav button[aria-current="page"] .ic { color: var(--brand); }
.tabs button .ic { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }
button.primary .ic { stroke-width: 2.2; }
.empty { margin-top: 26vh; }
.empty-ic .ic { width: 40px; height: 40px; margin: 0 0 10px; color: var(--line-strong); stroke-width: 1.5; }
.empty p { margin: 0; }
.stat .k .ic { width: 14px; height: 14px; margin-right: 5px; vertical-align: -2px; color: var(--sub); }
/* 상담 목록의 머리글자 동그라미 */
#convs li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; align-items: start; }
#convs .av { width: 34px; height: 34px; border-radius: 50%; background: var(--soft); border: 1px solid var(--line); color: var(--body); font-weight: 600; font-size: 13px; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
#convs li[aria-current="true"] .av { background: var(--brand); color: #fff; border-color: var(--brand); }
#convs .av.guest { color: var(--sub); font-weight: 500; }
#convs .body { min-width: 0; }
.login h1 .ic { width: 20px; height: 20px; }

/* 주문관리시스템 화면 안(iframe): 위쪽 상표·로그아웃을 숨긴다(주문관리 화면이 이미 감싸고 있다) */
body.embed .sidebar .brand, body.embed #logout, body.embed .topbar strong { display: none; }

/* 비밀번호 칸 눈 단추 */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 40px; }
.pw-wrap .pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); margin: 0; padding: 6px; border: 0; background: none; color: var(--muted, #6b6b7b); cursor: pointer; line-height: 0; border-radius: 6px; }
.pw-wrap .pw-eye:hover { color: var(--ink); background: none; }
.pw-wrap .pw-eye:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.pw-wrap .pw-eye .ic { width: 18px; height: 18px; }
.login .pw-wrap .pw-eye { margin-top: 0; padding: 6px; }

/* 캠페인 미리보기 이미지 */
.bubble .bubble-img { display: block; width: 100%; max-height: 200px; object-fit: cover; border-radius: 8px; margin-bottom: 8px; }
/* 네이버 톡톡 전송 결과(10-23) */
.talk-fail { color: #a11919; font-weight: 600; }
.talk-ok { color: #146c3a; }
.linkish { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }
/* 사진 크게 보기(10-23) */
.msg img.zoomable { cursor: zoom-in; }
.msg img.zoomable:focus-visible { outline: 3px solid var(--neon, #cefe01); outline-offset: 2px; }
dialog.img-view { padding: 0; width: auto; max-width: 96vw; max-height: 96vh; background: #111; border: 0; overflow: hidden; display: none; }
dialog.img-view[open] { display: flex; flex-direction: column; }
dialog.img-view::backdrop { background: rgba(0, 0, 0, .8); }
.iv-bar { display: flex; gap: 8px; align-items: center; padding: 8px 10px; background: #111; color: #fff; flex-wrap: wrap; }
.iv-name { flex: 1 1 120px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.iv-bar .btn, .iv-bar button { background: #fff; color: #111; border: 0; border-radius: 6px; padding: 6px 10px; font-size: 13px; text-decoration: none; cursor: pointer; }
#iv-img { display: block; max-width: 96vw; max-height: calc(96vh - 52px); width: auto; height: auto; object-fit: contain; margin: 0 auto; }

/* AI 상담 분석(10-25): 머리글 한 줄 요약 + 보조칸 카드 */
.ai-line { display: block; margin-top: 4px; color: var(--body); }
.ai-line::before { content: "AI"; font-size: 10px; font-weight: 700; color: #fff; background: #0e0daf; border-radius: 4px; padding: 1px 4px; margin-right: 6px; vertical-align: 1px; }
.ai-card h2 { display: flex; align-items: center; justify-content: space-between; }
.ai-card .small { font-size: 12px; font-weight: 500; }
.ai-sum { margin: 6px 0; font-weight: 600; line-height: 1.45; }
.ai-chips { margin: 4px 0 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.ai-chips .tag { margin-left: 0; }
.ai-chips .tag.urg-high { background: #fde8e8; border-color: #f5b5b5; color: #a11b1b; font-weight: 600; }
.ai-chips .tag.mood-unhappy { background: #fff1dd; border-color: #f5c98a; color: #9a4b00; }
.ai-chips .tag.b2b { background: #e8ebff; border-color: #b9bff5; color: #0e0daf; }
.ai-facts { margin: 0 0 8px; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 13px; }
.ai-facts dt { color: var(--sub); white-space: nowrap; }
.ai-facts dd { margin: 0; color: var(--body); }
.ai-next { margin: 0 0 8px; font-size: 13px; line-height: 1.45; padding: 8px 10px; background: var(--soft); border-radius: 8px; }
.ai-next::before { content: "다음 할 일 · "; color: var(--sub); }
.ai-badges { margin: 0 0 6px; font-size: 13px; }
.ai-badges button { margin-left: 6px; }
