/* 복리일지 — style.css 토큰을 그대로 사용, 차트 선 색만 추가 */
:root {
  --plan: #12917f;   /* 목표 복리잔고 (청록, 점선) */
  --act: #7c4dff;    /* 실제잔고 (보라, 실선) */
  --done-bg: rgba(18, 145, 127, 0.08);
  --cur-bg: rgba(47, 111, 237, 0.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --plan: #26a592;
    --act: #8f6cff;
    --done-bg: rgba(38, 165, 146, 0.1);
    --cur-bg: rgba(91, 140, 255, 0.12);
  }
}

/* 화면 전환 탭 */
.view-nav { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.view-nav button {
  border: 0; background: none; padding: 10px 14px 9px; font-weight: 700; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.view-nav button[aria-selected='true'] { color: var(--ink); border-bottom-color: var(--accent); }

.cp { display: flex; flex-direction: column; gap: 12px; }
.cp-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.cp-head h2 { margin: 0; }
.cp-head > :last-child { margin-left: auto; }

/* 상단 목표 현황 */
.cp-hero-wrap h2 { font-size: 17px; letter-spacing: -0.02em; }
.cp-hero-main { display: grid; grid-template-columns: auto auto 1fr; gap: 10px 28px; align-items: end; }
.cp-round-big { font-size: 44px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.cp-round-of { font-size: 16px; font-weight: 600; color: var(--ink-2); }
.cp-now { grid-column: 1; }
.cp-tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.cp-tag.cur { background: var(--cur-bg); color: var(--accent); }
.cp-tag.done { background: var(--done-bg); color: var(--plan); }
.cp-balance { grid-row: 1 / span 2; grid-column: 2; }
.cp-balance .lab, .cp-stat .lab { font-size: 12px; color: var(--muted); }
.cp-balance .val { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.cp-balance .sub, .cp-stat .sub { font-size: 11px; color: var(--muted); min-height: 1em; }
.cp-bars { grid-row: 1 / span 2; grid-column: 3; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.cp-bar-lab { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); margin-bottom: 4px; }
.cp-bar-lab b { color: var(--ink); font-size: 14px; }
.cp-bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.cp-bar i { display: block; height: 100%; border-radius: 999px; background: var(--act); min-width: 4px; transition: width 0.4s; }
.cp-bar.alt i { background: var(--plan); }
.cp-hero-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.cp-stat { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.cp-stat .val { font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-ms { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.cp-ms-chip {
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); background: var(--surface); white-space: nowrap;
}
.cp-ms-chip.done { border-color: var(--plan); color: var(--plan); background: var(--done-bg); }
.cp-ms-chip.sm { font-size: 11px; padding: 1px 7px; }
.cp-ms-chip.pop { animation: cp-pop 0.6s ease-out 2; }
@keyframes cp-pop { 50% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .cp-ms-chip.pop { animation: none; } .cp-bar i { transition: none; } }

/* 기업정보·캘린더 연계 안내 */
.cp-corp-hint { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; font-size: 12px; }
.cp-corp-hint .lab { color: var(--muted); margin-right: 2px; }
.cp-corp-chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px; cursor: pointer; font-size: 12px; }
.cp-corp-chip:hover { background: var(--surface-2); }
.cp-corp-chip em { font-style: normal; font-weight: 800; color: var(--accent); margin-left: 4px; }
.cp-corp-chip i { font-style: normal; font-size: 10px; color: var(--muted); border: 1px dashed var(--line); border-radius: 4px; padding: 0 4px; margin-left: 4px; }

/* 차트 */
.cp-legend { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.cp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 18px; height: 0; border-top: 2px solid; }
.sw.plan { border-color: var(--plan); border-top-style: dashed; }
.sw.act { border-color: var(--act); }
.cp-chart { width: 100%; }
.cp-chart svg { display: block; touch-action: pan-y; }
.cp-grid { stroke: var(--line); stroke-width: 1; }
.cp-axis { fill: var(--muted); font-size: 11px; font-family: inherit; }
.cp-goal { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 4; }
.cp-line-plan { fill: none; stroke: var(--plan); stroke-width: 2; stroke-dasharray: 6 4; }
.cp-line-act { fill: none; stroke: var(--act); stroke-width: 2; stroke-linejoin: round; }
.cp-dot-act { fill: var(--act); stroke: var(--surface); stroke-width: 2; }
.cp-hair { stroke: var(--muted); stroke-width: 1; }
.cp-hdot { stroke: var(--surface); stroke-width: 2; }
.cp-hdot.plan { fill: var(--plan); }
.cp-hdot.act { fill: var(--act); }
.tip span { opacity: 0.8; }

/* 계획표 */
.cp-tools { display: flex; gap: 6px; align-items: center; }
.cp-tools select { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 5px 8px; }
.cp-table-wrap { max-height: 620px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.cp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cp-table th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 12px;
  padding: 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line);
}
.cp-table td { padding: 7px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
.cp-table th:first-child, .cp-table td.c-round { text-align: center; }
.cp-table td.c-memo { text-align: left; white-space: normal; min-width: 120px; max-width: 220px; color: var(--ink-2); }
.cp-table td.c-target { font-weight: 700; }
.cp-table td.c-actual { font-weight: 700; color: var(--act); }
.cp-row { cursor: pointer; }
.cp-row:hover td { background: var(--surface-2); }
.cp-row.st-done td { background: var(--done-bg); }
.cp-row.st-done td:not(.c-actual):not(:nth-child(10)) { color: var(--muted); }
.cp-row.st-current td { background: var(--cur-bg); font-weight: 700; }
.cp-row.st-current td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.cp-row.extra td { opacity: 0.6; }
.cp-now-dot { display: inline-block; margin-left: 4px; font-size: 9px; font-weight: 800; color: #fff; background: var(--accent); border-radius: 4px; padding: 1px 4px; vertical-align: middle; }
.cp-ms-row td { text-align: left; background: var(--surface); color: var(--ink-2); font-size: 12px; padding: 6px 12px; border-bottom: 1px dashed var(--line); }
.cp-ms-row.done td { color: var(--plan); }
.cp-badge { margin-left: 6px; font-size: 11px; font-weight: 800; color: #fff; background: var(--plan); border-radius: 999px; padding: 1px 8px; }
.cp-st { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 6px; white-space: nowrap; }
.cp-st.done { color: var(--plan); background: var(--done-bg); }
.cp-st.cur { color: var(--accent); background: var(--cur-bg); }
.cp-st.miss { color: var(--danger); background: rgba(198, 40, 40, 0.08); }
.cp-st.wait { color: var(--muted); }
.cp-manual { margin-left: 4px; font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.cp-empty { text-align: center !important; color: var(--muted); padding: 24px; }

/* 모바일 카드 (기본 숨김) */
.cp-cards { display: none; flex-direction: column; gap: 8px; }
.cp-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.cp-card.st-done { background: var(--done-bg); }
.cp-card.st-current { background: var(--cur-bg); border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.cp-card-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.cp-card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.cp-card-grid div { display: flex; flex-direction: column; }
.cp-card-grid span { font-size: 11px; color: var(--muted); }
.cp-card-grid b { font-size: 14px; }
.cp-card-memo { margin-top: 6px; font-size: 12px; color: var(--ink-2); }

/* 입력 대화상자 */
.cp-rec-plan { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.cp-rec-plan div { display: flex; flex-direction: column; }
.cp-rec-plan span { font-size: 11px; color: var(--muted); }
.cp-rec-plan b { font-size: 14px; }
.field .hint { font-weight: 400; font-size: 11px; min-height: 1em; }
.cp-check > span:first-child { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); padding-top: 22px; }
.cp-check input[type='checkbox'], .cp-warn input[type='checkbox'] { width: 18px; height: 18px; margin: 0; }
.cp-rec-result { font-size: 13px; min-height: 1.4em; }
.cp-warn { background: rgba(214, 140, 0, 0.12); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.cp-warn p { margin: 0 0 8px; }
.cp-warn label { display: flex; gap: 6px; align-items: center; color: var(--danger); font-weight: 600; }

@media (max-width: 1180px) {
  .cp-hero-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .cp-hero-main { grid-template-columns: 1fr; gap: 12px; }
  .cp-balance, .cp-bars, .cp-now { grid-column: 1; grid-row: auto; }
  .cp-round-big { font-size: 36px; }
  .cp-hero-grid { grid-template-columns: 1fr 1fr; }
  .cp-stat .val { font-size: 15px; white-space: normal; overflow-wrap: anywhere; }
  .cp-table-wrap { display: none; }
  .cp-cards { display: flex; }
  .cp-legend .btn { margin-left: auto; }
}
