/* ==========================================================================
   uikit.css — 모든 화면 공통 규칙 (표 · 드롭다운 · 달력 · 숫자칸 · 칩 · 간격 · 줄바꿈 · 스크롤바)
   index.html 의 기존 스타일 뒤에 읽어서 같은 우선순위면 이쪽이 이긴다. 색은 기존 화면 색을 그대로 쓴다
   ========================================================================== */
:root {
  --tb: #dddfe3;            /* 표 선 — 머리 · 본문 같은 색 */
  --th-bg: #f6f7f9;
  --ink: #222;
  --ink-2: #555;
  --ink-3: #8a8f98;
  --accent: #5046E5;
  --accent-soft: #eeedfd;
  --gap: 10px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- 줄바꿈 · 잘림 ---------- */
body { word-break: keep-all; overflow-wrap: break-word; }
.btn, .tab, .badge, .chip, th, .form-group > label, .seg-btn, .pager-btn, .stat-label { white-space: nowrap; }
.btn { flex-shrink: 0; }

/* ---------- 간격 10px ---------- */
.card { margin: var(--gap); }
.stats-container { gap: var(--gap); }
.form-group { margin-bottom: var(--gap); }
.modal-footer { gap: var(--gap); }

/* ---------- 스크롤바 ---------- */
* { scrollbar-width: thin; scrollbar-color: #c7cad1 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c7cad1; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #a9adb6; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }
.hide-scrollbar { scrollbar-width: none; }

/* ---------- 표 ---------- */
/* 모든 칸 가운데 정렬 (인라인 text-align 도 덮는다). 금액만 오른쪽 */
table th, table td { text-align: center !important; vertical-align: middle; }
table td.amt { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
table input[type=checkbox] { display: inline-block; vertical-align: middle; margin: 0 auto; }
/* 선: 모든 칸이 오른쪽 · 아래 선을 그리고, 왼쪽 바깥선은 표가, 위 바깥선은 첫 행이 긋는다 (머리 · 본문 같은 굵기 · 색, 모든 선 한 겹)
   2026-11-15 첫 칸이 왼쪽 선을 긋던 것을 뺐다: 표 왼쪽 선과 겹쳐 두 겹이 되고, 머리가 두 줄인 표는 둘째 줄 첫 칸 왼쪽이 두 겹이 됐다 */
table { border-collapse: separate !important; border-spacing: 0 !important; border: 0 !important; border-left: 1px solid var(--tb) !important; }
table th, table td {
  border-top: 0 !important;
  border-left: 0 !important;
  border-right: 1px solid var(--tb) !important;
  border-bottom: 1px solid var(--tb) !important;
}
table thead tr:first-child > *,
table > tbody:first-child > tr:first-child > *,
table > colgroup + tbody > tr:first-child > * { border-top: 1px solid var(--tb) !important; }
/* 마지막 행 선은 칸이 직접 그린다 */
table tbody tr:last-child > * { border-bottom: 1px solid var(--tb) !important; }
/* 표만 든 상자(.tbl-frame, uikit.js frameTable)가 바깥 네 변을 긋고, 표는 안쪽 선만 긋는다 (맨 오른쪽 칸 · 맨 아래 줄은 선을 빼서 한 겹)
   → 길어서 스크롤되는 표도 아래 테두리가 늘 보이고, 짧은 표는 상자가 표 높이로 줄어든다 (2026-11-15) */
.tbl-frame { border: 1px solid var(--tb) !important; border-radius: 8px !important; overflow: auto; flex: 0 1 auto !important; background: #fff; }
.tbl-frame > table.tbl-framed { border: 0 !important; margin: 0 !important; }
.tbl-frame > table.tbl-framed thead tr:first-child > *,
.tbl-frame > table.tbl-framed > tbody:first-child > tr:first-child > *,
.tbl-frame > table.tbl-framed > colgroup + tbody > tr:first-child > * { border-top: 0 !important; }
.tbl-frame > table.tbl-framed .edge-r { border-right: 0 !important; }
.tbl-frame > table.tbl-framed .edge-b { border-bottom: 0 !important; }
/* 머리 고정: thead 통째로 붙이고 배경은 불투명하게 (스크롤할 때 뒤가 비치지 않게) */
table thead { position: sticky; top: 0; z-index: 4; }
table thead th, table thead td { position: static !important; top: auto !important; }
table thead th { background-color: var(--th-bg) !important; color: var(--ink); font-weight: 600; }
table tbody tr, table tbody td { background-clip: padding-box; }
table tbody tr > td { transition: background-color 160ms ease-out; }
table tbody tr:hover > td { background-color: #f8f9fc; }
/* 관리 열 버튼은 한 줄로 */
table td:has(> button) { white-space: nowrap; }
tr.pg-hide { display: none !important; }

.pager { display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 0 2px; flex-shrink: 0; }
.pager-info { font-size: 12px; color: var(--ink-3); margin-right: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pager-btn { min-width: 32px; height: 30px; padding: 0 8px; border: 1px solid var(--tb); background: #fff; border-radius: 8px; font-size: 13px; cursor: pointer; font-variant-numeric: tabular-nums; transition: background-color 150ms ease-out, border-color 150ms ease-out, color 150ms ease-out; }
.pager-btn:hover { border-color: #b9bdf0; }
.pager-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- 칩 · 원문자: 글자 정중앙 ---------- */
.badge, .chip,
span[style*="border-radius:10px"][style*="padding"],
span[style*="border-radius:12px"][style*="padding"],
span[style*="border-radius:20px"][style*="padding"],
span[style*="border-radius:999px"],
span[style*="border-radius: 999px"],
span[style*="border-radius:50%"] {
  display: inline-flex !important; align-items: center; justify-content: center;
  line-height: 1 !important; vertical-align: middle;
}

/* ---------- 숫자 · 날짜 · 전화번호 입력 ---------- */
.num-input { text-align: right; font-variant-numeric: tabular-nums; }
.dp-input { cursor: text; font-variant-numeric: tabular-nums; }
.dp-input.dp-bad { border-color: #e5484d !important; animation: dpShake 260ms ease-out; }
@keyframes dpShake { 0%, 100% { transform: none; } 30% { transform: translateX(-3px); } 60% { transform: translateX(3px); } }
input[type="tel"] { font-variant-numeric: tabular-nums; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* 달력 */
.dp-panel {
  position: fixed; z-index: 3000; width: 272px; background: #fff; border: 1px solid #e3e6ea; border-radius: 12px;
  box-shadow: 0 12px 32px -8px rgba(30, 41, 59, .22), 0 2px 6px rgba(30, 41, 59, .06);
  display: none; flex-direction: column; padding: 10px; font-size: 13px; color: var(--ink); transform-origin: top left;
}
.dp-panel.open { display: flex; animation: ssIn 170ms var(--ease-out) both; }
.dp-panel.up { transform-origin: bottom left; }
.dp-panel.closing { display: flex; animation: ssOut 120ms ease-in both; pointer-events: none; }
.dp-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; }
.dp-nav { width: 30px; height: 30px; border: 0; background: transparent; border-radius: 8px; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: background-color 150ms ease-out; }
.dp-nav:hover { background: #f1f2f6; }
.dp-nav svg { width: 14px; height: 14px; }
.dp-title { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.dp-year { width: 48px; border: 1px solid transparent; border-radius: 6px; padding: 2px 4px; font: inherit; font-weight: 600; text-align: right; background: transparent; color: inherit; font-variant-numeric: tabular-nums; transition: border-color 150ms ease-out, background-color 150ms ease-out; }
.dp-year:hover, .dp-year:focus { border-color: var(--tb); background: #fff; outline: none; }
.dp-ylab { margin-right: 6px; margin-left: 1px; }
.dp-week, .dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-week span { text-align: center; font-size: 11px; color: var(--ink-3); padding: 4px 0; }
.dp-week span:first-child { color: #d9534f; }
.dp-week span:last-child { color: #3b6fd6; }
.dp-day { height: 32px; border: 0; background: transparent; border-radius: 8px; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink); font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; justify-content: center; transition: background-color 140ms ease-out, color 140ms ease-out, transform 120ms ease-out; }
.dp-day:hover { background: #f1f2fb; }
.dp-day:active { transform: scale(.92); }
.dp-day.sun { color: #d9534f; }
.dp-day.sat { color: #3b6fd6; }
.dp-day.today { box-shadow: inset 0 0 0 1px #c9ccf5; }
.dp-day.sel { background: var(--accent); color: #fff; font-weight: 600; }
.dp-day.empty { pointer-events: none; }
.dp-foot { display: flex; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid #eef0f3; }
.dp-foot button { flex: 1; height: 30px; border-radius: 8px; border: 1px solid #e3e6ea; background: #fff; cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-2); transition: background-color 150ms ease-out, border-color 150ms ease-out, color 150ms ease-out; }
.dp-foot button:hover { background: var(--accent-soft); border-color: #c9ccf5; color: var(--accent); }

/* ---------- 디자인 드롭다운 (검색, 필터는 체크박스로 여러 개) ---------- */
select.ss-native { display: none !important; }
.ss { position: relative; display: inline-block; vertical-align: middle; max-width: 100%; }
.ss.ss-block { display: block; width: 100%; }
.ss-btn {
  display: flex !important; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left; cursor: pointer; background: #fff; color: var(--ink);
  white-space: nowrap; overflow: hidden; font-family: inherit;
  transition: border-color 160ms ease-out, box-shadow 160ms ease-out, background-color 160ms ease-out;
}
.ss-btn:hover:not(:disabled) { border-color: #b9bdf0 !important; }
.ss-btn:focus-visible, .ss.open .ss-btn { outline: none; border-color: var(--accent) !important; box-shadow: 0 0 0 3px rgba(80, 70, 229, .14); }
.ss-btn:disabled { background: #f3f4f6; color: var(--ink-3); cursor: not-allowed; }
.ss-btn .ss-label { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.ss-btn .ss-label.is-placeholder { color: var(--ink-3); }
.ss-caret { width: 10px; height: 10px; flex-shrink: 0; color: var(--ink-3); transition: transform 200ms var(--ease-out); }
.ss.open .ss-caret { transform: rotate(180deg); }

.ss-panel {
  position: fixed; z-index: 3000; background: #fff; border: 1px solid #e3e6ea; border-radius: 10px;
  box-shadow: 0 12px 32px -8px rgba(30, 41, 59, .22), 0 2px 6px rgba(30, 41, 59, .06);
  display: none; flex-direction: column; overflow: hidden; min-width: 180px; max-width: min(420px, calc(100vw - 20px));
  transform-origin: top center; font-size: 13px; color: var(--ink);
}
.ss-panel.open { display: flex; animation: ssIn 170ms var(--ease-out) both; }
.ss-panel.up { transform-origin: bottom center; }
.ss-panel.closing { display: flex; animation: ssOut 120ms ease-in both; pointer-events: none; }
@keyframes ssIn { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes ssOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-2px) scale(.99); } }
.ss-search { position: relative; padding: 8px; border-bottom: 1px solid #eef0f3; }
.ss-search svg { position: absolute; left: 17px; top: 50%; width: 13px; height: 13px; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.ss-search input {
  width: 100%; height: 30px; border: 1px solid #e3e6ea; border-radius: 7px; padding: 0 10px 0 28px; font: inherit; font-size: 12px;
  transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
}
.ss-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(80, 70, 229, .12); }
.ss-list { max-height: 260px; overflow-y: auto; padding: 4px; overscroll-behavior: contain; }
.ss-opt {
  display: flex; align-items: center; gap: 8px; padding: 8px 9px; border-radius: 7px; cursor: pointer; line-height: 1.3;
  transition: background-color 120ms ease-out, color 120ms ease-out;
}
.ss-opt .ss-text { flex: 1; min-width: 0; }
.ss-opt:hover, .ss-opt.kb { background: #f3f3ff; }
.ss-opt[aria-selected="true"] { color: var(--accent); font-weight: 600; }
.ss-opt[aria-disabled="true"] { opacity: .45; cursor: default; }
.ss-opt .ss-tick { width: 14px; height: 14px; flex-shrink: 0; color: var(--accent); opacity: 0; transition: opacity 120ms ease-out; }
.ss-opt[aria-selected="true"] .ss-tick { opacity: 1; }
.ss-opt mark { background: #fff1b8; color: inherit; border-radius: 2px; padding: 0; }
.ss-box {
  width: 16px; height: 16px; border: 1.5px solid #c3c8cf; border-radius: 4px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; background: #fff;
  transition: background-color 140ms ease-out, border-color 140ms ease-out;
}
.ss-box svg { width: 10px; height: 10px; color: #fff; transform: scale(.4); opacity: 0; transition: transform 160ms var(--ease-out), opacity 120ms ease-out; }
.ss-opt[aria-selected="true"] .ss-box { background: var(--accent); border-color: var(--accent); }
.ss-opt[aria-selected="true"] .ss-box svg { transform: none; opacity: 1; }
.ss-empty { padding: 16px; text-align: center; color: var(--ink-3); font-size: 12px; }
.ss-foot { display: flex; gap: 8px; padding: 8px; border-top: 1px solid #eef0f3; background: #fafbfc; }
.ss-foot button {
  flex: 1; height: 28px; border-radius: 7px; border: 1px solid #e3e6ea; background: #fff; cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-2);
  transition: background-color 150ms ease-out, border-color 150ms ease-out, transform 120ms ease-out;
}
.ss-foot button:hover { background: var(--accent-soft); border-color: #c9ccf5; color: var(--accent); }
.ss-foot button:active { transform: scale(.97); }
.ss-list .ss-opt { animation: ssOpt 180ms var(--ease-out) both; }
@keyframes ssOpt { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .ss-panel.open, .ss-panel.closing, .dp-panel.open, .dp-panel.closing, .ss-list .ss-opt, .dp-input.dp-bad { animation: none !important; }
  .ss-caret, .ss-box svg, .dp-day, table tbody tr > td { transition: none !important; }
}

/* ---------- 가린 개인정보 (누르면 보임) ---------- */
.mask-reveal { border: 0; background: transparent; padding: 2px 4px; margin: -2px -4px; border-radius: 6px; font: inherit; color: inherit; cursor: pointer; font-variant-numeric: tabular-nums; letter-spacing: .02em; white-space: nowrap; transition: background-color 150ms ease-out; }
.mask-reveal:hover:not(.shown) { background: #f1f2fb; }
.mask-reveal.shown { cursor: text; user-select: text; }
