/* ═══════════════════ Zoom's CRM · Design System ═══════════════════ */
:root {
  /* 밝은 화면 — 배경을 한 단계 눌러 카드가 떠 보이게 한다.
     예전 #f4f5fa 는 카드(#fff)와 밝기 차이가 1.09:1 이라 경계가 안 잡혔다. 지금은 1.27:1. */
  --bg:            #e8ecf3;
  --bg-elev:       #ffffff;
  --bg-sunken:     #f2f5fa;
  --bg-hover:      #eef2f8;
  --border:        #cfd7e4;
  --border-strong: #b3bfd2;
  --text:          #12172a;
  --text-soft:     #4b5468;
  --text-mute:     #79839a;
  --on-brand:      #ffffff;      /* 강조색 위에 얹는 글자색 */

  --brand:         #5b46e5;
  --brand-strong:  #4634d1;
  --brand-soft:    #eeecfe;
  --brand-text:    #4130bd;

  --ok:            #0f9d63;
  --ok-soft:       #e3f7ee;
  --warn:          #d97706;
  --warn-soft:     #fdf1de;
  --danger:        #dc2f45;
  --danger-soft:   #fdeaec;
  --info:          #1a73c7;
  --info-soft:     #e6f1fc;
  --purple:        #8b46d4;
  --purple-soft:   #f4eafc;

  --header-1:      #221c52;
  --header-2:      #3b2c96;
  --header-3:      #5b3fb8;

  --radius:        12px;
  --radius-sm:     8px;
  --radius-xs:     6px;
  --shadow-sm:     0 1px 3px rgba(18, 23, 42, .10), 0 4px 14px rgba(18, 23, 42, .05);
  --shadow:        0 2px 8px rgba(22, 25, 43, .07), 0 1px 2px rgba(22, 25, 43, .04);
  --shadow-lg:     0 18px 48px rgba(22, 25, 43, .18);
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI",
          "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "D2Coding", monospace;
}

html[data-theme="dark"] {
  /* 어두운 화면 — malsung.shop 배색.
     배경과 패널의 밝기 차이는 작지만(1.09:1) 선을 진하게 쓰고(1.40:1)
     강조색인 청록이 배경 대비 11:1 로 튀어서 구분이 된다. */
  --bg:            #061018;
  --bg-elev:       #0a1b25;
  --bg-sunken:     #08151d;
  --bg-hover:      #112a36;
  --border:        #183746;
  --border-strong: #22485a;
  --text:          #eaf8ff;
  --text-soft:     #a8c2d0;
  --text-mute:     #7f9eae;

  --brand:         #32e6c4;
  --brand-strong:  #5cf0d6;
  --brand-soft:    #0d2b2f;
  --brand-text:    #7ff2dd;
  --on-brand:      #03110e;      /* 청록 위에는 어두운 글자라야 읽힌다 */

  --ok:            #3ddc97;
  --ok-soft:       #0c2b22;
  --warn:          #f5b657;
  --warn-soft:     #2f2411;
  --danger:        #ff7185;
  --danger-soft:   #331820;
  --info:          #5ab8f0;
  --info-soft:     #0d2634;
  --purple:        #b58bf0;
  --purple-soft:   #241a35;

  --header-1:      #040d14;
  --header-2:      #07202b;
  --header-3:      #0d3a41;
  --shadow-sm:     0 1px 2px rgba(0, 0, 0, .40);
  --shadow:        0 2px 10px rgba(0, 0, 0, .45), 0 1px 3px rgba(0, 0, 0, .35);
  --shadow-lg:     0 28px 80px rgba(0, 0, 0, .60);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 13.5px; font-weight: 500; line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); }

/* ─────────────── Boot / Login ─────────────── */
.app-loading { display: grid; place-items: center; min-height: 100vh; }
.boot { text-align: center; color: var(--text-mute); }
.boot-spin {
  width: 34px; height: 34px; margin: 0 auto 14px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--brand); animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1000px 520px at 12% -10%, rgba(91, 70, 229, .28), transparent 60%),
    radial-gradient(900px 500px at 105% 108%, rgba(139, 70, 212, .24), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 20px; padding: 38px 34px; box-shadow: var(--shadow-lg);
}
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-logo .mark { width: 38px; height: 38px; }
.login-card h1 { margin: 0; font-size: 22px; letter-spacing: -.4px; }
.login-card .sub { margin: 6px 0 26px; color: var(--text-mute); font-size: 13.5px; }
.login-card label { display: block; font-size: 13px; font-weight: 600; color: var(--text-soft); margin: 0 0 6px; }
.login-card .field { margin-bottom: 14px; }
.login-hint {
  margin-top: 20px; padding: 11px 13px; background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 12.5px; color: var(--text-mute); line-height: 1.7;
}
.login-hint b { color: var(--text-soft); font-weight: 600; }

/* 로그인한 본인에게만 보이는 초기 비밀번호 경고 */
.pw-warn {
  padding: 9px 18px; font-size: 13.5px; line-height: 1.6;
  background: color-mix(in srgb, var(--danger) 12%, var(--bg-card));
  border-bottom: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  color: var(--text);
}
.pw-warn b { color: var(--danger); font-weight: 700; margin-right: 6px; }
.pw-warn a { margin-left: 8px; font-weight: 600; color: var(--danger); text-decoration: underline; }

/* ─────────────── Header / GNB ─────────────── */
.gnb {
  position: sticky; top: 0; z-index: 200;
  background: linear-gradient(100deg, var(--header-1), var(--header-2) 48%, var(--header-3));
  color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .08), var(--shadow);
}
.gnb-inner { display: flex; align-items: center; gap: 3px; padding: 0 13px; height: 46px; }
.gnb-logo { display: flex; align-items: center; gap: 7px; padding-right: 13px; flex-shrink: 0; }
.gnb-logo .mark { width: 26px; height: 26px; }
.gnb-logo .name { font-size: 17px; font-weight: 800; letter-spacing: -.5px; }
.gnb-logo .year {
  font-size: 10.5px; font-weight: 700; background: rgba(255, 255, 255, .18); color: #fff;
  padding: 2px 5px; border-radius: 4px; letter-spacing: .5px;
}
.gnb-menu { display: flex; align-items: stretch; height: 46px; }
.gnb-item { position: relative; }
.gnb-link {
  display: flex; align-items: center; height: 46px; padding: 0 13px; font-size: 14px; font-weight: 600;
  color: rgba(255, 255, 255, .82); cursor: pointer; border: 0; background: none;
  border-bottom: 3px solid transparent; transition: color .13s, background .13s;
  white-space: nowrap;
}
.gnb-item:hover > .gnb-link, .gnb-link.active { color: #fff; background: rgba(255, 255, 255, .1); }
.gnb-link.active { border-bottom-color: #b7a6ff; }
.gnb-link.accent { color: #ff9db5; }
.gnb-drop {
  position: absolute; top: 46px; left: 0; min-width: 180px; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-lg); padding: 7px; display: none; color: var(--text);
}
.gnb-item:hover .gnb-drop { display: block; }
.gnb-drop a {
  display: block; padding: 6px 9px; border-radius: var(--radius-xs); font-size: 13.5px;
  color: var(--text-soft); white-space: nowrap;
}
.gnb-drop a:hover { background: var(--brand-soft); color: var(--brand-text); }
.gnb-drop a.on { background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }
.gnb-group {
  padding: 9px 11px 5px; font-size: 12px; font-weight: 700; color: var(--text-mute);
  letter-spacing: .3px; border-top: 1px solid var(--border); margin-top: 5px;
}
.gnb-group:first-child { border-top: 0; margin-top: 0; padding-top: 5px; }
.gnb-right { margin-left: auto; display: flex; align-items: center; gap: 8px; padding-left: 10px; }
.gnb-notice {
  max-width: 300px; font-size: 13px; color: #ffd9e2; background: rgba(255, 255, 255, .1);
  padding: 4px 9px; border-radius: 999px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gnb-user { text-align: right; line-height: 1.35; font-size: 13px; }
.gnb-user .who { font-weight: 700; }
.gnb-user .meta { font-size: 11.5px; color: rgba(255, 255, 255, .6); }
.icon-btn {
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px;
  background: rgba(255, 255, 255, .12); border: 0; color: #fff; cursor: pointer; transition: background .13s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .24); }

/* ─────────────── Layout ─────────────── */
.crumb-bar {
  display: flex; align-items: center; gap: 7px; padding: 5px 14px;
  background: var(--bg-elev); border-bottom: 1px solid var(--border);
  position: sticky; top: 46px; z-index: 150;
}
.crumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-mute); }
.crumb b { color: var(--text); font-weight: 700; font-size: 14px; }
.crumb .sep { color: var(--border-strong); }
.crumb-actions { margin-left: auto; display: flex; align-items: center; gap: 7px; }
main.page { padding: 9px 14px 28px; max-width: none; }

/* ─────────────── Card ─────────────── */
.card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin-bottom: 8px; overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border-bottom: 1px solid var(--border); background: var(--bg-sunken);
}
.card-head h2 { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: -.2px; }
.card-head .note { font-size: 12.5px; color: var(--danger); font-weight: 600; }
.card-head .right { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-body { padding: 8px 10px; }
.card-body.flush { padding: 0; }

/* ─────────────── Buttons ─────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 27px; padding: 0 10px; border-radius: var(--radius-xs); border: 1px solid var(--border-strong);
  background: var(--bg-elev); color: var(--text-soft); font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: all .13s;
}
.btn:hover { background: var(--bg-hover); border-color: var(--text-mute); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.sm { height: 23px; padding: 0 8px; font-size: 12px; }
.btn.lg { height: 34px; padding: 0 17px; font-size: 14px; border-radius: var(--radius-sm); }
.btn.block { width: 100%; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--on-brand); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover { filter: brightness(1.08); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(1.08); color: #fff; }
.btn.warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn.warn:hover { filter: brightness(1.08); color: #fff; }
.btn.info { background: var(--info); border-color: var(--info); color: #fff; }
.btn.info:hover { filter: brightness(1.08); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.tint { background: var(--brand-soft); border-color: transparent; color: var(--brand-text); }
.btn.tint:hover { background: var(--brand-soft); filter: brightness(.96); color: var(--brand-text); }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-xs) 0 0 var(--radius-xs); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-xs) var(--radius-xs) 0; }
.btn-group .btn.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); z-index: 1; }
/* 단독 토글 단추(상담이력 등) — 켜져 있으면 강조색으로 눌린 상태를 보여 준다 */
.btn.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.on:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--on-brand); }

/* ─────────────── Form ─────────────── */
.inp, .sel, .ta {
  height: 27px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-xs);
  background: var(--bg-elev); color: var(--text); font-size: 13px; width: 100%;
  transition: border-color .13s, box-shadow .13s;
}
.ta { height: auto; padding: 5px 8px; resize: vertical; min-height: 48px; line-height: 1.4; }
.inp:focus, .sel:focus, .ta:focus {
  outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}
.inp:disabled, .sel:disabled, .inp[readonly] { background: var(--bg-sunken); color: var(--text-mute); }
.inp.num { text-align: right; font-variant-numeric: tabular-nums; }
.sel {
  appearance: none; padding-right: 26px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%238b91a8' d='M0 0h10L5 6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
.inp.err { border-color: var(--danger); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 6px 8px; }
.fld { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fld > label { font-size: 12px; font-weight: 600; color: var(--text-soft); display: flex; align-items: center; gap: 3px; }
.fld > label .req { color: var(--danger); }
.fld.wide { grid-column: span 2; }
.fld.full { grid-column: 1 / -1; }
.row-inline { display: flex; gap: 4px; align-items: center; }
.row-inline > .inp, .row-inline > .sel { flex: 1; min-width: 0; }

.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; font-size: 13.5px; }
.chk input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; margin: 0; }

/* 토글 필터 (원본 스타일) */
.toggle-rows { display: flex; flex-direction: column; gap: 4px; }
.toggle-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.toggle-row > .lbl {
  font-size: 13px; font-weight: 700; color: var(--brand-text); min-width: 56px; flex-shrink: 0;
}
.toggle-row > .lbl.red { color: var(--danger); }
.tg { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; }
.tg input { display: none; }
.tg .knob {
  width: 30px; height: 17px; border-radius: 999px; background: var(--border-strong);
  position: relative; transition: background .15s; flex-shrink: 0;
}
.tg .knob::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%;
  background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.tg input:checked + .knob::after { transform: translateX(13px); }
.tg input:checked + .knob { background: var(--ok); }
.tg.blue input:checked + .knob { background: var(--info); }
.tg.red input:checked + .knob { background: var(--danger); }
.tg.amber input:checked + .knob { background: #e6a700; }
.tg .txt { font-size: 13px; color: var(--text-soft); white-space: nowrap; }
.tg input:checked ~ .txt { color: var(--text); font-weight: 600; }

/* 검색바 */
.search-bar {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  padding: 7px 10px; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 8px; box-shadow: var(--shadow-sm);
}
.search-bar .sep-v { width: 1px; height: 20px; background: var(--border); margin: 0 3px; }
.search-bar .grow { flex: 1; min-width: 120px; }
.filter-panel {
  padding: 7px 10px; border-top: 1px dashed var(--border); margin-top: 2px;
}

/* ─────────────── Table ─────────────── */
.table-wrap { overflow: auto; max-height: calc(100vh - 220px); position: relative; }
.table-wrap.short { max-height: 320px; }
.table-wrap.auto { max-height: none; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.grid th {
  position: sticky; top: 0; z-index: 5; background: var(--bg-sunken); color: var(--text-soft);
  font-weight: 700; font-size: 12px; text-align: left; padding: 5px 7px; white-space: nowrap;
  border-bottom: 1px solid var(--border-strong); box-shadow: inset 0 -1px 0 var(--border-strong);
}
/* 머리글 클릭 정렬 — 누를 수 있는 칸임을 표시하고, 정렬 중인 열에 화살표를 둔다 */
table.grid th.th-sort { cursor: pointer; user-select: none; }
table.grid th.th-sort:hover { background: var(--bg-hover); color: var(--text); }
table.grid th .sort-ind {
  display: inline-block; width: 9px; margin-left: 3px; font-style: normal;
  opacity: 0; transition: opacity .12s; color: var(--brand-text);
}
table.grid th.th-sort:hover .sort-ind { opacity: .35; }
table.grid th.th-sort:hover .sort-ind::after { content: '↕'; }
table.grid th.sorted { color: var(--brand-text); }
table.grid th.sorted .sort-ind { opacity: 1; }
table.grid th.sorted[data-dir="asc"] .sort-ind::after { content: '▲'; font-size: 9px; }
table.grid th.sorted[data-dir="desc"] .sort-ind::after { content: '▼'; font-size: 9px; }

table.grid th.num, table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid th.ctr, table.grid td.ctr { text-align: center; }
table.grid td {
  padding: 4px 7px; border-bottom: 1px solid var(--border); white-space: nowrap; color: var(--text);
}
table.grid tbody tr:hover td { background: var(--bg-hover); }
table.grid tbody tr.sel td { background: var(--brand-soft); }
table.grid tbody tr.warn-row td { background: var(--danger-soft); }
table.grid tbody tr.clickable { cursor: pointer; }
table.grid tfoot td {
  position: sticky; bottom: 0; background: var(--bg-sunken); font-weight: 700;
  border-top: 1px solid var(--border-strong); box-shadow: inset 0 1px 0 var(--border-strong);
}
table.grid td .cell-inp {
  height: 24px; padding: 0 6px; font-size: 13px; border: 1px solid transparent; background: transparent;
  border-radius: 4px; width: 100%;
}
table.grid td .cell-inp:hover { border-color: var(--border-strong); background: var(--bg-elev); }
table.grid td .cell-inp:focus { outline: 0; border-color: var(--brand); background: var(--bg-elev); }
.empty { padding: 16px 12px; text-align: center; color: var(--text-mute); font-size: 13px; }
.empty .ico { font-size: 19px; opacity: .35; display: block; margin-bottom: 3px; }

/* ─────────────── Badge ─────────────── */
.bdg {
  display: inline-flex; align-items: center; gap: 3px; height: 18px; padding: 0 6px;
  border-radius: 5px; font-size: 12px; font-weight: 700; white-space: nowrap;
  background: var(--bg-hover); color: var(--text-soft);
}
.bdg.ok { background: var(--ok-soft); color: var(--ok); }
.bdg.warn { background: var(--warn-soft); color: var(--warn); }
.bdg.danger { background: var(--danger-soft); color: var(--danger); }
.bdg.info { background: var(--info-soft); color: var(--info); }
.bdg.brand { background: var(--brand-soft); color: var(--brand-text); }
.bdg.purple { background: var(--purple-soft); color: var(--purple); }
.bdg.dot::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ─────────────── Stats ─────────────── */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 7px; margin-bottom: 8px; }
.stat {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 11px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat::after {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent, var(--brand));
}
.stat .k { font-size: 12px; color: var(--text-mute); font-weight: 600; margin-bottom: 1px; }
.stat .v { font-size: 19px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; font-weight: 600; color: var(--text-mute); margin-left: 2px; }
.stat .d { font-size: 11.5px; color: var(--text-mute); margin-top: 1px; }

/* ─────────────── Chart ─────────────── */
.chart { width: 100%; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-txt { fill: var(--text-mute); font-size: 11px; }
.chart .bar { fill: var(--brand); transition: opacity .13s; }
.chart .bar:hover { opacity: .8; }
.chart .bar-2 { fill: #f2b544; }
.chart .val-txt { fill: var(--text-soft); font-size: 11px; font-weight: 700; }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2.2; stroke-linejoin: round; }
.chart .area { fill: color-mix(in srgb, var(--brand) 12%, transparent); }
.chart .pt { fill: var(--brand); }

.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-soft); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 4px; }

/* 랭킹 리스트 */
.rank { display: flex; flex-direction: column; gap: 5px; }
.rank-item { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.rank-item .no {
  width: 19px; height: 19px; border-radius: 5px; display: grid; place-items: center;
  background: var(--bg-hover); color: var(--text-mute); font-size: 11.5px; font-weight: 800; flex-shrink: 0;
}
.rank-item:nth-child(1) .no { background: var(--brand); color: var(--on-brand); }
.rank-item:nth-child(2) .no { background: var(--brand-soft); color: var(--brand-text); }
.rank-item .nm { flex-shrink: 0; min-width: 88px; font-weight: 600; }
.rank-item .bar-bg { flex: 1; height: 7px; background: var(--bg-hover); border-radius: 999px; overflow: hidden; }
.rank-item .bar-fg { height: 100%; background: linear-gradient(90deg, var(--brand), var(--purple)); border-radius: 999px; }
.rank-item .vl { min-width: 46px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* 리스트 (대시보드 패널) */
.mini-list { display: flex; flex-direction: column; }
.mini-list li {
  display: flex; align-items: center; gap: 7px; padding: 5px 0; border-bottom: 1px solid var(--border);
  font-size: 13.5px; list-style: none;
}
.mini-list li:last-child { border-bottom: 0; }
.mini-list .tag {
  font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px;
  background: var(--brand-soft); color: var(--brand-text); flex-shrink: 0;
}
.mini-list .txt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list .aside { color: var(--text-mute); font-size: 12.5px; flex-shrink: 0; }
.mini-list ul { margin: 0; padding: 0; }

/* ─────────────── Modal ─────────────── */
.backdrop {
  position: fixed; inset: 0; background: rgba(14, 16, 24, .5); backdrop-filter: blur(3px);
  z-index: 900; display: grid; place-items: center; padding: 22px; animation: fade .14s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); width: 100%; max-width: 620px; max-height: 92vh;
  display: flex; flex-direction: column; animation: pop .16s;
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal.wide { max-width: 1060px; }
.modal.xwide { max-width: 1360px; }
.modal-head {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-head .x {
  margin-left: auto; width: 28px; height: 28px; border: 0; background: transparent; cursor: pointer;
  border-radius: 7px; color: var(--text-mute); font-size: 18px; line-height: 1;
}
.modal-head .x:hover { background: var(--bg-hover); color: var(--text); }
.modal-body { padding: 10px 12px; overflow: auto; flex: 1; }
.modal-foot {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--border);
  background: var(--bg-sunken); border-radius: 0 0 16px 16px;
}
.modal-foot .right { margin-left: auto; display: flex; gap: 7px; }

.section-title {
  font-size: 13px; font-weight: 700; color: var(--brand-text); margin: 9px 0 6px;
  padding-bottom: 4px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 6px;
}
.section-title:first-child { margin-top: 0; }
.section-title .hint { font-weight: 600; font-size: 12px; color: var(--text-mute); margin-left: auto; }

/* 퀵버튼 그룹 */
.quick-group { margin-top: 10px; }
.quick-group .qg-label { font-size: 12px; font-weight: 700; color: var(--text-mute); margin-bottom: 5px; }
.quick-btns { display: flex; flex-wrap: wrap; gap: 5px; }
/* .qb 는 어디에 있든 같은 모양이어야 한다. 예전에는 .quick-btns 안에서만 적용돼
   다른 자리에 놓으면 브라우저 기본 단추(흰 바탕)가 나와 글씨가 안 보였다. */
.qb {
  display: inline-flex; align-items: center;
  height: 25px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--bg-elev); color: var(--text-soft); font-size: 12.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap; font-family: inherit;
}
.qb:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-text); }

/* ─────────────── Toast ─────────────── */
.toast-host {
  position: fixed; right: 18px; bottom: 18px; z-index: 1000;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.toast {
  display: flex; align-items: center; gap: 9px; min-width: 210px; max-width: 380px;
  padding: 11px 15px; border-radius: 11px; background: var(--bg-elev); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); font-size: 14px; animation: slideIn .18s;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(16px); } }
.toast .ic { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.toast.error .ic { background: var(--danger); }
.toast.warn .ic { background: var(--warn); }

/* ─────────────── Tabs ─────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 8px; overflow-x: auto; }
.tabs button {
  padding: 6px 11px; border: 0; background: none; cursor: pointer; font-size: 13px; font-weight: 600;
  color: var(--text-mute); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--brand-text); border-bottom-color: var(--brand); }

/* ─────────────── Pagination ─────────────── */
.pager { display: flex; align-items: center; justify-content: center; gap: 3px; padding: 7px; }
.pager button {
  min-width: 26px; height: 26px; padding: 0 6px; border: 1px solid var(--border-strong);
  background: var(--bg-elev); border-radius: var(--radius-xs); cursor: pointer;
  font-size: 13px; color: var(--text-soft); font-weight: 600;
}
.pager button:hover:not(:disabled) { background: var(--bg-hover); }
.pager button.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.pager button:disabled { opacity: .35; cursor: not-allowed; }
.pager .info { margin-left: 10px; font-size: 13px; color: var(--text-mute); }

/* ─────────────── Utils ─────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 1300px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.muted { color: var(--text-mute); }
.soft { color: var(--text-soft); }
.strong { font-weight: 700; }
.tnum { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.pos { color: var(--ok); } .neg { color: var(--danger); }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.gap6 { display: flex; gap: 6px; align-items: center; }
.gap6.wrap { flex-wrap: wrap; }
.hide { display: none !important; }
.link { color: var(--brand-text); cursor: pointer; font-weight: 600; }
.link:hover { text-decoration: underline; }
.pink-row td { background: var(--danger-soft) !important; }

/* ═══════════════ 지급내역등록 · 편집 그리드 확장 (SPEC §8) ═══════════════ */

/* ─────────────── 편집 가능 그리드 ─────────────── */
table.grid.editable td { padding: 3px 5px; }
table.grid.editable td.pad { padding: 4px 7px; }
table.grid.editable th { white-space: nowrap; }
table.grid.editable td > input:not([type="checkbox"]):not([type="radio"]),
table.grid.editable td > select,
table.grid.editable td > .cell-inp {
  width: 100%; min-width: 62px; height: 25px; padding: 0 6px; margin: 0;
  border: 1px solid transparent; border-radius: 4px; background: transparent;
  color: var(--text); font-family: inherit; font-size: 13px; line-height: 23px;
  transition: border-color .13s, background .13s, box-shadow .13s;
}
table.grid.editable td > input.num,
table.grid.editable td > input.num-fmt { text-align: right; font-variant-numeric: tabular-nums; }
table.grid.editable td > select { appearance: none; padding-right: 18px; cursor: pointer; }
table.grid.editable td > input:not([type="checkbox"]):not([type="radio"]):hover,
table.grid.editable td > select:hover,
table.grid.editable td > .cell-inp:hover {
  border-color: var(--border-strong); background: var(--bg-elev);
}
table.grid.editable td > input:not([type="checkbox"]):not([type="radio"]):focus,
table.grid.editable td > select:focus,
table.grid.editable td > .cell-inp:focus {
  outline: 0; border-color: var(--brand); background: var(--bg-elev);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 20%, transparent);
}
table.grid.editable td > input[readonly],
table.grid.editable td > input:disabled { background: transparent; color: var(--text-mute); cursor: default; }
table.grid.editable td > input[readonly]:hover { border-color: transparent; background: transparent; }
/* 계산 결과(읽기전용) 셀 */
table.grid.editable td.calc { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; color: var(--text-soft); }
table.grid.editable td.calc.pos { color: var(--ok); }
table.grid.editable td.calc.neg { color: var(--danger); }

/* ─────────────── 정책 참조 셀 (클릭 시 값 채움) ─────────────── */
table.grid td.policy-cell, .policy-cell {
  cursor: pointer; text-align: right; font-variant-numeric: tabular-nums;
  color: var(--text-soft); font-weight: 600; user-select: none;
  border-left: 1px dotted var(--border); transition: background .12s, color .12s;
}
table.grid th.policy-cell { color: var(--brand-text); text-align: right; border-left: 1px dotted var(--border); }
table.grid tbody tr td.policy-cell:hover, .policy-cell:hover {
  background: var(--brand-soft); color: var(--brand-text); box-shadow: inset 0 0 0 1px var(--brand);
}
table.grid tbody tr td.policy-cell:active, .policy-cell:active { background: color-mix(in srgb, var(--brand) 26%, transparent); }
table.grid tbody tr td.policy-cell.on, .policy-cell.on { background: var(--brand-soft); color: var(--brand-text); font-weight: 800; }
table.grid td.policy-cell.zero, .policy-cell.zero { color: var(--text-mute); font-weight: 500; }

/* ─────────────── 퀵버튼 접이식 그룹 (details / summary) ─────────────── */
details.quick-fold, details.quick-group {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-sunken); margin-top: 8px; overflow: hidden;
}
details.quick-fold > summary, details.quick-group > summary {
  display: flex; align-items: center; gap: 6px; padding: 7px 11px; cursor: pointer; user-select: none;
  font-size: 12.5px; font-weight: 700; color: var(--text-soft); list-style: none;
}
details.quick-fold > summary::-webkit-details-marker,
details.quick-group > summary::-webkit-details-marker { display: none; }
details.quick-fold > summary::before, details.quick-group > summary::before {
  content: '▶'; font-size: 9px; color: var(--text-mute); transition: transform .13s; display: inline-block;
}
details.quick-fold[open] > summary::before, details.quick-group[open] > summary::before { transform: rotate(90deg); }
details.quick-fold > summary:hover, details.quick-group > summary:hover { background: var(--bg-hover); color: var(--text); }
details.quick-fold[open] > summary, details.quick-group[open] > summary {
  color: var(--brand-text); border-bottom: 1px solid var(--border); background: var(--bg-elev);
}
details.quick-fold > summary .cnt, details.quick-group > summary .cnt {
  margin-left: auto; font-size: 11.5px; font-weight: 700; color: var(--text-mute);
  background: var(--bg-hover); border-radius: 999px; padding: 1px 7px;
}
details.quick-fold > .quick-btns, details.quick-group > .quick-btns { padding: 9px 11px; background: var(--bg-elev); }
.quick-folds { display: flex; flex-direction: column; gap: 6px; }
.qb.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

/* ─────────────── 모달 2단 분할 ─────────────── */
.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.split-2 > * { min-width: 0; }
.split-2 > .pane {
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-elev); overflow: hidden;
}
.split-2 > .pane > .pane-head {
  display: flex; align-items: center; gap: 7px; padding: 8px 11px; font-size: 13px; font-weight: 700;
  color: var(--brand-text); background: var(--bg-sunken); border-bottom: 1px solid var(--border);
}
.split-2 > .pane > .pane-head .right { margin-left: auto; display: flex; gap: 5px; }
.split-2 > .pane > .pane-body { padding: 10px 11px; }
.split-2 > .pane > .pane-body.flush { padding: 0; }
.split-2 > .pane > .pane-foot {
  display: flex; align-items: center; gap: 8px; padding: 8px 11px; font-size: 13px;
  background: var(--bg-sunken); border-top: 1px solid var(--border);
}
.split-2 > .pane > .pane-foot .v { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .split-2 { grid-template-columns: 1fr; } }

/* ─────────────── 실시간 계산 요약 바 ─────────────── */
.calc-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px;
  padding: 6px 9px; margin-top: 6px; background: var(--bg-sunken);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.calc-bar > * { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.calc-bar i, .calc-bar label, .calc-bar .k, .calc-bar span > span:first-child {
  font-style: normal; font-size: 12px; font-weight: 700; color: var(--text-mute);
}
.calc-bar b, .calc-bar .v, .calc-bar strong {
  font-size: 14px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums;
}
.calc-bar .neg, .calc-bar b.neg { color: var(--danger); }
.calc-bar > *:last-child {
  margin-left: auto; padding: 3px 10px; border-radius: 999px;
  background: var(--brand-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 32%, transparent);
}
.calc-bar > *:last-child i, .calc-bar > *:last-child label,
.calc-bar > *:last-child .k, .calc-bar > *:last-child span:first-child { color: var(--brand-text); }
.calc-bar > *:last-child b, .calc-bar > *:last-child .v, .calc-bar > *:last-child strong {
  font-size: 16px; font-weight: 800; color: var(--brand-text);
}
@media (max-width: 720px) { .calc-bar > *:last-child { margin-left: 0; } }

/* ─────────────── 이력 패널 (상담이력 + 변경이력) ─────────────── */
.hist-head {
  display: flex; align-items: center; gap: 10px; padding: 0 0 10px;
  border-bottom: 1px solid var(--border); margin-bottom: 10px;
}
.hist-badge {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 12px;
  border-radius: 999px; background: var(--brand); color: var(--on-brand); font-size: 13.5px; font-weight: 700;
}
.hist-list {
  max-height: 52vh; overflow: auto; display: flex; flex-direction: column; gap: 8px;
  padding-right: 4px;
}
.hist-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elev); padding: 9px 11px;
}
.hist-item.change { background: var(--bg-sunken); border-style: dashed; }
.hist-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; margin-bottom: 5px; }
.hist-meta b { color: var(--brand-text); }
.hist-at { margin-left: auto; color: var(--text-mute); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.hist-body {
  white-space: pre-wrap; line-height: 1.7; font-size: 14px; color: var(--text);
  word-break: break-word;
}
.hist-item.change .hist-body { font-size: 13.5px; color: var(--text-soft); }
.hist-actions { display: flex; justify-content: flex-end; margin-top: 4px; }
.hist-input { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }

/* ─────────────── 우측 상담이력 도크 ─────────────── */
.dock-layout { display: flex; gap: 8px; align-items: flex-start; }
.dock-main { flex: 1; min-width: 0; }

.hist-dock {
  width: 360px; flex-shrink: 0; position: sticky; top: 83px;
  max-height: calc(100vh - 92px); display: flex; flex-direction: column;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden;
  transition: width .16s ease;
}
.hist-dock-head {
  display: flex; align-items: center; gap: 7px; padding: 7px 9px;
  border-bottom: 1px solid var(--border); background: var(--bg-sunken); flex-shrink: 0;
}
.dock-toggle {
  width: 24px; height: 24px; flex-shrink: 0; border: 1px solid var(--border-strong);
  background: var(--bg-elev); color: var(--brand-text); border-radius: var(--radius-xs);
  cursor: pointer; font-size: 14px; font-weight: 700; line-height: 1; padding: 0;
}
.dock-toggle:hover { background: var(--brand-soft); border-color: var(--brand); }
.hist-dock .hist-list {
  flex: 1; overflow: auto; padding: 7px; margin: 0; max-height: none;
}
.hist-dock .hist-input {
  border-top: 1px solid var(--border); padding: 7px; margin: 0;
  background: var(--bg-sunken); flex-shrink: 0;
}
.hist-item.editing { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.hist-item .hist-actions { gap: 4px; }

/* 접힘 상태 — 세로 라벨만 남긴다 */
.dock-layout.collapsed .hist-dock { width: 40px; }
.dock-layout.collapsed .hist-dock .hist-badge,
.dock-layout.collapsed .hist-dock #h-count,
.dock-layout.collapsed .hist-dock .tg,
.dock-layout.collapsed .hist-dock .hist-list,
.dock-layout.collapsed .hist-dock .hist-input { display: none; }
.dock-layout.collapsed .hist-dock-head {
  flex-direction: column; height: 100%; border-bottom: 0; padding: 8px 6px; gap: 10px;
}
.dock-layout.collapsed .hist-dock::after {
  content: '상 담 이 력'; writing-mode: vertical-rl; text-orientation: upright;
  font-size: 12.5px; font-weight: 700; color: var(--brand-text);
  padding: 0 0 12px; letter-spacing: 1px;
}
.dock-layout.collapsed .hist-dock { align-items: center; }

@media (max-width: 1400px) { .hist-dock { width: 320px; } }
@media (max-width: 1100px) {
  .dock-layout { flex-direction: column; }
  .hist-dock { width: 100%; position: static; max-height: 460px; }
  .dock-layout.collapsed .hist-dock { width: 100%; }
  .dock-layout.collapsed .hist-dock::after { writing-mode: horizontal-tb; }
  .dock-layout.collapsed .hist-dock-head { flex-direction: row; height: auto; }
}

/* 도크 헤더 — 좁은 폭에서 줄바꿈 방지 */
.hist-dock-head { flex-wrap: nowrap; }
.hist-dock-head .hist-badge {
  height: 24px; padding: 0 10px; font-size: 13px; white-space: nowrap; flex-shrink: 0;
}
.hist-dock-head #h-count {
  font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.hist-dock-head .tg { flex-shrink: 0; }
.hist-dock-head .tg .txt { font-size: 12px; }
.hist-dock .hist-meta { font-size: 12.5px; gap: 6px; }
.hist-dock .hist-body { font-size: 13.5px; }
.hist-dock .hist-at { font-size: 12px; }

/* ═══════════════ 등록 화면 · 고객정보 ═══════════════ */
/* 박스를 두 칸으로 놓는다 — 기본 | 담당자·연락, 주소 | 관리.
   auto-fit 이라 창이 좁아지면(대략 800px 미만) 저절로 한 칸으로 떨어진다.
   세로로만 쌓으면 5박스가 560px 을 먹어 서비스내역까지 눈이 안 닿는다. */
#cust-form.form-grid { display: grid; gap: 6px; align-items: start; }
/* 안쪽 박스가 이미 여백을 갖는다. 카드까지 10px 을 더하면 한쪽에 23px 이 겹친다. */
.input-customer-card > .card-body { padding: 6px; }
/* 좌우를 반반으로 나눌 이유가 없다. 기본에 칸이 다섯이라 넓게 주고,
   담당자·연락은 네 칸을 2×2 로 접어 좁게 쓴다. */
@media (min-width: 820px) {
  /* 칸을 반반 나누면 좁은 입력칸 오른쪽이 텅 빈다. 내용만큼만 차지하게 한다. */
  /* 박스는 창(고객 칸) 폭에 맞춰 나란히 채운다. 내용만큼만 줄이면 박스마다
     오른쪽 끝이 달라 지저분하다. 입력칸은 158px 로 좁게 두고 박스만 맞춘다. */
  #cust-form.form-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
#cust-form .cust-box { margin-bottom: 0; }
/* 비고는 늘 한 줄 전체 — 펼치면 넓어야 쓸 만하다 */
#cust-form .cust-box.box-full { grid-column: 1 / -1; }

/* 종류별 박스. 고객자료 카드와 같은 모양으로 맞춘다. */
.cust-box {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  margin-bottom: 8px; overflow: hidden;
}
.cust-box-head {
  padding: 6px 11px; border-bottom: 1px solid var(--border); background: var(--bg-sunken);
  font-size: 12.5px; font-weight: 700; letter-spacing: .3px; color: var(--brand-text);
}
.cust-box-body { display: flex; flex-wrap: wrap; gap: 6px 10px; padding: 8px 8px 9px; }

/* 한 줄에 「이름 : 값」. 라벨을 왼쪽에 고정폭으로 두어 콜론이 세로로 맞는다.
   라벨이 위에 얹혀 있으면 줄마다 높이가 두 배가 되고 눈이 오르내려야 한다. */
.cust-box-body > .fld {
  flex: 1 1 100%; min-width: 0; max-width: 100%;
  flex-direction: row; align-items: center; gap: 6px;
}
.cust-box-body > .fld > label {
  flex: 0 0 var(--lbl-w, 104px); width: var(--lbl-w, 104px); min-width: var(--lbl-w, 104px);
  justify-content: flex-end; text-align: right; overflow: hidden;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; color: var(--text-soft);
}
.cust-box-body > .cust-memo-field > label::after { content: none; }
.cust-box-body > .cust-memo-field > label { flex: 1 1 100%; justify-content: flex-start; text-align: left; }
.cust-box-body > .cust-memo-field { flex-wrap: wrap; }
.cust-box-body > .cust-memo-field > .ta { flex: 1 1 100% !important; width: 100% !important; max-width: 100% !important; min-height: 60px; }
/* 입력칸은 박스 오른쪽 끝까지 채운다. 박스 폭이 이미 창에 맞춰 고르므로
   칸을 따로 줄이면 오히려 오른쪽이 들쭉날쭉해진다. */
.cust-box-body > .fld > .inp,
.cust-box-body > .fld > .sel,
.cust-box-body > .fld > .row-inline,
.cust-box-body > .fld > .ta { flex: 1 1 auto; width: auto; min-width: 0; max-width: 100%; }
/* 필수 별표는 라벨 폭 안에 넣지 않는다. 넣으면 그 줄만 입력칸이 오른쪽으로 밀려
   줄이 안 맞는다(실측 60 / 65 / 70 / 80px 로 제각각이었다). */
.cust-box-body > .fld > label { position: relative; }
.cust-box-body > .fld .req { position: absolute; left: -9px; margin: 0; }

/* 글씨 크기를 여기서 고정한다. 칸이 좁아져도 값이 작아지지 않는다. */
.cust-box-body > .fld .inp,
.cust-box-body > .fld .sel { font-size: 13.5px; height: 30px; }
.cust-box-body .row-inline { flex-wrap: nowrap; gap: 5px; }
.cust-box-body .row-inline > .btn { flex: 0 0 auto; }

/* 담당자·연락 박스는 라벨이 짧아 좁게 잡는다 */
.box-tight .cust-box-body { --lbl-w: 72px; }   /* '상담예정일' 5자가 들어가는 폭 */
/* 가로 전체를 쓰는 박스도 한 줄에 하나씩. 라벨이 왼쪽에 있어 두 개를 넣으면
   가운데 라벨이 뜬금없는 자리에 앉는다. */
.box-full .cust-box-body > .fld { flex: 1 1 100%; }

.cust-memo-field.is-collapsed > textarea { display: none; }
.cust-memo-field > label { min-height: 23px; }
#cust-form .memo-summary { font-size: 12px; font-weight: 600; }
#cust-form #btn-memo-toggle { margin-left: auto; }

/* 고객 영역 맨 아래 실행 단추 줄. 카드 밖에 두어 '이 화면 전체' 에 대한
   동작임을 드러낸다. 저장은 오른쪽 끝 — 눈이 마지막으로 닿는 자리다. */
.cust-actions {
  display: flex; align-items: center; gap: 6px;
  margin: 2px 0 8px; padding: 9px 11px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.cust-actions .right { margin-left: auto; display: flex; gap: 6px; }
.cust-actions .btn { height: 31px; padding: 0 16px; }

.input-files-card #files-box > .gap6 > div {
  min-width: 158px !important; padding: 5px 7px !important;
}
.input-files-card.is-collapsed .card-body { display: none; }
.input-files-card.is-collapsed { align-self: start; }
.input-files-card .file-summary { font-size: 12px; white-space: nowrap; }
.input-files-card #files-box > .gap6 > div > div:first-child { margin-bottom: 2px !important; }
.input-files-card #files-box > .gap6 > div > div:last-child { margin-top: 2px !important; }
.hist-dock .hist-input .ta { min-height: 44px; max-height: 72px; }

/* 고객정보(왼쪽)는 폭을 못 박는다. 창을 키우거나 줄여도 이 칸은 760px 그대로고
   남는 자리는 오른쪽 업무 칸이 가져간다 — 표는 넓을수록 좋고 입력칸은 아니다.

   기준을 1600px 으로 잡은 이유: 오른쪽 상담이력 도크가 320px, 화면 여백이 47px 을
   늘 먹는다. 760 + 8(사이) + 320 + 47 = 1135 이므로, 업무 칸이 표를 볼 만한
   450px 이상 되려면 창이 1460px 은 되어야 한다.
   그보다 좁으면 두 칸을 억지로 유지하지 않고 위아래로 쌓는다 —
   1280px 에서 두 칸을 쓰면 업무 칸이 145px 로 짜부러져 표를 못 읽는다. */
.input-workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-items: start; }
@media (min-width: 1460px) {
  .input-workspace { grid-template-columns: 620px minmax(0, 1fr); }
}
/* 한 칸으로 쌓일 때도 고객정보는 760px 로 고정한다. 창 폭을 따라 늘어나면
   입력칸이 쓸데없이 넓어지고, 사장님이 말씀하신 '고정' 이 안 된다. */
@media (min-width: 820px) {
  .input-customer-column { width: 620px; max-width: 100%; }
}
.input-customer-column, .input-business-column {
  min-width: 0; display: flex; flex-direction: column; gap: 8px;
}
.input-workspace .card { width: 100%; min-width: 0; margin-bottom: 0; box-sizing: border-box; }
.input-customer-card .card-head h2 { flex: 0 0 auto; white-space: nowrap; }

@media (min-width: 1700px) {
  .dock-main { display: block; }
  .dock-main > .search-bar { margin-bottom: 8px; }
  /* 넓은 화면에서도 고객정보 폭은 같다. 늘어난 자리는 오른쪽이 쓴다. */
  .input-customer-column {
    position: sticky; top: 83px; max-height: calc(100vh - 92px);
    overflow: auto; padding-right: 2px;
  }
  .input-business-column .table-wrap:not(.auto) { max-height: 180px; }
  .input-files-card #files-box > .gap6 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .input-files-card #files-box > .gap6 > div { min-width: 0 !important; }
}

/* ── 날짜 칸 ────────────────────────────────────────────────
 * 어두운 화면에서 브라우저 기본 달력 아이콘이 검은색이라 배경에 묻힌다.
 * color-scheme 을 알려 주면 브라우저가 아이콘·달력 창을 어두운 쪽으로 그린다. */
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="month"],
html[data-theme="dark"] input[type="datetime-local"] { color-scheme: dark; }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
  cursor: pointer; opacity: .75; padding: 0 2px;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
/* 값이 비어 있으면 '연도. 월. 일.' 이 본문과 같은 밝기라 채운 것처럼 보인다 */
input[type="date"]:not(:focus):invalid,
input[type="date"][value=""]:not(:focus) { color: var(--text-mute); }

/* ═══════════════ 상품등록·수정 모달 (세 칸) ═══════════════ */
/* 세 칸이면 1180px 이면 충분하다. xwide(1360px)는 이 모달에 너무 넓다. */
.backdrop:has(#svc-form) .modal.xwide { max-width: 1180px; }
#svc-form.svc-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px; align-items: start;
}
#svc-form .cust-box { margin-bottom: 0; }
#svc-form .cust-box.box-full { grid-column: 1 / -1; }
/* 세 칸이라 좁다. 가장 긴 제목('해지패널티여부' 7자)이 잘리지 않는 폭. */
#svc-form .cust-box-body { --lbl-w: 100px; }
#svc-form .cust-box-body > .fld { flex: 1 1 100%; }
#svc-form .cust-box-head .hint { font-size: 11.5px; font-weight: 500; color: var(--text-mute); }

/* 소계 줄 — 상품정보 박스 안. 그 칸들을 더해 나온 값이라 바로 아래가 맞다. */
#svc-form .svc-sum {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin: 0 8px 9px; padding: 8px 11px; font-size: 13px;
  background: var(--bg-sunken); border: 1px solid var(--border); border-radius: 8px;
}
#svc-form .svc-sum .tot { font-size: 15px; color: var(--brand-text); }

/* 빠른선택 — 이름을 단추와 같은 줄에 둔다 */
#svc-form .svc-quick {
  display: flex; flex-direction: column; gap: 5px;
  padding: 8px; border-top: 1px solid var(--border);
}
#svc-form .qrow { display: flex; align-items: flex-start; gap: 8px; }
#svc-form .qrow > .qt {
  flex: 0 0 52px; text-align: right; padding-top: 5px;
  font-size: 12px; font-weight: 700; color: var(--text-mute);
}
#svc-form .qrow > .qs { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; gap: 5px; }

/* 창이 좁으면 세 칸을 유지할 수 없다 */
@media (max-width: 1080px) {
  #svc-form.svc-grid { grid-template-columns: minmax(0, 1fr); }
}

/* 계좌 고르기 칩 — 오른쪽 [x] 로 계좌관리표에서 지운다 */
.acc-chip { display: inline-flex; align-items: stretch; margin: 0 4px 4px 0; }
.acc-chip > .qb { margin: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.acc-chip > .acc-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; padding: 0; cursor: pointer; font-size: 14px; line-height: 1;
  border: 1px solid var(--border-strong); border-left: 0;
  border-top-right-radius: 999px; border-bottom-right-radius: 999px;
  background: var(--bg-sunken); color: var(--text-mute); font-family: inherit;
}
.acc-chip > .acc-x:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

/* 계정관리 — 업체 묶음 머리줄 */
table.grid tbody tr.grp-head > td {
  position: sticky; top: 30px; z-index: 4;
  padding: 7px 9px; background: var(--bg-sunken);
  border-top: 2px solid var(--border-strong); border-bottom: 1px solid var(--border-strong);
  font-size: 12.5px; white-space: nowrap;
}
table.grid tbody tr.grp-head > td > b { font-size: 13px; color: var(--brand-text); }
table.grid tbody tr.grp-head > td > span { margin-left: 9px; font-size: 12px; }
table.grid tbody tr.grp-head:hover > td { background: var(--bg-sunken); }

/* ── 리스크현황 (/report/risk) ─────────────────────────────────
   위험 점수를 색으로도 보이게 한다. 표를 훑을 때 눈이 먼저 잡도록.
   점수 10+ 위험 · 7+ 주의 · 4+ 관심 · 그 아래는 표시 없음.
   색은 테마 변수를 쓴다 — 어두운 모드에서도 같이 따라간다. */
.risk-score { display:inline-block; min-width:26px; padding:1px 7px; border-radius:999px;
  font-size:12.5px; font-weight:800; font-variant-numeric:tabular-nums; }
.risk-score.risk-hot  { background:var(--danger); color:#fff; }
.risk-score.risk-warm { background:var(--warn);   color:#fff; }
.risk-score.risk-mild { background:var(--warn-soft); color:var(--warn); }
.risk-score.risk-calm { background:var(--bg-sunken); color:var(--text-mute); }
tr.risk-hot  > td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
tr.risk-warm > td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
tr.risk-mild > td:first-child { box-shadow: inset 3px 0 0 var(--warn-soft); }
.risk-why { font-size:12px; color:var(--text-soft); line-height:1.45; }
.risk-cnt { margin-left:5px; font-weight:700; opacity:.7; font-variant-numeric:tabular-nums; }
.btn.sm.on .risk-cnt { opacity:1; }

/* .sep-v 는 .search-bar 안에서만 정의돼 있어 카드 머리글에서는 안 보였다.
   같은 모양을 전역으로 하나 둔다. */
.sep-v { display:inline-block; width:1px; height:14px; margin:0 9px;
  background:var(--border-strong); vertical-align:middle; opacity:.8; }
.warn-txt { color: var(--warn); font-size: 12px; font-weight: 700; }

/* ── 최근 많이 넣은 상품 고르기 (상품등록 > 최근다입력상품) ────────────
   순위·상품·건수·요금을 한 줄에 놓고 통째로 누르게 한다. */
.recent-prod { display:flex; flex-direction:column; gap:6px; }
.recent-item { display:grid; grid-template-columns:26px 1fr auto auto auto; align-items:center;
  gap:10px; width:100%; padding:9px 11px; text-align:left; cursor:pointer;
  border:1px solid var(--border); border-radius:8px; background:var(--bg-elev);
  color:var(--text); font-family:inherit; font-size:13px; }
.recent-item:hover { border-color:var(--brand); background:var(--bg-hover); }
.recent-rank { display:inline-flex; align-items:center; justify-content:center;
  width:22px; height:22px; border-radius:50%; background:var(--brand-soft);
  color:var(--brand-text); font-weight:800; font-size:12px; }
.recent-main { display:flex; flex-direction:column; gap:1px; min-width:0; }
.recent-main b { font-size:13.5px; }
.recent-main .muted { font-size:12px; }
.recent-sub { font-size:12px; color:var(--text-mute); white-space:nowrap; }
.recent-n { font-size:12px; font-weight:700; color:var(--text-soft);
  font-variant-numeric:tabular-nums; white-space:nowrap; }
.recent-fare { font-size:13px; font-weight:700; color:var(--brand-text);
  font-variant-numeric:tabular-nums; white-space:nowrap; min-width:78px; text-align:right; }

/* ── 관리 > 정책관리 (/admin/policy) ──
   구시스템 '정책설정' 화면과 같은 모양으로 보이게 한다.
   오른쪽 상품 칸은 태그가 여러 개 붙으므로 줄바꿈을 허용한다. */
.pol-tag {
  display:inline-block; margin:1px 2px 1px 0; padding:1px 7px;
  border-radius:10px; font-size:11.5px; line-height:1.7;
  background:var(--brand-soft); color:var(--brand-text); white-space:nowrap;
}
/* 대상 상품 한 줄 — 손입력에서 **고르개**로 바꿨다 (2026-08-30 사장님 지시).
   칸이 다섯 개에 [건수] 와 [지우기] 가 붙어 일곱 칸이다.
   건수는 그 조합에 해당하는 서비스가 몇 건인지다 — 0건이면 정책이 붙을 곳이 없다는 뜻이라
   빨갛게 보인다. 고르기 전에 알 수 있어야 헛일을 안 한다. */
.pol-item {
  display:grid; grid-template-columns:88px 118px 108px 1fr 1fr auto 30px;
  gap:5px; margin-bottom:5px; align-items:center;
}
.pol-item .inp { font-size:12.5px; min-width:0; }
.pol-item-n { font-size:11.5px; white-space:nowrap; }
.pol-item-n.warn-text { color:var(--danger,#ff6b6b); font-weight:600; }
table.grid tbody tr.off td { opacity:.5; }        /* 상품이 없어 꺼 둔 정책 */
#cov-card .card-body { padding:10px 14px; font-size:13px; line-height:1.8; }

/* 날짜칸 앞 체크상자 (2026-08-30 사장님 지시) — 체크하면 오늘 날짜가 들어간다.
   .fld 가 가로 flex 라 라벨과 날짜칸 사이에 그대로 끼어 들어간다.
   자리를 많이 먹지 않게 작게 두고, 눌러야 할 것임을 알 수 있게 손 모양 커서를 준다. */
.today-chk {
  flex: 0 0 auto; width: 15px; height: 15px; margin: 0 1px 0 0;
  cursor: pointer; accent-color: var(--brand, #2ee6c5);
}
.today-chk:hover { filter: brightness(1.25); }

/* ═══════════════ 대기고객 접수 페이지 — 등록화면과 같은 디자인 (2026-08-31 사장님)
   고객정보(2열)를 왼쪽에, 그 우측에 가입정보·상품정보·유치자정보 세 칸. ═══════════════ */
#nitk.svc-grid {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px; align-items: start; max-width: 1520px;
}
#nitk .cust-box { margin-bottom: 0; }
#nitk .cust-box.box-full { grid-column: 1 / -1; }
#nitk .cust-box-body { --lbl-w: 100px; }
#nitk .cust-box-body > .fld { flex: 1 1 100%; }
#nitk .box-cust { grid-column: span 2; }
#nitk .box-cust .cust-box { margin: 0; }   /* 고객정보 안의 작은 상자들 — 등록화면 판과 같은 꼴 */
@media (max-width: 1300px) {
  #nitk.svc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #nitk .box-cust { grid-column: 1 / -1; }
}
#nitk .cust-box-head .hint { font-size: 11.5px; font-weight: 500; color: var(--text-mute); }
#nitk .svc-sum {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin: 0 8px 9px; padding: 8px 11px; font-size: 13px;
  background: var(--bg-sunken); border: 1px solid var(--border); border-radius: 8px;
}
#nitk .svc-sum .tot { font-size: 15px; color: var(--brand-text); }
#nitk .pay-row {
  display: flex; flex-wrap: wrap; gap: 6px 10px; width: 100%;
  background: var(--bg-sunken); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px; margin-bottom: 6px;
}
#nitk .pay-row .fld { flex: 1 1 22%; min-width: 160px; display: flex; align-items: center; gap: 6px; }
#nitk .pay-row .fld > label { flex: 0 0 auto; font-size: 12px; color: var(--text-mute); }
@media (max-width: 1080px) { #nitk.svc-grid { grid-template-columns: minmax(0, 1fr); } }

/* ═══ 상자 머리띠 flex — 단추를 우측에 붙인다 + 주황 단추 (2026-08-31 사장님) ═══ */
.cust-box-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn.orange { background: #c2600a; border: 1px solid #e07b1a; color: #fff3e3; }
.btn.orange:hover { background: #e07b1a; border-color: #f59e0b; color: #fff; }

/* ═══ 숫자 칸 정렬 통일 (2026-09-01 사장님): 표 안 숫자 입력칸도 값 칸처럼 오른쪽 끝에 —
   우측정렬된 제목·총지급금액과 마지막 자리가 맞는다. 글자는 이미 오른쪽 정렬(.inp.num). ═══ */
table.grid td > input.num, table.grid td > input.num-fmt { display: block; margin-left: auto !important; }

/* 주민번호 뒷자리 — password 타입 대신 점으로만 가린다 (자동완성 오인 차단, 2026-09-01) */
.inp.masked { -webkit-text-security: disc; }

/* ═══ 옮길 수 있는 창 (2026-09-01 사장님): 배경을 어둡게 가리지 않는다 — 뒤가 선명하게 보이고
   뒷화면 조작도 된다. 창은 그림자·테두리를 진하게 해 떠 있음을 알린다. ═══ */
.backdrop.plain { background: transparent; backdrop-filter: none; pointer-events: none; }
.backdrop.plain .modal { pointer-events: auto; box-shadow: 0 14px 44px rgba(0, 0, 0, .6); border-color: var(--border-strong); }
