/* ═══════════════════ Zoom's CRM · Design System ═══════════════════ */
:root {
  --bg:            #f4f5fa;
  --bg-elev:       #ffffff;
  --bg-sunken:     #fafbfd;
  --bg-hover:      #f5f6fb;
  --border:        #e4e7f0;
  --border-strong: #d3d8e6;
  --text:          #16192b;
  --text-soft:     #5b6178;
  --text-mute:     #8b91a8;

  --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 2px rgba(22, 25, 43, .06);
  --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"] {
  --bg:            #0e1018;
  --bg-elev:       #171a26;
  --bg-sunken:     #12141e;
  --bg-hover:      #1e2231;
  --border:        #272c3d;
  --border-strong: #353b52;
  --text:          #e8eaf2;
  --text-soft:     #a3a9be;
  --text-mute:     #767d95;
  --brand:         #8676f5;
  --brand-strong:  #9b8dff;
  --brand-soft:    #241f4d;
  --brand-text:    #b3a8ff;
  --ok-soft:       #0d2b20;
  --warn-soft:     #35240d;
  --danger-soft:   #34161c;
  --info-soft:     #0f2438;
  --purple-soft:   #2a1740;
  --header-1:      #14121f;
  --header-2:      #1e1a3a;
  --header-3:      #2b2352;
  --shadow-lg:     0 18px 48px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 13px; line-height: 1.5;
  -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: 21px; letter-spacing: -.4px; }
.login-card .sub { margin: 6px 0 26px; color: var(--text-mute); font-size: 12.5px; }
.login-card label { display: block; font-size: 12px; 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: 11.5px; color: var(--text-mute); line-height: 1.7;
}
.login-hint b { color: var(--text-soft); font-weight: 600; }

/* ─────────────── 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: 4px; padding: 0 16px; height: 54px; }
.gnb-logo { display: flex; align-items: center; gap: 9px; padding-right: 16px; flex-shrink: 0; }
.gnb-logo .mark { width: 30px; height: 30px; }
.gnb-logo .name { font-size: 17px; font-weight: 800; letter-spacing: -.5px; }
.gnb-logo .year {
  font-size: 9.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: 54px; }
.gnb-item { position: relative; }
.gnb-link {
  display: flex; align-items: center; height: 54px; padding: 0 15px; 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: 54px; left: 0; min-width: 186px; 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: 8px 11px; border-radius: var(--radius-xs); font-size: 13px;
  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: 11px; 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: 12px; padding-left: 14px; }
.gnb-notice {
  max-width: 300px; font-size: 12px; color: #ffd9e2; background: rgba(255, 255, 255, .1);
  padding: 6px 12px; border-radius: 999px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gnb-user { text-align: right; line-height: 1.35; font-size: 12px; }
.gnb-user .who { font-weight: 700; }
.gnb-user .meta { font-size: 10.5px; color: rgba(255, 255, 255, .6); }
.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px;
  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: 10px; padding: 9px 20px;
  background: var(--bg-elev); border-bottom: 1px solid var(--border);
  position: sticky; top: 54px; z-index: 150;
}
.crumb { display: flex; align-items: center; gap: 7px; font-size: 12.5px; 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: 16px 20px 60px; max-width: 2400px; }

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

/* ─────────────── Buttons ─────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 30px; padding: 0 12px; border-radius: var(--radius-xs); 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; 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: 26px; padding: 0 9px; font-size: 11.5px; }
.btn.lg { height: 40px; padding: 0 20px; font-size: 14px; border-radius: var(--radius-sm); }
.btn.block { width: 100%; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; }
.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: #fff; z-index: 1; }

/* ─────────────── Form ─────────────── */
.inp, .sel, .ta {
  height: 30px; padding: 0 9px; border: 1px solid var(--border-strong); border-radius: var(--radius-xs);
  background: var(--bg-elev); color: var(--text); font-size: 12.5px; width: 100%;
  transition: border-color .13s, box-shadow .13s;
}
.ta { height: auto; padding: 7px 9px; resize: vertical; min-height: 62px; line-height: 1.6; }
.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(230px, 1fr)); gap: 10px 12px; }
.fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fld > label { font-size: 11.5px; font-weight: 600; color: var(--text-soft); display: flex; align-items: center; gap: 4px; }
.fld > label .req { color: var(--danger); }
.fld.wide { grid-column: span 2; }
.fld.full { grid-column: 1 / -1; }
.row-inline { display: flex; gap: 6px; 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: 12.5px; }
.chk input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; margin: 0; }

/* 토글 필터 (원본 스타일) */
.toggle-rows { display: flex; flex-direction: column; gap: 7px; }
.toggle-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toggle-row > .lbl {
  font-size: 12px; 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: 12px; 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: 7px; flex-wrap: wrap;
  padding: 11px 14px; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 12px; 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: 11px 14px; border-top: 1px dashed var(--border); margin-top: 2px;
}

/* ─────────────── Table ─────────────── */
.table-wrap { overflow: auto; max-height: calc(100vh - 300px); position: relative; }
.table-wrap.short { max-height: 380px; }
.table-wrap.auto { max-height: none; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
table.grid th {
  position: sticky; top: 0; z-index: 5; background: var(--bg-sunken); color: var(--text-soft);
  font-weight: 700; font-size: 11.5px; text-align: left; padding: 8px 9px; white-space: nowrap;
  border-bottom: 1px solid var(--border-strong); box-shadow: inset 0 -1px 0 var(--border-strong);
}
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: 7px 9px; 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: 12px; 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: 46px 20px; text-align: center; color: var(--text-mute); font-size: 13px; }
.empty .ico { font-size: 30px; opacity: .35; display: block; margin-bottom: 8px; }

/* ─────────────── Badge ─────────────── */
.bdg {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px;
  border-radius: 5px; font-size: 11px; 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(168px, 1fr)); gap: 11px; margin-bottom: 14px; }
.stat {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 15px; 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: 11.5px; color: var(--text-mute); font-weight: 600; margin-bottom: 5px; }
.stat .v { font-size: 21px; font-weight: 800; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 12px; font-weight: 600; color: var(--text-mute); margin-left: 2px; }
.stat .d { font-size: 11px; color: var(--text-mute); margin-top: 3px; }

/* ─────────────── Chart ─────────────── */
.chart { width: 100%; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-txt { fill: var(--text-mute); font-size: 10px; }
.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: 10px; 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: 11.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: 8px; }
.rank-item { display: flex; align-items: center; gap: 9px; font-size: 12.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: 10.5px; font-weight: 800; flex-shrink: 0;
}
.rank-item:nth-child(1) .no { background: var(--brand); color: #fff; }
.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: 8px; padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 12.5px; list-style: none;
}
.mini-list li:last-child { border-bottom: 0; }
.mini-list .tag {
  font-size: 10px; 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: 11.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: 10px; padding: 15px 18px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 15px; 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: 17px; line-height: 1;
}
.modal-head .x:hover { background: var(--bg-hover); color: var(--text); }
.modal-body { padding: 16px 18px; overflow: auto; flex: 1; }
.modal-foot {
  display: flex; align-items: center; gap: 7px; padding: 13px 18px; 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: 12.5px; font-weight: 700; color: var(--brand-text); margin: 16px 0 9px;
  padding-bottom: 6px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 7px;
}
.section-title:first-child { margin-top: 0; }
.section-title .hint { font-weight: 500; font-size: 11px; color: var(--text-mute); margin-left: auto; }

/* 퀵버튼 그룹 */
.quick-group { margin-top: 10px; }
.quick-group .qg-label { font-size: 11px; font-weight: 700; color: var(--text-mute); margin-bottom: 5px; }
.quick-btns { display: flex; flex-wrap: wrap; gap: 5px; }
.quick-btns .qb {
  height: 25px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--bg-elev); color: var(--text-soft); font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.quick-btns .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: 13px; 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: 3px; border-bottom: 1px solid var(--border); margin-bottom: 13px; overflow-x: auto; }
.tabs button {
  padding: 9px 15px; 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: 4px; padding: 12px; }
.pager button {
  min-width: 29px; height: 29px; padding: 0 7px; border: 1px solid var(--border-strong);
  background: var(--bg-elev); border-radius: var(--radius-xs); cursor: pointer;
  font-size: 12px; 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: #fff; }
.pager button:disabled { opacity: .35; cursor: not-allowed; }
.pager .info { margin-left: 10px; font-size: 12px; color: var(--text-mute); }

/* ─────────────── Utils ─────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@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: 11.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: 7px 9px; }
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: 12px; 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: 400; }

/* ─────────────── 퀵버튼 접이식 그룹 (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: 11.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: 8px; 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: 10.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; }
.quick-btns .qb.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ─────────────── 모달 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: 12px; 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: 12px;
  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: 6px 16px;
  padding: 9px 13px; margin-top: 10px; 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: 11px; font-weight: 700; color: var(--text-mute);
}
.calc-bar b, .calc-bar .v, .calc-bar strong {
  font-size: 13px; 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: 15px; 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: #fff; font-size: 12.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: 12px; margin-bottom: 5px; }
.hist-meta b { color: var(--brand-text); }
.hist-at { margin-left: auto; color: var(--text-mute); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.hist-body {
  white-space: pre-wrap; line-height: 1.7; font-size: 13px; color: var(--text);
  word-break: break-word;
}
.hist-item.change .hist-body { font-size: 12.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; }
