/* 웹 게시용 테마 — 젠스파크 대시보드 키트의 변수/클래스 중 이 앱이 쓰는 부분만 재현 */
:root {
  color-scheme: light dark;
  --brand-500: #2f6bff;
  --success-500: #1f9d63;
  --warn-500: #c78500;
  --danger-500: #d64545;
  --ink-700: #1b1f27;
  --gap: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo",
    "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand-500: #6b9bff;
    --success-500: #4cc38a;
    --warn-500: #e0a83a;
    --danger-500: #ef6b6b;
    --ink-700: #eef1f6;
    color: CanvasText;
  }
}

html, body { background: Canvas; color: CanvasText; }
body { line-height: 1.45; }

/* 타이포 */
.t-h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; }
.t-h3 { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }
.t-micro { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.t-small { font-size: 12.5px; color: var(--muted); }

/* 헤더 */
.gs-hero {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 4px 0 18px; flex-wrap: wrap;
}
.gs-hero-side { display: flex; gap: 6px; align-items: center; }

/* 카드/섹션 */
.card {
  border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px;
  background: Canvas;
}
.sec { margin-bottom: var(--gap); }
.panels { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
@media (max-width: 980px) { .panels { grid-template-columns: 1fr; } }
.panels > .card { height: 100%; }

/* 통계 타일 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.stat {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  background: color-mix(in oklab, currentColor 2%, transparent);
}
.stat-label { font-size: 11.5px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-label i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.stat-value { font-size: 21px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.stat-value .unit, .stat-amt .unit { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.stat-split { display: flex; align-items: baseline; gap: 10px; margin-top: 4px; }
.stat-split .stat-value { margin-top: 0; }
.stat-amt {
  font-size: 12.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums;
  border-left: 1px dashed var(--line); padding-left: 10px;
}
.stat-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.tone-good { color: var(--success-500); }
.tone-bad { color: var(--danger-500); }
.tone-muted { color: var(--muted); }

/* 막대/범례 */
.stack { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--soft); margin: 12px 0 8px; }
.stack i { display: block; height: 100%; }
.chart-box { margin-top: 4px; }
.note { font-size: 11.5px; color: var(--muted); margin: 10px 0 0; line-height: 1.5; }

/* 최종납입월 분포 */
.lp-row { display: grid; grid-template-columns: 92px 1fr auto; align-items: center; gap: 10px; margin-bottom: 8px; }
.lp-name { font-size: 12.5px; font-weight: 600; }
.lp-bar { height: 7px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.lp-bar i { display: block; height: 100%; background: var(--brand-500); }
.lp-val { font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lp-val .sub { margin-left: 6px; }

/* 도넛 */
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; flex: none; }
.donut-n { font-size: 22px; font-weight: 800; fill: currentColor; }
.donut-t { font-size: 10px; fill: var(--muted); }
.donut-legend { flex: 1 1 160px; display: flex; flex-direction: column; gap: 6px; }
.donut-li { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.donut-li i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.donut-lb { flex: 1 1 auto; }
.donut-vl { font-weight: 700; font-variant-numeric: tabular-nums; }

/* 가로 막대 */
.bar-wrap { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.bar-row { display: grid; grid-template-columns: 84px 1fr 78px; align-items: center; gap: 10px; }
.bar-lb { font-size: 12.5px; }
.bar-tr { height: 9px; border-radius: 5px; background: var(--soft); overflow: hidden; }
.bar-tr i { display: block; height: 100%; background: var(--brand-500); border-radius: 5px; }
.bar-vl { font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

/* 드로어 정의 목록 */
.gs-dl { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; margin: 0; }
.gs-dl dt { font-size: 12px; color: var(--muted); font-weight: 600; }
.gs-dl dd { margin: 0; font-size: 13px; }

/* 토스트 / 모달 / 메뉴 */
.shim-toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 90; }
.shim-toast {
  padding: 10px 14px; border-radius: 10px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); background: Canvas; box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
}
.shim-toast.success { color: var(--success-500); }
.shim-toast.danger { color: var(--danger-500); }
.shim-toast.info { color: var(--brand-500); }

.shim-back {
  position: fixed; inset: 0; background: rgba(10, 12, 18, .45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.shim-back-drawer { align-items: stretch; justify-content: flex-end; padding: 0; }
.shim-dialog {
  background: Canvas; color: inherit; border-radius: 14px; border: 1px solid var(--line);
  width: min(720px, 100%); max-height: 88vh; overflow: auto;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .28); padding: 18px 20px;
}
.shim-back-drawer .shim-dialog { height: 100%; max-height: none; border-radius: 0; width: min(460px, 92vw); }
.shim-dialog-head { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.shim-dialog-body { font-size: 13px; }
.shim-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.btn.danger { color: var(--danger-500); border-color: color-mix(in oklab, var(--danger-500) 45%, transparent); }

.shim-menu {
  position: absolute; z-index: 110; min-width: 170px; padding: 6px;
  border: 1px solid var(--line); border-radius: 10px; background: Canvas;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .2); display: flex; flex-direction: column;
}
.shim-menu button {
  text-align: left; padding: 8px 10px; border: 0; background: transparent; color: inherit;
  font: inherit; font-size: 13px; border-radius: 7px; cursor: pointer;
}
.shim-menu button:hover { background: var(--soft); }
.shim-menu button.danger { color: var(--danger-500); }

/* 읽기 전용 배너 */
.ro-banner {
  margin: 0 0 14px; padding: 9px 14px; border-radius: 10px; font-size: 12.5px;
  border: 1px solid color-mix(in oklab, var(--brand-500) 35%, transparent);
  background: color-mix(in oklab, var(--brand-500) 8%, transparent);
  color: color-mix(in oklab, var(--brand-500) 80%, CanvasText);
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
