/* 달력(월 달력) - 동작은 calendar.js, 규칙은 claude_common/ui/calendar.md
   대시보드 스케줄 달력이 기준(2026-10-27): 주마다 한 줄(.cal-week), 날짜 칸 위에 일정 막대 층(.cal-bars)을 겹친다.
   여러 날 일정은 이어진 막대, 시각 있는 하루 일정은 점 + 시각, 칸이 모자라면 "+N개". 7열 고정(일~토).
   칸에 금액이 드는 달력(.is-wide)은 칸 최소 폭을 지키고 좁으면 가로로 민다. */
.cal {
  --cal-sun: var(--uk-danger);            /* 일요일·공휴일 */
  --cal-sat: var(--uk-brand);             /* 토요일 */
  display: flex; flex-direction: column; min-width: 0;
}

/* 넘기기 줄 [오늘] [‹] 2026년 10월 [›] - 한 번 누르면 한 달. 드롭다운으로 바꾸지 않는다 */
.cal-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 0 0 8px; }
.cal-this { height: 32px; padding: 0 12px; border: 1px solid var(--uk-border); border-radius: var(--uk-r-sm); background: var(--uk-surface); color: var(--uk-fg); font: inherit; font-size: 13px; cursor: pointer; margin-right: 4px; display: inline-flex; align-items: center; text-decoration: none; }
.cal-this:hover { background: var(--uk-head); }
.cal-move { width: 32px; height: 32px; border: 0; border-radius: var(--uk-r-pill); background: none; color: var(--uk-fg); cursor: pointer; display: inline-grid; place-items: center; padding: 0; text-decoration: none; }
.cal-move > svg { width: 18px; height: 18px; }
.cal-move:hover { background: var(--uk-head); }
.cal-title { padding: 2px 6px; border: 0; border-radius: var(--uk-r-sm); background: none; color: var(--uk-fg); font: inherit; font-size: 18px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
button.cal-title { cursor: pointer; }
button.cal-title:hover { background: var(--uk-head); }
.cal-move:focus-visible, .cal-this:focus-visible, .cal-title:focus-visible, .cal-add:focus-visible, .cal-num:focus-visible, .cal-bar:focus-visible, .cal-more:focus-visible { outline: 2px solid var(--uk-brand); outline-offset: 1px; }

.cal-scroll { min-width: 0; }
.cal-month { --head: 26px; --lane-h: 21px; --lanes: 0; }
.cal-dow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--uk-line); }
.cal-dow > span { padding: 6px 8px; font-size: 12px; color: var(--uk-muted); text-align: center; }
.cal-dow > .is-sun { color: var(--cal-sun); }
.cal-dow > .is-sat { color: var(--cal-sat); }
.cal-week { position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--uk-line);
  min-height: calc(var(--head) + 14px + (var(--lanes) + 1) * var(--lane-h)); } /* 막대가 숫자 아래 14px(.cal-bar top)부터라 그만큼 더 - 빼면 "+N개"가 칸 밖으로 6px 넘쳤다(2026-10-28 SC-08) */
.cal-day { display: flex; flex-direction: column; align-items: stretch; min-width: 0; padding: 4px 6px; border-right: 1px solid var(--uk-line); color: var(--uk-fg); }
.cal-day:last-child { border-right: 0; }
.cal-day.is-pick { cursor: pointer; }
.cal-day.is-pick:hover { background: var(--uk-head); }
/* 앞뒤 달 날짜 - 바탕을 달리하고 숫자를 흐리게. 내용은 보이고 누를 수 있다 - 이 달 합계에는 넣지 않는다 */
.cal-day.is-outside { background: var(--uk-surface); }
.cal-day.is-outside .cal-num { color: var(--uk-muted); }
.cal-day.is-picked { box-shadow: inset 0 0 0 2px var(--uk-brand-light); }
.cal-date { display: flex; align-items: center; justify-content: space-between; gap: 2px; }
.cal-num { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 4px; border: 0; border-radius: var(--uk-r-pill); background: none; color: inherit;
  font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; cursor: inherit; }
.cal-day.is-sun .cal-num, .cal-day.is-holiday .cal-num { color: var(--cal-sun); }
.cal-day.is-sat .cal-num { color: var(--cal-sat); }
/* 오늘 = 파란 동그라미 숫자 */
.cal-day.is-today .cal-num { background: var(--uk-brand); color: var(--uk-on-strong); font-weight: 700; }
.cal-holiday { max-width: 100%; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--cal-sun); }
.cal-add { display: inline-grid; place-items: center; border: 0; background: none; color: var(--uk-muted); padding: 1px 4px; border-radius: var(--uk-r-xs); cursor: pointer; text-decoration: none; }
.cal-add > svg { width: 14px; height: 14px; } /* lucide plus */
.cal-add:hover { color: var(--uk-brand-dark); background: var(--uk-brand-light); }

/* 막대 - 날짜 칸 위에 겹쳐 놓는 층(누르기는 막대만 받는다). --c0 시작 칸, --span 칸 수, --lane 줄, --ev 일정 색 */
.cal-bars { position: absolute; inset: 0; pointer-events: none; }
.cal-bar, .cal-more { position: absolute; pointer-events: auto; top: calc(var(--head) + 14px + var(--lane) * var(--lane-h)); left: calc(var(--c0) * 100% / 7 + 2px); height: calc(var(--lane-h) - 3px);
  border: 0; font: inherit; cursor: pointer; text-decoration: none; }
.cal-bar { --ev: var(--uk-brand); width: calc(var(--span) * 100% / 7 - 4px); display: flex; align-items: center; gap: 4px; padding: 0 6px; border-radius: var(--uk-r-xs); overflow: hidden; text-align: left; }
.cal-bar-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 1; }
.cal-bar-check { flex: none; display: block; width: 12px; height: 12px; }
.cal-bar-check > svg { display: block; width: 100%; height: 100%; }
/* 여러 날·하루 종일 = 칠한 막대, 시각 있는 하루 일정 = 점 + 시각 */
.cal-bar.is-fill { background: color-mix(in srgb, var(--ev) 22%, var(--uk-paper)); color: var(--uk-fg); box-shadow: inset 3px 0 0 var(--ev); }
.cal-bar.is-fill.is-cut-l { box-shadow: none; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.cal-bar.is-cut-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cal-bar.is-dot { background: none; color: var(--uk-fg); padding-left: 14px; }
.cal-bar.is-dot::before { content: ""; position: absolute; left: 4px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--ev); }
.cal-bar.is-dot:hover, .cal-bar.is-fill:hover { filter: brightness(.96); background-color: var(--uk-head); }
/* 표시(경제지표 등 읽을거리) - 흐린 칩 */
.cal-bar.is-mark { background: var(--uk-sunk); color: var(--uk-muted); box-shadow: none; }
.cal-bar.is-done .cal-bar-text { text-decoration: line-through; opacity: .6; }
.cal-bar.is-done .cal-bar-check { opacity: .6; }
.cal-bar.is-overdue { color: var(--uk-danger); }
.cal-more { width: calc(100% / 7 - 4px); padding: 0 6px; background: none; color: var(--uk-muted); font-size: 12px; text-align: left; }
.cal-more:hover { color: var(--uk-fg); text-decoration: underline; }

/* 칸 안 숫자 줄(금액 달력) - 모든 칸이 같은 줄을 같은 차례로, 0인 줄도 자리를 지킨다 */
.cal-month.is-wide { --cal-min-col: 8.5rem; min-width: calc(7 * var(--cal-min-col)); }
.cal-scroll:has(> .cal-month.is-wide) { overflow-x: auto; overscroll-behavior-x: contain; }
.cal-month.is-wide .cal-week { min-height: 6.5rem; }
.cal-cell { width: 100%; margin-top: 3px; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.cal-cell th { text-align: left; color: var(--uk-muted); font-weight: 500; padding: 0 4px 0 0; white-space: nowrap; }
.cal-cell td { text-align: right; padding: 0 2px; }
.cal-cell tr.is-total th { color: var(--uk-fg); font-weight: 700; }
.cal-cell tr.is-total td { border-top: 1px solid var(--uk-line); font-weight: 700; }
.cal-day.is-outside .cal-cell { opacity: .55; }
/* 누르면 원자료(목록 모달)로 가는 숫자 - 점선 밑줄 */
.cal-cell-num { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; border-bottom: 1px dotted currentColor; }

.cal.is-sliding .cal-month { transition: transform .2s ease, opacity .2s ease; }

/* ── 휴대폰 ── 칸을 낮추고 글자를 줄인다. 공휴일 이름은 감춘다 */
@media (max-width: 767px) {
  .cal-nav { padding-bottom: 4px; }
  .cal-title { font-size: 16px; }
  .cal-month { --head: 22px; --lane-h: 18px; }
  .cal-day { padding: 2px 3px; }
  .cal-num { font-size: 12px; min-width: 20px; height: 20px; }
  .cal-add { padding: 0 2px; }
  .cal-month:not(.is-wide) .cal-holiday { display: none; }
  .cal-bar { padding: 0 3px; }
  .cal-bar-text { font-size: 10.5px; }
  .cal-bar-check { width: 10.5px; height: 10.5px; }
  .cal-bar.is-dot { padding-left: 9px; }
  .cal-bar.is-dot::before { left: 2px; width: 5px; height: 5px; margin-top: -2.5px; }
  .cal-more { font-size: 10.5px; padding: 0 3px; }
  /* 막대 글자는 줄바꿈하되 최대 2줄, 넘치면 …(2026-10-27 사용자 "최대 2줄까지만") - 칸이 좁아 한 줄이면 "GDP ..."처럼 잘렸고(10-23),
     끝까지 늘리면 3·4줄로 칸이 길어졌다. 전체 제목은 눌러 여는 창에서. 높이·위치는 calendar.js fitBars가 줄마다 잰다 */
  .cal-bar { height: auto; min-height: calc(var(--lane-h) - 3px); align-items: flex-start; padding-top: 2px; padding-bottom: 2px; }
  .cal-bar-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }
  .cal-bar.is-dot::before { top: 8px; margin-top: -2.5px; }
  .cal-bar-check { margin-top: 1.5px; } /* 줄바꿈 막대는 위로 붙는다 - 첫 줄 글자 가운데에 맞춤(줄 높이 1.25) */
}
@media (prefers-reduced-motion: reduce) { .cal.is-sliding .cal-month { transition: none; } }
/* 터치 화면에서 막대를 길게 누르면 글자가 골라지지 않게(길게 누르기 = 메뉴를 쓰는 화면이 있다) */
@media (hover: none) and (pointer: coarse) { .cal-bar, .cal-more, .cal-day { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; } }
