/* =====================================================================
   앱플러 UI 세트 — 토큰 + 컴포넌트 (docs-dev/ui-set.md)
   · 다크 고정. 모든 컴포넌트 클래스는 u- 로 시작 → app.css 의 옛 화면과 안 겹침
   · 값 단계: 간격 4/8/12/16/24/32 · 모서리 4/6/8/12/999 · 글자 11/12/13/14/16/18/20/26 · 높이 28/32/36
   · 로그인 없이도 열리는 파일 (로그인 화면이 토큰을 씀) — 내부 경로·민감한 내용 넣지 말 것
   ===================================================================== */
:root {
  /* 색 · 간격 · 모서리 · 글자 · 높이는 이 한 곳. app.css 의 옛 이름(--ink · --surface …)은 여기 값을 가리키기만 함 */
  color-scheme: dark;
  /* 바탕 · 판 */
  --bg: #0d0d0d;
  --surface-1: #1a1a19;     /* 카드 · 패널 */
  --surface-2: #232321;     /* 띠 · 입력 바탕 · hover */
  --surface-3: #2c2c2a;     /* 띠 hover */
  --inset: #121211;         /* 카드 안 판 · 펼친 묶음 */
  --line: #2c2c2a;          /* 표 줄 · 구분선 */
  --line-strong: #383835;   /* 합계 줄 위 · 그래프 축 */
  --border: rgba(255, 255, 255, 0.10);
  /* 글자 */
  --text-1: #ffffff;
  --text-2: #c3c2b7;
  --text-3: #898781;
  --on-strong: #ffffff;     /* 진한 바탕(배지) 위 글자 */
  /* 강조 */
  --accent: #3987e5;
  --accent-wash: #16273d;
  --accent-soft: #1c5cab;   /* 2단 접기 묶음 왼쪽 선 */
  /* 상태 5색 (ui.status) */
  --tone-plan: #3987e5;  --tone-plan-wash: #16273d;
  --tone-wait: #fab219;  --tone-wait-wash: #3a2f15;
  --tone-late: #e5534b;  --tone-late-wash: #3a1d1d;
  --tone-done: #2fb344;  --tone-done-wash: #16301a;
  --tone-off:  #898781;  --tone-off-wash:  #232321;
  /* 분류 5색 (ui.cat) */
  --cat-project: #3987e5;
  --cat-sales:   #9a6fd0;
  --cat-legal:   #d03b3b;
  --cat-tax:     #fab219;
  --cat-admin:   #4fa6a0;   /* 행정 — 차분한 청록 (수입 초록 #199e70 · 프로젝트 파랑과 구분) */
  --cat-contract: #ff8c32;  /* 계약(요점 꼬리표) — 주황. 세금 호박색 · 지출 주황빨강 · 법무 빨강 사이 (ΔE00 16 · 16 · 23), surface-2 위 글자 대비 6.8:1 */
  --cat-ops:     #898781;
  /* 돈 */
  --money-in: #199e70;  --money-in-wash: #10352a;
  --money-out: #d95926; --money-out-wash: #3d2318;   /* wash = 그래프 "예정" 막대 */
  /* 그림자 */
  --shadow-tip: 0 4px 12px rgba(0, 0, 0, 0.12);     /* 말풍선 */
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.35);     /* 팝업 · 알림 · 시트 */
  --shadow-panel: -8px 0 24px rgba(0, 0, 0, 0.30);  /* 오른쪽 패널 · 서랍 */
  --shadow-side: 8px 0 24px rgba(0, 0, 0, 0.20);    /* 왼쪽 메뉴(좁은 화면) */
  --scrim: rgba(0, 0, 0, 0.45);                      /* 시트 · 대화상자 뒤 막 */
  --scrim-light: rgba(0, 0, 0, 0.25);                /* 패널 · 메뉴 뒤 막 */
  --white: #ffffff; --ink-on-white: #111111;
  --chevron: #e2e1da;   /* ⌄ 화살표 (select 배경 SVG 안의 같은 색은 data URI 라 숫자로 — 바꿀 땐 같이) */         /* 주 버튼(흰 바탕) · 인쇄 바탕 */
  /* 간격 */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  /* 모서리 */
  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-pill: 999px;
  /* 글자 */
  --fs-xs: 11px; --fs-sm: 12px; --fs-md: 13px; --fs-lg: 14px; --fs-xl: 16px; --fs-2xl: 18px; --fs-3xl: 20px; --fs-num: 26px;
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif;
  /* 컨트롤 높이 */
  --h-sm: 28px; --h-md: 32px; --h-lg: 36px;
}

/* ---------- 카드 · 카드 밖 제목 · 구역 ---------- */
.u-sec { display: flex; flex-direction: column; min-width: 0; margin-bottom: var(--sp-5); }
.u-sec-h { display: flex; align-items: center; gap: var(--sp-2) var(--sp-3); flex-wrap: wrap; margin: 0 2px var(--sp-3); min-height: var(--h-md); }
.u-sec-h h2 { margin: 0; font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.01em; display: inline-flex; align-items: center; gap: var(--sp-2); cursor: default; }
.u-sec-h .u-meta { margin-left: auto; display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-3); flex-wrap: wrap; }
.u-sec.is-folded > .u-card, .u-sec.is-folded > .u-bare { display: none; }
.u-fold-sum { display: none; font-size: var(--fs-md); font-weight: 400; color: var(--text-2); }
.u-sec.is-folded .u-fold-sum { display: inline; }
.u-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-4); min-width: 0; }
.u-section { margin-top: var(--sp-4); padding: var(--sp-3) var(--sp-4); background: var(--inset); border-radius: var(--r-lg); }
.u-section:first-child { margin-top: 0; }
.u-section-h { font-size: var(--fs-sm); font-weight: 600; color: var(--text-3); margin: 0 0 var(--sp-2); }

/* ---------- 버튼 — 모두 같은 모양: 높이 32(작게 28) · 모서리 6 · 1px 실선. 아이콘 버튼도 같은 모서리 ---------- */
.u-btn, .u-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: transparent; color: var(--text-1); font: inherit; cursor: pointer; white-space: nowrap; }
.u-btn { gap: var(--sp-1); height: var(--h-md); padding: 0 var(--sp-3); font-size: var(--fs-md); font-weight: 500; }
.u-btn.sm { height: var(--h-sm); padding: 0 var(--sp-2); font-size: var(--fs-sm); }
.u-btn svg { width: 14px; height: 14px; }
.u-btn.sm svg { width: 12px; height: 12px; }
.u-btn:hover, .u-btn.is-hover { background: var(--surface-2); border-color: var(--text-3); }
/* 주 — 흰 바탕 · 검은 글자, 한 화면에 하나만 */
.u-btn.primary { background: var(--white); color: var(--ink-on-white); border-color: var(--white); font-weight: 600; }
.u-btn.primary:hover, .u-btn.primary.is-hover { background: var(--text-2); border-color: var(--text-2); }
/* 옅은 — 테두리 없음 (자리는 그대로 1px 투명) */
.u-btn.ghost { border-color: transparent; color: var(--text-2); }
.u-btn.ghost:hover, .u-btn.ghost.is-hover { background: var(--surface-2); border-color: transparent; color: var(--text-1); }
/* 위험 — 기본과 같은 모양에 글자만 빨강, 올렸을 때만 테두리도 빨강 */
.u-btn.danger { color: var(--tone-late); }
.u-btn.danger:hover, .u-btn.danger.is-hover { border-color: var(--tone-late); }
/* 추가 — 옅은 버튼 + 앞에 +, 글자 accent */
.u-btn.ghost.add, .u-btn.ghost.add:hover, .u-btn.ghost.add.is-hover { color: var(--accent); }
.u-btn[disabled] { opacity: .4; cursor: default; pointer-events: none; }

/* 아이콘 버튼 (접기 · 닫기 · 수정 · 삭제 · 더하기) — 28 정사각 */
.u-icon { width: var(--h-sm); height: var(--h-sm); padding: 0; color: var(--text-2); }
.u-icon svg { width: 14px; height: 14px; }
.u-icon:hover, .u-icon.is-hover { background: var(--surface-2); color: var(--text-1); border-color: var(--text-3); }
.u-icon.danger:hover, .u-icon.danger.is-hover { color: var(--tone-late); border-color: var(--tone-late); }
.u-icon[disabled] { opacity: .35; cursor: default; pointer-events: none; }
.u-icon.ghost { border-color: transparent; background: transparent; }
/* 접기: › 를 90° 돌리면 펼침, 접힘은 강조색 */
.u-icon.fold svg { transition: transform .15s; transform: rotate(90deg); }
.is-folded > .u-sec-h .u-icon.fold svg, details.u-group:not([open]) > summary .u-icon.fold svg { transform: none; }
.is-folded > .u-sec-h .u-icon.fold, details.u-group:not([open]) > summary .u-icon.fold { color: var(--accent); border-color: var(--accent); }

/* ---------- 탭 — 큰 묶음 나눠 보기: 글자 + 고른 탭 밑줄 2px accent, 상자 없음 ---------- */
.u-tabs { display: flex; gap: var(--sp-5); border-bottom: 1px solid var(--line); margin: 0 0 var(--sp-3); overflow-x: auto; scrollbar-width: none; }
.u-tab { position: relative; height: var(--h-lg); padding: 0 2px; border: 0; background: none; color: var(--text-2); font: inherit; font-size: var(--fs-lg); font-weight: 500; cursor: pointer; white-space: nowrap; }
.u-tab:hover, .u-tab.is-hover { color: var(--text-1); }
.u-tab[aria-selected="true"] { color: var(--text-1); font-weight: 700; }
.u-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); border-radius: 1px; }
.u-tab .u-n { margin-left: var(--sp-1); font-size: var(--fs-sm); font-weight: 400; color: var(--text-3); font-variant-numeric: tabular-nums; }
.u-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--r-xs); }

/* ---------- 고르는 칩 — 고른 것 = 파란 테두리 + 옅은 파랑 (하나로) ---------- */
.u-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.u-chip { height: var(--h-sm); padding: 0 var(--sp-3); border-radius: var(--r-pill); border: 1px solid var(--border); background: transparent; color: var(--text-2);
  font: inherit; font-size: var(--fs-sm); cursor: pointer; white-space: nowrap; }
.u-chip:hover, .u-chip.is-hover { background: var(--surface-2); color: var(--text-1); }
.u-chip[aria-pressed="true"] { background: var(--accent-wash); border-color: var(--accent); color: var(--text-1); }
.u-chip .u-n { margin-left: var(--sp-1); color: var(--text-3); font-variant-numeric: tabular-nums; }
.u-chip[disabled] { opacity: .4; pointer-events: none; }

/* ---------- 상태 — 배경 없이 색 점(6px) + 무채색 글자, 미납만 글자도 빨강 ---------- */
.u-status { --t: var(--tone-off); display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 500; color: var(--text-1); white-space: nowrap; }
.u-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--t); flex: 0 0 auto; }
.u-status.plan { --t: var(--tone-plan); } .u-status.wait { --t: var(--tone-wait); } .u-status.done { --t: var(--tone-done); } .u-status.off { --t: var(--tone-off); color: var(--text-2); }
.u-status.late { --t: var(--tone-late); color: var(--tone-late); font-weight: 600; }
/* 상태 고르기 — 패널 입력 칸: 무채색 칸 + 왼쪽 색 점 + 오른쪽 ⌄ (높이 32, 13px 600) */
.u-ssel { --t: var(--tone-off); position: relative; display: inline-flex; align-items: center; height: var(--h-md); border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-1); }
.u-ssel.plan { --t: var(--tone-plan); } .u-ssel.wait { --t: var(--tone-wait); } .u-ssel.late { --t: var(--tone-late); } .u-ssel.done { --t: var(--tone-done); } .u-ssel.off { --t: var(--tone-off); }
.u-ssel:hover, .u-ssel.is-hover { background: var(--surface-3); border-color: var(--text-3); }
.u-ssel:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.u-ssel-dot { position: absolute; left: var(--sp-3); top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--t); pointer-events: none; }
.u-ssel select { -webkit-appearance: none; appearance: none; height: 100%; border: 0; background: transparent; color: inherit; font: inherit; font-size: var(--fs-md); font-weight: 600;
  padding: 0 calc(var(--sp-3) + 18px) 0 calc(var(--sp-3) + 14px); border-radius: inherit; cursor: pointer; }
.u-ssel select:focus { outline: none; }
.u-ssel select option { color: var(--text-1); background: var(--surface-1); font-weight: 400; }
.u-ssel-i { position: absolute; right: var(--sp-2); top: 50%; width: 16px; height: 16px; margin-top: -8px; pointer-events: none; display: inline-flex; color: var(--chevron); }
.u-ssel-i svg { width: 16px; height: 16px; transform: rotate(90deg); }   /* 접기 버튼과 같은 › 를 돌린 ⌄ */

/* ---------- 분류 (그냥 글자) · 꼬리표 · 작은 글 ---------- */
.u-cat { font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap; }
.u-tag { display: inline-flex; align-items: center; height: 18px; padding: 0 var(--sp-1); border: 1px solid var(--border); border-radius: var(--r-xs); font-size: var(--fs-xs);
  color: var(--text-2); background: none; white-space: nowrap; vertical-align: 1px; }
.u-mob { display: none !important; }   /* 좁은 화면(≤600)에서만 — 넓은 화면엔 같은 정보가 칸으로 있을 때 */
@media (max-width: 600px) { .u-mob { display: inline-flex !important; } }
.u-push { margin-left: auto; }   /* 줄(flex)의 오른쪽 끝으로 */
.u-sub { display: block; font-size: var(--fs-sm); color: var(--text-3); margin-top: 2px; }
.u-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 var(--sp-1); border-radius: var(--r-pill);
  background: var(--tone-late); color: var(--on-strong); font-size: var(--fs-xs); font-weight: 600; }

/* ---------- 표 ---------- */
.u-table-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--sp-1)); }
.u-table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.u-table th { text-align: left; font-size: var(--fs-sm); font-weight: 500; color: var(--text-3); padding: var(--sp-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.u-table td { padding: var(--sp-2); border-bottom: 1px solid var(--line); vertical-align: top; color: var(--text-1); }
.u-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.u-table .nowrap { white-space: nowrap; }
.u-table tr.is-click { cursor: pointer; }
.u-table tr.is-click:hover td, .u-table tr.is-hover td { background: var(--surface-2); }
.u-table tr.total td { font-weight: 700; border-bottom: 0; }
.u-table td.acts { width: 1%; text-align: right; }
.u-table td { word-break: keep-all; }   /* 한글 낱말 중간에서 끊지 않음 */
/* 좁은 화면(≤600): 간단 표도 2줄 쌓기 — 1줄 날짜 · 내용 … 금액, 2줄 (내용 아래 설명 한 줄 말줄임) … 상태. 줄 끝 수정·삭제는 뺌(줄을 누르면 패널) */
@media (max-width: 600px) {
  .u-table.compact, .u-table.compact tbody { display: block; }
  .u-table.compact tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "d m a" "d m s"; column-gap: var(--sp-2); row-gap: 2px; padding: var(--sp-2) 2px; border-bottom: 1px solid var(--line); align-items: start; }
  .u-table.compact tr:last-child { border-bottom: 0; }
  .u-table.compact tr > td { display: block; height: auto; padding: 0; border: 0; min-width: 0; }   /* 아래 기본 간단 표 규칙(높이 32)보다 세게 */
  .u-table.compact td.u-c-date { grid-area: d; }
  .u-table.compact td.u-c-main { grid-area: m; width: auto; }
  .u-table.compact td.u-c-main .u-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .u-table.compact td.num { grid-area: a; }
  .u-table.compact td.u-c-st { grid-area: s; text-align: right; }
  .u-table td.acts { display: none; }
}
/* 줄 끝 수정·삭제 — 마우스를 올리면 보임, 터치·좁은 화면은 늘 */
.u-acts { display: inline-flex; gap: var(--sp-1); opacity: 0; transition: opacity .1s; }
tr:hover .u-acts, tr:focus-within .u-acts, .is-hover .u-acts { opacity: 1; }
@media (hover: none), (max-width: 600px) { .u-acts { opacity: 1; } }

/* 간단 표 (패널 안 짧은 목록·팝업) — 머리 줄 없음 · 줄 높이 32 · 날짜 | 내용 | 상태 | 금액 */
.u-table.compact td { height: var(--h-md); padding: var(--sp-1) var(--sp-2); vertical-align: middle; }
.u-table.compact tr:last-child td { border-bottom: 0; }
.u-table td.u-c-main { width: 100%; }
.u-table td.u-c-date { width: 1%; white-space: nowrap; color: var(--text-3); font-variant-numeric: tabular-nums; }
.u-table tr.is-done td { color: var(--text-3); }

/* ---------- 접기 묶음 (띠 + 안쪽 판) ---------- */
details.u-group { border-radius: var(--r-md); margin: 0 0 var(--sp-2); }
details.u-group > summary { list-style: none; display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); min-height: var(--h-lg); border-radius: var(--r-md);
  background: var(--surface-2); cursor: pointer; }
details.u-group > summary::-webkit-details-marker { display: none; }
details.u-group > summary::marker { content: ""; }
details.u-group > summary:hover, details.u-group > summary.is-hover { background: var(--surface-3); }
details.u-group > summary .u-g-t { font-weight: 700; }
details.u-group > summary .u-g-n { color: var(--text-3); font-size: var(--fs-sm); }
details.u-group > summary .u-g-s { margin-left: auto; display: inline-flex; gap: var(--sp-4); font-size: var(--fs-md); color: var(--text-2); font-variant-numeric: tabular-nums; flex-wrap: wrap; justify-content: flex-end; }
details.u-group > summary .u-g-s b { color: var(--text-1); }
details.u-group[open] { background: var(--inset); box-shadow: inset 2px 0 0 var(--accent); padding-bottom: var(--sp-2); }
details.u-group[open] > summary { border-radius: var(--r-md) var(--r-md) 0 0; }
details.u-group[open] > .u-g-body { padding: var(--sp-2) var(--sp-3) 0; }
details.u-group.lv2 > summary { background: var(--surface-1); padding: var(--sp-1) var(--sp-3); min-height: var(--h-md); }
details.u-group.lv2 > summary:hover { background: var(--surface-2); }
details.u-group.lv2[open] { background: var(--bg); box-shadow: inset 2px 0 0 var(--accent-soft); }

.u-foldall-bar { display: flex; justify-content: flex-end; margin: 0 0 var(--sp-1); }
.u-foldall { flex: 0 0 auto; }

/* ---------- 입력 ---------- */
.u-input, .u-select, .u-textarea { font: inherit; font-size: var(--fs-md); color: var(--text-1); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); height: var(--h-md); padding: 0 var(--sp-3); min-width: 0; width: 100%; }
.u-input.sm, .u-select.sm { height: var(--h-sm); font-size: var(--fs-sm); padding: 0 var(--sp-2); }
.u-textarea { height: auto; min-height: 72px; padding: var(--sp-2) var(--sp-3); resize: vertical; line-height: 1.5; }
.u-input:hover, .u-select:hover, .u-textarea:hover, .u-input.is-hover { border-color: var(--text-3); }
.u-input:focus, .u-select:focus, .u-textarea:focus { outline: none; border-color: var(--accent); }
.u-input::placeholder, .u-textarea::placeholder { color: var(--text-3); }
.u-input[disabled], .u-select[disabled], .u-textarea[disabled] { opacity: .45; }
.u-input.money { text-align: right; font-variant-numeric: tabular-nums; }
.u-search { position: relative; }

/* ---------- 속성 줄 (이름 | 값) — 패널·장부 편집 공통 ---------- */
.u-props { display: flex; flex-direction: column; gap: 2px; }
.u-prop { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; min-height: var(--h-lg); gap: var(--sp-2); }
.u-prop-k { font-size: var(--fs-md); color: var(--text-3); }
.u-prop-v { min-width: 0; }
.u-prop-v .u-input, .u-prop-v .u-select { background: transparent; border-color: transparent; }
.u-prop-v .u-input:hover, .u-prop-v .u-select:hover { background: var(--surface-2); }
.u-prop-v .u-input:focus, .u-prop-v .u-select:focus { background: var(--surface-2); border-color: var(--accent); }

/* ---------- 패널 ---------- */
.u-panel { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-4) var(--sp-5) var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-4); }
.u-panel.is-fixed { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); border-radius: 0; box-shadow: var(--shadow-panel); overflow-y: auto; z-index: 70; }
.u-panel-h { display: flex; align-items: flex-start; gap: var(--sp-2); }
.u-panel-t { flex: 1; min-width: 0; font-size: var(--fs-3xl); font-weight: 700; line-height: 1.35; margin: 2px 0 0; word-break: keep-all; }
.u-panel-save { font-size: var(--fs-sm); color: var(--text-3); align-self: center; white-space: nowrap; }
.u-panel-s { display: flex; flex-direction: column; gap: var(--sp-2); }
.u-panel-sh { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); font-weight: 600; color: var(--text-3); }
.u-panel-f { display: flex; justify-content: flex-end; gap: var(--sp-2); }

/* ---------- KPI · 요약 줄 ---------- */
.u-kpis { display: grid; gap: var(--sp-4); grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); }
@media (max-width: 900px) { .u-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.u-kpi { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-4); min-width: 0; }
.u-kpi.is-go { cursor: pointer; }
.u-kpi.is-go:hover, .u-kpi.is-hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.u-kpi-l { font-size: var(--fs-sm); color: var(--text-2); display: flex; align-items: center; gap: var(--sp-1); }
.u-kpi-l .u-go { color: var(--accent); }
.u-kpi-v { font-size: var(--fs-num); font-weight: 700; letter-spacing: -0.02em; margin: var(--sp-1) 0 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.u-kpi-f { font-size: var(--fs-sm); color: var(--text-3); word-break: keep-all; }
.u-kpi.sm { padding: var(--sp-3); }
.u-kpi.sm .u-kpi-v { font-size: var(--fs-3xl); margin: 2px 0 0; }
.u-kpi.sm .u-kpi-f { font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 요약 칸 묶음 — 위 이름+건수(12, text-3) · 아래 금액(16 굵게), 칸 사이 세로 실선. 합계는 맨 오른쪽 18 */
.u-sum { display: flex; align-items: stretch; padding: var(--sp-1) 0 var(--sp-3); margin-bottom: var(--sp-1); border-bottom: 1px solid var(--line); }
.u-sum-c { padding: 0 var(--sp-5); border-left: 1px solid var(--border); min-width: 0; }
.u-sum-c:first-child { padding-left: 0; border-left: 0; }
.u-sum-l { font-size: var(--fs-sm); color: var(--text-3); white-space: nowrap; }
.u-sum-l .u-n { margin-left: var(--sp-1); font-variant-numeric: tabular-nums; }
.u-sum-v { margin-top: 2px; font-size: var(--fs-xl); font-weight: 700; color: var(--text-1); font-variant-numeric: tabular-nums; white-space: nowrap; }
.u-sum-c.late .u-sum-v { color: var(--tone-late); }
.u-sum-c.total { margin-left: auto; padding-right: 0; text-align: right; }
.u-sum-c.total .u-sum-v { font-size: var(--fs-2xl); }
@media (max-width: 600px) {
  .u-sum { display: grid; grid-template-columns: 1fr 1fr; row-gap: var(--sp-3); }
  .u-sum-c { padding: 0 var(--sp-3); }
  .u-sum-c:nth-child(odd) { padding-left: 0; border-left: 0; }
  .u-sum-c.total { grid-column: 1 / -1; margin-left: 0; padding: var(--sp-2) 0 0; border-left: 0; border-top: 1px solid var(--border); text-align: left; display: flex; align-items: baseline; justify-content: space-between; }
}

/* ---------- 빈 화면 ---------- */
.u-empty { font-size: var(--fs-md); color: var(--text-3); padding: var(--sp-3) var(--sp-1); }

/* ---------- 페이저 — 번호는 가운데, 총 n건은 오른쪽 끝 작게 (모바일은 번호 아래 가운데) ---------- */
.u-pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--sp-2); margin: var(--sp-3) 0 var(--sp-1); font-size: var(--fs-sm); }
.u-pg-nums { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: var(--sp-1); }
.u-pg { min-width: var(--h-sm); height: var(--h-sm); padding: 0 var(--sp-2); border-radius: var(--r-sm); border: 1px solid var(--border); background: transparent; color: var(--text-2);
  font: inherit; font-size: var(--fs-sm); cursor: pointer; font-variant-numeric: tabular-nums; }
.u-pg:hover:not([disabled]), .u-pg.is-hover { background: var(--surface-2); color: var(--text-1); border-color: var(--text-3); }
.u-pg[aria-current="page"] { background: var(--accent-wash); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.u-pg[disabled] { opacity: .35; cursor: default; }
.u-pg-gap { color: var(--text-3); padding: 0 2px; }
.u-pg-total { justify-self: end; font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
@media (max-width: 600px) { .u-pager { grid-template-columns: 1fr; justify-items: center; } .u-pg-sp { display: none; } .u-pg-total { justify-self: center; } }

/* ---------- 알림 · 확인 시트 · 팝업 ---------- */
.u-toast { position: fixed; left: 50%; bottom: var(--sp-5); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 95; display: flex; align-items: center; gap: var(--sp-3);
  max-width: calc(100vw - 32px); padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4); border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border);
  box-shadow: var(--shadow-pop); color: var(--text-1); font-size: var(--fs-md); transition: opacity .15s, transform .15s; }
.u-toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.u-toast.error { border-color: var(--tone-late); }
.u-toast-m { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-toast .u-btn.ghost { color: var(--accent); font-weight: 600; }
.u-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 96; display: flex; align-items: flex-end; justify-content: center; padding: var(--sp-4); }
.u-sheet { width: min(420px, 100%); background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
  padding: var(--sp-4) var(--sp-4) var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-3); margin-bottom: 10vh; max-height: calc(100vh - 32px); overflow-y: auto; }
@media (min-width: 601px) { .u-scrim { align-items: center; } .u-sheet { margin-bottom: 0; } }
.u-sheet-t { font-size: var(--fs-xl); font-weight: 700; margin: 0; }
.u-sheet-b { font-size: var(--fs-md); color: var(--text-2); margin: 0; line-height: 1.5; }
.u-sheet-f { display: flex; justify-content: flex-end; gap: var(--sp-2); }
.u-pop { position: fixed; z-index: 94; width: min(360px, calc(100vw - 24px)); max-height: 60vh; overflow-y: auto; background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: var(--sp-3); }
/* 팝업 안 목록은 간단 표 */
.u-pop .u-table.compact td { height: 28px; }
.u-pop-h { font-size: var(--fs-sm); font-weight: 700; color: var(--text-2); padding-bottom: var(--sp-2); border-bottom: 1px solid var(--line); margin-bottom: var(--sp-1); }
.u-pop-h span { font-weight: 400; color: var(--text-3); margin-left: var(--sp-1); }
.u-pop.inline { position: static; width: auto; max-width: 360px; }

/* ---------- 설정 › 디자인 견본 전용 배치 ---------- */
.u-demo { color: var(--text-1); font-size: var(--fs-md); }
.u-demo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: var(--sp-4); align-items: start; }
.u-demo-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin: 0 0 var(--sp-3); }
.u-demo-l { font-size: var(--fs-xs); color: var(--text-3); margin: var(--sp-3) 0 var(--sp-2); }
.u-demo-l:first-child { margin-top: 0; }
.u-demo-row:has(> .u-st) { align-items: stretch; }
.u-st { display: inline-grid; grid-template-rows: 1fr auto; justify-items: center; align-items: center; gap: var(--sp-1); }
.u-st > small { font-size: var(--fs-xs); color: var(--text-3); }
.u-sw { display: inline-flex; flex-direction: column; gap: 2px; width: 96px; font-size: var(--fs-xs); color: var(--text-3); }
.u-sw i { display: block; height: 36px; border-radius: var(--r-sm); border: 1px solid var(--border); }
.u-sp { display: inline-block; height: 12px; background: var(--accent); border-radius: 2px; }
.u-rd { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 40px; border: 1px solid var(--text-3); font-size: var(--fs-xs); color: var(--text-3); }

/* 드롭다운 화살표 (u-select) — 상태 고르기와 같은 ⌄, 밝은 회색 16px */
.u-select { -webkit-appearance: none; appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%23e2e1da' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px 16px; }
.u-select option { color: var(--text-1); background: var(--surface-1); }
.u-input[type=date]::-webkit-calendar-picker-indicator, .u-input[type=time]::-webkit-calendar-picker-indicator { opacity: .9; cursor: pointer; }

/* 줄 메뉴 (ui.menu) — ⋯ 아래 작은 목록. on = 지금 고른 것(앞에 ✓) */
.u-menu { position: fixed; z-index: 96; min-width: 160px; max-width: calc(100vw - 24px); background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-pop); padding: var(--sp-1); display: flex; flex-direction: column; max-height: calc(100vh - 24px); overflow-y: auto; overscroll-behavior: contain; }
.u-menu-i { display: flex; align-items: center; gap: var(--sp-2); min-height: var(--h-md); padding: 0 var(--sp-3) 0 22px; border: 0; border-radius: var(--r-sm); background: transparent;
  color: var(--text-1); font: inherit; font-size: var(--fs-md); text-align: left; cursor: pointer; position: relative; white-space: nowrap; }
.u-menu-i:hover, .u-menu-i:focus-visible { background: var(--surface-2); outline: none; }
.u-menu-i.on::before { content: "✓"; position: absolute; left: 7px; color: var(--accent); }
.u-menu-i[disabled] { color: var(--text-3); cursor: default; background: transparent; }
.u-menu-sep { height: 1px; background: var(--line); margin: var(--sp-1) 0; }

/* 입력 시트(ui.sheet) 안 — 이름 붙은 한 줄 · 안내(빨강) */
.u-sheet-row { display: flex; align-items: center; gap: var(--sp-2); }
.u-sheet-row > span { font-size: var(--fs-md); color: var(--text-2); min-width: 44px; }
.u-sheet-err { font-size: var(--fs-md); color: var(--tone-late); margin: 0; min-height: 1em; }
