/* Help center — shared styles for portal (customer) and console (agent/admin). No inline styles (CSP).
   Palette: warm ivory canvas, deep ink, champagne gold accent — same family as the Mojit admin. */
:root {
  --ink: #1c1a17;
  --ink-2: #3b3730;
  --muted: #8a8478;
  --line: #e6e1d6;
  --line-soft: #efebe2;
  --canvas: #f7f5f0;
  --paper: #ffffff;
  --soft: #f3efe6;
  --gold: #a4863a;
  --gold-dark: #86692a;
  --gold-light: #c9a961;
  --gold-tint: #f5efe0;
  --rail: #1d1b18;
  --rail-ink: #b9b2a5;
  --ok: #4a6b57;     --ok-bg: #e8efe9;
  --warn: #9a6a1f;   --warn-bg: #f6ecd9;
  --err: #a3443a;    --err-bg: #f6e4e1;
  --info: #44586e;   --info-bg: #e5eaf0;
  --kakao: #fee500;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(28, 26, 23, .04), 0 4px 16px rgba(28, 26, 23, .04);
  --font: "Pretendard Variable", Pretendard, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;

  /* Bootstrap hooks */
  --bs-body-font-family: var(--font);
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--canvas);
  --bs-border-color: var(--line);
  --bs-secondary-color: var(--muted);
  --bs-link-color-rgb: 134, 105, 42;
  --bs-link-hover-color-rgb: 28, 26, 23;
  --bs-border-radius: var(--radius-sm);
  --bs-focus-ring-color: rgba(164, 134, 58, .22);
}

body { font-family: var(--font); color: var(--ink); background: var(--canvas); letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 0; }
a { color: var(--gold-dark); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }
.text-muted { color: var(--muted) !important; }
h1, h2, h3 { letter-spacing: -0.025em; }
::selection { background: var(--gold-tint); }

/* ---------- brand ---------- */
.brand-mark { width: 34px; height: 34px; border-radius: 9px; display: inline-grid; place-items: center; flex: none;
  background: var(--ink); color: var(--gold-light); font-family: Georgia, "Times New Roman", serif; font-size: 1.05rem; font-weight: 700; }
.brand-mark-lg { width: 48px; height: 48px; border-radius: 12px; font-size: 1.4rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-weight: 700; font-size: 1rem; letter-spacing: -0.02em; }
.brand-text small { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: .72rem; letter-spacing: .04em; color: var(--muted); }
.eyebrow { font-size: .72rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin-bottom: 10px; }

/* ---------- Bootstrap refinements ---------- */
.btn { white-space: nowrap; --bs-btn-font-weight: 600; --bs-btn-border-radius: var(--radius-sm); --bs-btn-padding-x: 1rem; letter-spacing: -0.01em;
  --bs-btn-focus-box-shadow: 0 0 0 3px rgba(164, 134, 58, .22); transition: background-color .15s, border-color .15s, color .15s; }
.btn-sm { --bs-btn-border-radius: 7px; --bs-btn-padding-x: .7rem; }
.btn-brand { --bs-btn-bg: var(--ink); --bs-btn-border-color: var(--ink); --bs-btn-color: #fff;
  --bs-btn-hover-bg: #34302a; --bs-btn-hover-border-color: #34302a; --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: #000; --bs-btn-active-border-color: #000; --bs-btn-active-color: #fff;
  --bs-btn-disabled-bg: #8f8a80; --bs-btn-disabled-border-color: #8f8a80; --bs-btn-disabled-color: #fff; }
.btn-outline-brand { --bs-btn-color: var(--ink); --bs-btn-border-color: var(--ink); --bs-btn-bg: transparent;
  --bs-btn-hover-bg: var(--ink); --bs-btn-hover-border-color: var(--ink); --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: #000; --bs-btn-active-color: #fff; }
.btn-outline-secondary { --bs-btn-color: var(--ink-2); --bs-btn-border-color: var(--line); --bs-btn-bg: var(--paper);
  --bs-btn-hover-bg: var(--soft); --bs-btn-hover-border-color: #d6cfc0; --bs-btn-hover-color: var(--ink);
  --bs-btn-active-bg: var(--soft); --bs-btn-active-border-color: #d6cfc0; --bs-btn-active-color: var(--ink);
  --bs-btn-disabled-color: var(--muted); --bs-btn-disabled-border-color: var(--line); }
.btn-outline-light { --bs-btn-color: var(--rail-ink); --bs-btn-border-color: rgba(255, 255, 255, .18); --bs-btn-hover-bg: rgba(255, 255, 255, .08); --bs-btn-hover-color: #fff; }
.btn-success { --bs-btn-bg: var(--ok); --bs-btn-border-color: var(--ok); --bs-btn-hover-bg: #3c5947; --bs-btn-hover-border-color: #3c5947; --bs-btn-active-bg: #3c5947; }
.btn-danger { --bs-btn-bg: var(--err); --bs-btn-border-color: var(--err); --bs-btn-hover-bg: #8a372e; --bs-btn-hover-border-color: #8a372e; --bs-btn-active-bg: #8a372e; }
.btn-outline-success { --bs-btn-color: var(--ok); --bs-btn-border-color: #b9cbbd; --bs-btn-hover-bg: var(--ok); --bs-btn-hover-border-color: var(--ok); --bs-btn-hover-color: #fff; }
.btn-outline-danger { --bs-btn-color: var(--err); --bs-btn-border-color: #e2bdb7; --bs-btn-hover-bg: var(--err); --bs-btn-hover-border-color: var(--err); --bs-btn-hover-color: #fff; }
.btn-kakao { background: var(--kakao); color: #191919; border: 0; }
.btn-kakao:hover { background: #f5dc00; color: #191919; }

.form-control, .form-select { border-color: var(--line); border-radius: var(--radius-sm); background-color: var(--paper); color: var(--ink); }
.form-control::placeholder { color: #b3ada1; }
.form-control:focus, .form-select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(164, 134, 58, .16); }
.form-control-sm, .form-select-sm { border-radius: 7px; }
.form-label { font-size: .8rem; font-weight: 600; color: var(--ink-2); margin-bottom: .35rem; }
.form-text { color: var(--muted); }
.form-check-input { border-color: #cfc8b9; }
.form-check-input:checked { background-color: var(--ink); border-color: var(--ink); }
.form-check-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(164, 134, 58, .18); }
.form-switch .form-check-input:focus:not(:checked) { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23a4863a'/%3e%3c/svg%3e"); }

.alert { border-radius: var(--radius-sm); border: 1px solid transparent; font-size: .9rem; }
.alert-success { background: var(--ok-bg); color: #2f4a39; border-color: #d3e0d6; }
.alert-danger { background: var(--err-bg); color: #7d2f27; border-color: #ecd0cb; }
.alert-warning { background: var(--warn-bg); color: #6f4c14; border-color: #ecdcbc; }
.alert-info { background: var(--info-bg); color: #33465a; border-color: #d3dbe4; }
.badge.text-bg-secondary { background: var(--soft) !important; color: var(--muted) !important; font-weight: 600; }

.table { --bs-table-bg: transparent; --bs-table-hover-bg: var(--canvas); --bs-table-border-color: var(--line-soft); color: var(--ink); margin-bottom: 0; }
.table > thead th, .table > thead tr.small th { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); background: #faf8f4; border-bottom: 1px solid var(--line); padding-top: .7rem; padding-bottom: .7rem; white-space: nowrap; }
.table > :not(caption) > * > * { padding-left: .9rem; padding-right: .9rem; }
.table-sm > :not(caption) > * > * { padding-top: .55rem; padding-bottom: .55rem; }
.table > tbody > tr:last-child > * { border-bottom: 0; }
.table > tbody > tr:hover > * { background: var(--canvas); }
.cmain .table { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); border-collapse: separate; border-spacing: 0;
  overflow: hidden; box-shadow: var(--shadow); }
.table-wrap { overflow-x: auto; }
.table a { color: var(--ink); text-decoration: none; font-weight: 600; }
.table a:hover { color: var(--gold-dark); }
.table a.btn { font-weight: 600; }
.cmain h2.h6 { font-size: .98rem; font-weight: 700; margin: 30px 0 12px; }

.modal-content { border: 0; border-radius: 16px; box-shadow: 0 24px 60px rgba(28, 26, 23, .18); }
.modal-header, .modal-footer { border-color: var(--line-soft); }
.pagination { --bs-pagination-color: var(--ink-2); --bs-pagination-active-bg: var(--ink); --bs-pagination-active-border-color: var(--ink);
  --bs-pagination-border-color: var(--line); --bs-pagination-hover-bg: var(--soft); --bs-pagination-focus-box-shadow: 0 0 0 3px rgba(164, 134, 58, .2); }

/* utilities (food uses u-* classes instead of inline styles) */
.u-wspre-wrap { white-space: pre-wrap; }
.u-maxw-240 { max-width: 240px; }
.u-w-80 { width: 80px; }
.u-w-200 { width: 200px; }

/* ================= portal ================= */
.portal { display: flex; flex-direction: column; min-height: 100vh; }
.portal-header { background: rgba(255, 255, 255, .86); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.portal-header-in { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.portal-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.portal-brand:hover { color: var(--ink); }
.portal-nav { display: flex; gap: 22px; font-size: .9rem; }
.portal-nav a { color: var(--ink); text-decoration: none; font-weight: 500; }
.portal-nav a:hover { color: var(--gold-dark); }
.portal-nav .portal-nav-muted { color: var(--muted); }
.portal-main { flex: 1; padding-top: 48px; padding-bottom: 64px; }
.portal-footer { border-top: 1px solid var(--line); padding: 26px 0; background: var(--paper); font-size: .82rem; color: var(--muted); }
.portal-footer-in { display: flex; gap: 8px 22px; flex-wrap: wrap; align-items: center; }
.portal-footer-brand { color: var(--ink); font-weight: 700; }
.portal-footer b { color: var(--ink-2); font-weight: 600; }
.portal-footer-note { margin-left: auto; }
@media (max-width: 640px) { .portal-footer-note { margin-left: 0; } .portal-nav { gap: 14px; } }

.portal-hero { padding: 8px 0 34px; }
.portal-hero h1 { font-size: clamp(1.8rem, 3.2vw, 2.5rem); font-weight: 700; margin-bottom: 10px; letter-spacing: -0.035em; }
.portal-hero .hero-lead { color: var(--muted); font-size: 1.02rem; margin: 0; }
.narrow { max-width: 720px; margin: 0 auto; }
.portal-main .narrow { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 40px 44px; box-shadow: 0 18px 48px rgba(28, 26, 23, .06); }
.portal-main .narrow h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.03em; }
@media (max-width: 640px) { .portal-main .narrow { padding: 26px 20px; } }

.login-box { max-width: 400px; margin: 24px auto; background: var(--paper); padding: 40px 36px 34px; border-radius: 18px;
  border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(28, 26, 23, .07); text-align: left; }
.login-box .brand-mark { margin-bottom: 18px; }
.login-title { font-size: 1.45rem; font-weight: 700; margin-bottom: 4px; }
.login-sub { color: var(--muted); font-size: .88rem; margin-bottom: 26px; }
.login-box .btn { padding-top: .65rem; padding-bottom: .65rem; margin-top: 6px; }

.channel-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.channel-card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px 24px; display: flex; flex-direction: column;
  box-shadow: var(--shadow); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.channel-card:not(.is-off):hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(28, 26, 23, .08); border-color: #ddd4c2; }
.channel-card h2 { font-size: 1.12rem; font-weight: 700; margin: 18px 0 8px; }
.channel-card .btn { margin-top: auto; padding-top: .6rem; padding-bottom: .6rem; }
.channel-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--gold-tint); color: var(--gold-dark); }
.channel-icon svg, .rail-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.channel-value { font-weight: 600; margin-bottom: 4px; color: var(--ink-2); }
.channel-hours { color: var(--muted); font-size: .84rem; margin-bottom: 20px; }
.channel-card.is-off { background: #fbfaf7; box-shadow: none; }
.channel-card.is-off .channel-icon { background: var(--soft); color: #b3ada1; }
.channel-card.is-off h2 { color: var(--muted); }
.channel-off { color: var(--muted); font-size: .88rem; margin: 0; }

/* customer chat */
.chat-page { max-width: 600px; margin: 0 auto; }
.chat-shell { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: 0 18px 48px rgba(28, 26, 23, .07); }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); background: #fcfbf8; }
.chat-head h1, .chat-head h2 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.chat-start, .chat-rating { padding: 22px 20px; }
.chat-body { padding: 0 0 14px; }
.conn-badge, .reg-badge { font-size: .72rem; font-weight: 600; padding: 3px 10px 3px 20px; border-radius: 999px; background: var(--soft); color: var(--muted); position: relative; white-space: nowrap; }
.conn-badge::before, .reg-badge::before { content: ""; position: absolute; left: 9px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: currentColor; opacity: .8; }
.conn-badge[data-state="open"], .reg-badge[data-state="ok"] { background: var(--ok-bg); color: var(--ok); }
.conn-badge[data-state="reconnecting"], .conn-badge[data-state="connecting"], .reg-badge[data-state="pending"] { background: var(--warn-bg); color: var(--warn); }
.reg-badge[data-state="error"] { background: var(--err-bg); color: var(--err); }
.chat-messages { list-style: none; margin: 0; padding: 18px 20px; height: 52vh; min-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.chat-messages.agent { height: auto; flex: 1; min-height: 0; background: #fcfbf8; }
.msg { max-width: 78%; }
.msg-meta { font-size: .7rem; color: var(--muted); margin-bottom: 4px; letter-spacing: 0; }
.msg-body { padding: 10px 14px; border-radius: 14px 14px 14px 4px; background: var(--soft); white-space: pre-wrap; word-break: break-word; line-height: 1.55; font-size: .93rem; }
.msg-customer { align-self: flex-end; text-align: right; }
.msg-customer .msg-body { background: var(--ink); color: #f6f3ec; text-align: left; border-radius: 14px 14px 4px 14px; }
.msg-customer .msg-body a { color: var(--gold-light); }
.chat-messages.agent .msg-customer { align-self: flex-start; text-align: left; }
.chat-messages.agent .msg-customer .msg-body { background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; }
.chat-messages.agent .msg-customer .msg-body a { color: var(--gold-dark); }
.chat-messages.agent .msg-agent { align-self: flex-end; text-align: right; }
.chat-messages.agent .msg-agent .msg-body { background: var(--ink); color: #f6f3ec; text-align: left; border-radius: 14px 14px 4px 14px; }
.chat-messages.agent .msg-agent .msg-body a { color: var(--gold-light); }
.msg-system { align-self: center; max-width: 92%; text-align: center; }
.msg-system .msg-body { background: var(--gold-tint); color: #6e5520; font-size: .82rem; border-radius: 999px; padding: 6px 14px; }
.msg-status { color: var(--muted); }
.typing { padding: 0 20px 8px; color: var(--muted); font-size: .8rem; }
.chat-composer { display: flex; gap: 8px; padding: 0 20px; align-items: flex-end; }
.chat-composer textarea { resize: none; }
.stars { display: flex; gap: 6px; font-size: 1.7rem; }
.stars input { position: absolute; opacity: 0; }
.stars span { color: #ddd6c8; cursor: pointer; transition: color .1s; }
.stars label:has(input:checked) span, .stars label:has(~ label input:checked) span { color: var(--gold); }
.stars:has(label:hover) span { color: #ddd6c8; }
.stars label:hover span, .stars label:has(~ label:hover) span { color: var(--gold); }

/* ================= console shell ================= */
.console { background: var(--canvas); }
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--rail) 236px, var(--canvas) 236px); }
.rail { background: var(--rail); color: var(--rail-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 22px 14px 16px; }
.rail-brand { display: flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; padding: 0 8px 22px; margin-bottom: 8px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.rail-brand:hover { color: #fff; }
.rail-brand .brand-mark { background: #2c2925; box-shadow: inset 0 0 0 1px rgba(201, 169, 97, .35); }
.rail-brand .brand-text small { color: #8d8678; }
.rail-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.rail-label { font-size: .66rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: #6f695e; padding: 18px 10px 8px; }
.rail-nav a { display: flex; align-items: center; gap: 11px; color: var(--rail-ink); text-decoration: none; padding: 9px 10px; border-radius: 8px; font-size: .9rem; font-weight: 500; position: relative; }
.rail-nav a svg { width: 18px; height: 18px; opacity: .8; flex: none; }
.rail-nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.rail-nav a.active { background: rgba(201, 169, 97, .12); color: #f3e7c9; }
.rail-nav a.active svg { color: var(--gold-light); opacity: 1; }
.rail-nav a.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold-light); }
.rail-off { margin-left: auto; font-size: .64rem; padding: 1px 7px; border-radius: 999px; background: rgba(255, 255, 255, .07); color: #8d8678; }
.rail-foot { border-top: 1px solid rgba(255, 255, 255, .07); padding: 14px 6px 0; display: flex; flex-direction: column; gap: 10px; }
.rail-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rail-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; background: #34302a; color: var(--gold-light); font-weight: 700; font-size: .85rem; }
.rail-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.rail-email { color: #e9e4d9; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-role { color: #8d8678; font-size: .7rem; }
.rail-logout { width: 100%; background: transparent; border: 1px solid rgba(255, 255, 255, .12); color: var(--rail-ink); border-radius: 8px; padding: 7px 0; font-size: .8rem; font-weight: 500; }
.rail-logout:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.rail-logout:focus-visible, .rail-nav a:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 2px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; background: var(--canvas); }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; }
  .rail-brand { border: 0; padding: 0 8px 0 0; margin: 0; }
  .rail-nav { flex-direction: row; overflow-x: auto; flex: 1 1 100%; order: 3; }
  .rail-nav a { white-space: nowrap; }
  .rail-nav a.active::before, .rail-label { display: none; }
  .rail-foot { border: 0; padding: 0; margin-left: auto; flex-direction: row; align-items: center; }
  .rail-who { display: none; }
  .rail-logout { width: auto; padding: 6px 12px; }
}

.cmain { padding: 30px 36px 40px; min-width: 0; }
@media (max-width: 760px) { .cmain { padding: 20px 16px; } }
.page-title { font-size: 1.55rem; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.03em; }
.page-title + .text-muted, .page-title + p { margin-bottom: 22px; }
.page-title + form, .page-title + .alert { margin-top: 18px; }
.cmain > main > .d-flex:first-child { margin-bottom: 22px !important; }
.narrow-form { max-width: 820px; }
form.narrow-form, .narrow-form > form { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 28px; box-shadow: var(--shadow); }
.card-title-sm { font-size: 1rem; font-weight: 700; margin: 0; display: flex; align-items: baseline; gap: 8px; }
.card-title-sm small { font-size: .66rem; font-weight: 600; letter-spacing: .14em; color: var(--muted); }

.console-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.console-top strong { font-size: 1.15rem; letter-spacing: -0.02em; margin-right: 4px; }
.status-select { width: auto; min-width: 150px; }
.stat-row { display: flex; gap: 8px; flex-wrap: wrap; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 7px 14px; font-size: .78rem; color: var(--muted); text-decoration: none; display: flex; align-items: baseline; gap: 6px; }
.stat b { color: var(--ink); font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat.active { border-color: var(--gold); color: var(--gold-dark); background: var(--gold-tint); }

.console-grid { display: grid; gap: 16px; grid-template-columns: 290px 330px 1fr; height: calc(100vh - 128px); min-height: 560px; }
@media (max-width: 1280px) { .console-grid { grid-template-columns: 1fr 1fr; height: auto; } .conversation { grid-column: 1 / -1; min-height: 620px; } }
@media (max-width: 760px) { .console-grid { grid-template-columns: 1fr; } }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; overflow: hidden; box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.panel-head h2 { font-size: .95rem; font-weight: 700; margin: 0; }
.panel-head { gap: 10px; }
.panel-head h2 { white-space: nowrap; flex: none; }
.panel-head .reg-badge, .panel-head .conn-badge { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.panel-sub { font-size: .68rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.panel-off { color: var(--muted); padding: 22px 18px; margin: 0; font-size: .88rem; line-height: 1.6; }
.panel:has(> .panel-off) { align-self: start; }   /* e.g. no extension: no tall empty column */
/* phone channel off: drop the phone column so the conversation gets the room */
.softphone.is-off { display: none; }
.console-grid:has(> .softphone.is-off) { grid-template-columns: 340px 1fr; height: calc(100vh - 128px); }
.console-grid:has(> .softphone.is-off) > .conversation { grid-column: auto; }
@media (max-width: 760px) { .console-grid:has(> .softphone.is-off) { grid-template-columns: 1fr; height: auto; } }

/* softphone */
.softphone { padding-bottom: 14px; overflow-y: auto; }
.softphone > :not(.panel-head) { margin-left: 18px; margin-right: 18px; }
.call-display { text-align: center; padding: 20px 0 14px; border-radius: 10px; }
.call-state { font-size: .8rem; color: var(--muted); }
.call-number { font-size: 1.45rem; font-weight: 700; min-height: 1.6em; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.call-timer { font-variant-numeric: tabular-nums; color: var(--muted); }
.softphone[data-mode="incoming"] .call-display { animation: ringing 1.2s ease-in-out infinite; }
@keyframes ringing { 50% { background: var(--gold-tint); } }
@media (prefers-reduced-motion: reduce) { .softphone[data-mode="incoming"] .call-display { animation: none; background: var(--gold-tint); } }
.incoming-actions, .active-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.active-actions .btn { flex: 1 1 45%; }
.dialer { display: flex; flex-direction: column; gap: 8px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.keypad button { border: 1px solid var(--line); background: #fcfbf8; border-radius: 10px; padding: 9px 0; font-size: 1.05rem; font-weight: 600; color: var(--ink); }
.keypad button:hover { background: var(--gold-tint); border-color: #e3d6b5; }
.recent-calls { list-style: none; padding: 0; margin: 0; font-size: .8rem; }
.recent-calls li { display: grid; grid-template-columns: 34px 1fr auto; gap: 4px 6px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); align-items: center; }
.recent-calls .when { grid-column: 2 / -1; color: var(--muted); }
.dir { font-weight: 700; }
.dir-INBOUND { color: var(--ok); }
.dir-OUTBOUND { color: var(--gold-dark); }

/* chat list */
.room-tabs { display: flex; border-bottom: 1px solid var(--line-soft); padding: 0 8px; }
.room-tabs button { flex: 1; border: 0; background: none; padding: 11px 4px; font-size: .84rem; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500; }
.room-tabs button:hover { color: var(--ink); }
.room-tabs button.active { color: var(--ink); border-bottom-color: var(--gold); font-weight: 700; }
.room-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.room-item { padding: 12px 12px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.room-item + .room-item { margin-top: 2px; }
.room-item:hover, .room-item:focus { background: var(--canvas); outline: none; }
.room-item:focus-visible { border-color: var(--gold); }
.room-item.active { background: var(--gold-tint); border-color: #eadfc3; }
.room-line { display: flex; gap: 6px; align-items: center; }
.room-line strong { flex: 1; font-size: .92rem; }
.room-sub { font-size: .76rem; color: var(--muted); display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.room-sub .when { margin-left: auto; font-variant-numeric: tabular-nums; }
.room-empty { padding: 40px 24px; text-align: center; color: var(--muted); font-size: .88rem; }
.unread { background: var(--err); color: #fff; border-radius: 999px; font-size: .68rem; font-weight: 700; padding: 1px 7px; }

/* conversation */
.conversation { min-height: 0; container: conv / inline-size; }
.conv-side .btn { white-space: nowrap; }
.empty-state { margin: auto; color: var(--muted); padding: 40px; text-align: center; font-size: .92rem; }
.empty-state::before { content: ""; display: block; width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; background: var(--gold-tint)
  url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a4863a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M4 5h16v11H8l-4 4z'/%3e%3cpath d='M8 9.5h8M8 12.5h5'/%3e%3c/svg%3e") center / 26px no-repeat; }
.conv { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.conv-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.conv-head h2, .conv-head strong { font-size: 1rem; font-weight: 700; }
.conv-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.conv-actions select { width: auto; max-width: 180px; }
.conv-body { display: grid; grid-template-columns: 1fr 280px; flex: 1; min-height: 0; }
@media (max-width: 900px) { .conv-body { grid-template-columns: 1fr; } }
/* narrow conversation (phone column on, smaller screens): customer panel moves under the messages.
   Must come after the .conv-body rule above. */
@container conv (max-width: 720px) {
  .conv-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .conv-side { border-left: 0; border-top: 1px solid var(--line-soft); max-height: 190px; }
}
.conv-main { display: flex; flex-direction: column; min-height: 0; padding-bottom: 14px; }
.conv-main .chat-composer { flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.conv-main .chat-composer select { flex-basis: 100%; }
.conv-main .chat-composer textarea { flex: 1; }
.conv-side { border-left: 1px solid var(--line-soft); padding: 0 18px 18px; overflow-y: auto; background: #fdfcfa; }
.customer-card { display: grid; grid-template-columns: 72px 1fr; gap: 6px 10px; font-size: .84rem; margin: 0; }
.customer-card dt { color: var(--muted); font-weight: 400; }
.customer-card dd { margin: 0; word-break: break-all; color: var(--ink); }
.history-list, .note-list { list-style: none; padding: 0; margin: 0 0 8px; font-size: .82rem; }
.history-list li, .note-list li { padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.ch-tag { display: inline-block; font-size: .68rem; font-weight: 600; padding: 1px 7px; border-radius: 5px; margin-right: 5px; background: var(--soft); color: var(--ink-2); }
.ch-PHONE { background: var(--ok-bg); color: var(--ok); }
.ch-CHAT { background: var(--gold-tint); color: var(--gold-dark); }
.ch-EMAIL { background: var(--info-bg); color: var(--info); }
.pop-number { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* status pills (rooms, calls, tickets, agents) */
.status-pill { display: inline-block; font-size: .7rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.st-WAITING, .st-RECEIVED, .st-RINGING, .st-AWAY { background: var(--warn-bg); color: var(--warn); }
.st-ACTIVE, .st-IN_PROGRESS, .st-ANSWERED, .st-ONLINE { background: var(--gold-tint); color: var(--gold-dark); }
.st-HOLD, .st-BUSY { background: var(--info-bg); color: var(--info); }
.st-CLOSED, .st-COMPLETED, .st-ENDED { background: var(--ok-bg); color: var(--ok); }
.st-ABANDONED, .st-MISSED, .st-REJECTED, .st-FAILED { background: var(--err-bg); color: var(--err); }
.prio { font-size: .7rem; font-weight: 600; padding: 2px 8px; border-radius: 5px; background: var(--soft); color: var(--ink-2); }
.p-URGENT { background: var(--err); color: #fff; }
.p-HIGH { background: var(--err-bg); color: var(--err); }
.p-LOW { color: var(--muted); }

/* tickets */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; padding: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.filter-bar .form-control, .filter-bar .form-select { width: auto; }
.ticket-layout { display: grid; grid-template-columns: 1fr 330px; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .ticket-layout { grid-template-columns: 1fr; } }
.thread { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-direction: column; gap: 12px; }
.thread-item { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.thread-item.k-OUTBOUND { border-left: 3px solid var(--gold); }
.thread-item.k-NOTE { background: #fdf9ef; border-style: dashed; box-shadow: none; }
.thread-meta { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); margin-bottom: 8px; }
.panel-form, .side-box { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.side-box .panel-sub { margin-top: 0; }

/* admin */
.channel-admin-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); align-items: start; }
.channel-admin-grid .side-box { margin: 0; }
.channel-admin-grid .side-box > .d-flex:first-child { padding-bottom: 14px; margin-bottom: 16px !important; border-bottom: 1px solid var(--line-soft); }
.channel-admin-grid .btn-brand { margin-top: 8px; }
.auto-reply-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
/* columns line up with the table header (th widths 80/200/auto/80/80, cell padding .9rem) */
.quick-row { display: grid; grid-template-columns: calc(80px - 1.8rem) calc(200px - 1.8rem) 1fr calc(80px - 1.8rem) calc(80px - 1.8rem); gap: 1.8rem; align-items: center; padding: .55rem .9rem; }
@media (max-width: 760px) { .quick-row { grid-template-columns: 1fr; } }

/* ---------- policy: 유형 코드, 처리 기한, 첨부, KPI ---------- */
.cat-tag { display: inline-block; font-size: .7rem; font-weight: 700; padding: 2px 7px; border-radius: 5px; background: var(--gold-tint); color: var(--gold-dark); letter-spacing: .02em; white-space: nowrap; }
.due { font-size: .75rem; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink-2); }
.due-soon { color: var(--warn); font-weight: 600; }
.due-overdue { color: var(--err); font-weight: 700; }
.stat.stat-alert b { color: var(--err); }
.stat.stat-alert.active { border-color: var(--err); background: var(--err-bg); color: var(--err); }
.attach-list { list-style: none; padding: 0; margin: 0 0 6px; display: grid; gap: 4px; }
.attach-list li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 26px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi-label { font-size: .75rem; color: var(--muted); }
.kpi-value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi-value small { font-size: .8rem; font-weight: 500; color: var(--muted); margin-left: 2px; }
.kpi-goal { font-size: .72rem; color: var(--muted); word-break: keep-all; }
.kpi.is-miss .kpi-value { color: var(--err); }
.kpi.is-met .kpi-value { color: var(--ok); }
.section-title { font-size: 1.05rem; font-weight: 700; margin: 8px 0 10px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.classify-form { display: grid; gap: 6px; margin-bottom: 4px; }

/* 사이트(도메인·브랜드) 구분: 목록 배지, 포털 로고 */
.site-tag { display: inline-block; font-size: .7rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap;
  background: var(--ink); color: var(--canvas); }
.brand-logo { height: 34px; max-width: 150px; object-fit: contain; flex: none; }
.room-site-filter { margin: 8px 0; }
.site-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.site-admin-grid .side-box { margin: 0; }
.secret-once { font-family: ui-monospace, Consolas, monospace; word-break: break-all; user-select: all; }
