/* 코스픽 일정달력 v1.0.0 — 접두어 kspe- · 디자인 시스템: Ink #293237 / Navy #1B2440 / Teal #12A99B */
.kspe {
	--ink: #293237; --navy: #1B2440; --teal: #12A99B; --tl: #0E8478; --rec: #F2F5F6; --line: #D5DDE0; --mut: #5F6B73;
	--up: #DE2F26; --dn: #1A6CCC;
	font-family: 'IBM Plex Sans KR', 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
	color: var(--ink); font-size: 15px; line-height: 1.6; max-width: 1280px; margin: 0 auto; box-sizing: border-box;
}
.kspe *, .kspe *::before, .kspe *::after { box-sizing: border-box; margin: 0; }
.kspe .kspe-mono { font-family: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.kspe .kspe-up { color: var(--up); font-weight: 600; }
.kspe .kspe-dn { color: var(--dn); font-weight: 600; }
.kspe .kspe-muted { color: var(--mut); }
.kspe [hidden] { display: none !important; }

/* 테마 버튼 스타일 덮기 */
.kspe .kspe-app button {
	-webkit-appearance: none; appearance: none; font: inherit; color: inherit; background: transparent; border: 0; border-radius: 0;
	box-shadow: none; text-transform: none; letter-spacing: normal; line-height: 1.3; padding: 0; margin: 0; min-height: 0; width: auto; cursor: pointer; text-align: inherit;
}
.kspe .kspe-app button:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* 머리 */
.kspe .kspe-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 20px; }
.kspe .kspe-title { font-size: 32px; line-height: 40px; font-weight: 700; color: var(--ink); }
.kspe .kspe-lead { font-size: 15px; color: var(--mut); }
.kspe .kspe-app { display: flex; flex-direction: column; gap: 18px; }

/* 등급 색 */
.kspe .kspe-g-a { --gc: #0E8478; --gb: #E3F4F2; }
.kspe .kspe-g-b { --gc: #1B2440; --gb: #E6E9F0; }
.kspe .kspe-g-c { --gc: #5F6B73; --gb: #EEF1F2; }
.kspe .kspe-g-warn { --gc: #B42318; --gb: #FDECEA; }
.kspe .kspe-g-ref { --gc: #8A5A00; --gb: #FFF4DB; }
.kspe .kspe-g-na { --gc: #5F6B73; --gb: #F2F5F6; }
.kspe .kspe-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 22px; padding: 0 7px; border-radius: 4px; background: var(--gb); color: var(--gc); font-size: 12px; font-weight: 700; white-space: nowrap; }

/* 성적표 */
.kspe .kspe-perf { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.kspe .kspe-perf-head { flex: 0 0 132px; padding: 12px 14px; background: var(--navy); color: #fff; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.kspe .kspe-perf-head b { font-size: 13px; }
.kspe .kspe-perf-head span { font-size: 11px; color: #C9D1E3; }
.kspe .kspe-perf-cells { display: flex; flex: 1 1 auto; min-width: 0; }
.kspe .kspe-perf-cell { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-left: 1px solid var(--line); }
.kspe .kspe-perf-name { font-size: 12px; color: var(--mut); }
.kspe .kspe-perf-ret { font-size: 17px; }
.kspe .kspe-perf-sub { font-size: 11px; color: var(--mut); }
.kspe .kspe-perf-sub b { color: var(--ink); font-weight: 500; }

/* 필터 */
.kspe .kspe-filters { display: flex; gap: 12px; align-items: center; }
.kspe .kspe-chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1 1 auto; min-width: 0; }
.kspe .kspe-app .kspe-chip { height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 13px; white-space: nowrap; }
.kspe .kspe-app .kspe-chip.is-on { background: var(--navy); border-color: var(--navy); color: #fff; }
.kspe .kspe-ab { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--mut); white-space: nowrap; cursor: pointer; }
.kspe .kspe-ab input { width: 16px; height: 16px; margin: 0; accent-color: var(--navy); }

/* 본문 2단 (PC) */
.kspe .kspe-body { display: flex; gap: 28px; align-items: flex-start; }
.kspe .kspe-cal { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.kspe .kspe-side { flex: 0 0 380px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; padding-right: 2px; }

.kspe .kspe-mhead { display: flex; align-items: center; gap: 6px; }
.kspe .kspe-mhead > b { font-size: 20px; font-weight: 700; min-width: 84px; text-align: center; }
.kspe .kspe-app .kspe-nav { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 18px; text-align: center; }
.kspe .kspe-app .kspe-todaybtn { margin-left: auto; height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 13px; }

/* 달력 칸 */
.kspe .kspe-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.kspe .kspe-wd { padding: 8px; font-size: 12px; font-weight: 600; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.kspe .kspe-wd.is-sun { color: var(--up); }
.kspe .kspe-wd.is-sat { color: var(--dn); }
.kspe .kspe-app .kspe-cell { position: relative; min-height: 118px; padding: 6px; background: #fff; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; align-items: stretch; gap: 3px; overflow: hidden; }
.kspe .kspe-app .kspe-cell:hover { background: #FAFBFC; }
.kspe .kspe-app .kspe-cell.is-out { background: #FAFBFB; }
.kspe .kspe-app .kspe-cell.is-out .kspe-num { color: #B8C1C6; }
.kspe .kspe-app .kspe-cell.is-today { box-shadow: inset 0 0 0 2px var(--teal); }
.kspe .kspe-app .kspe-cell.is-sel { box-shadow: inset 0 0 0 2px var(--navy); background: #F4F6FA; }
.kspe .kspe-num { font-family: 'IBM Plex Mono', monospace; font-size: 12px; font-weight: 500; }
.kspe .kspe-num.is-red, .kspe b.is-red { color: var(--up); }
.kspe .kspe-num.is-blue, .kspe b.is-blue { color: var(--dn); }
.kspe .kspe-evs { display: flex; flex-direction: column; gap: 3px; }
.kspe .kspe-ev { display: flex; gap: 5px; align-items: center; padding: 3px 5px; border-radius: 4px; background: var(--gb); color: var(--gc); font-size: 11px; font-weight: 600; line-height: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kspe .kspe-ev b { font-size: 10px; flex-shrink: 0; }
.kspe .kspe-ev.is-tent { background: transparent; box-shadow: inset 0 0 0 1px var(--gc); }
.kspe .kspe-exitbar { display: block; margin-top: auto; height: 4px; border-radius: 2px; background: var(--teal); }
.kspe .kspe-exittxt { font-size: 10px; line-height: 12px; color: var(--tl); }
.kspe .kspe-dots, .kspe .kspe-mlab { display: none; }
.kspe .kspe-dot { display: inline-block; width: 6px; height: 6px; border-radius: 3px; background: var(--gc); }

.kspe .kspe-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 12px; color: var(--mut); align-items: center; }
.kspe .kspe-legend span { display: inline-flex; gap: 6px; align-items: center; }
.kspe .kspe-legend-bar { display: inline-block; width: 18px; height: 4px; border-radius: 2px; background: var(--teal); }

/* 오른쪽 · 카드 */
.kspe .kspe-side-head { display: flex; align-items: baseline; gap: 10px; border-bottom: 1px solid var(--ink); padding-bottom: 10px; }
.kspe .kspe-side-head h2, .kspe .kspe-agenda h2 { font-size: 22px; line-height: 30px; font-weight: 700; color: var(--ink); }
.kspe .kspe-side-head span { font-size: 13px; color: var(--mut); }
.kspe .kspe-sub { font-size: 13px; font-weight: 600; color: var(--mut); margin-top: 6px; }
.kspe .kspe-empty { font-size: 14px; color: var(--mut); padding: 8px 0; }
.kspe .kspe-exitnote { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border: 1px dashed var(--teal); border-radius: 6px; font-size: 13px; }
.kspe .kspe-exitnote b { color: var(--tl); }
.kspe .kspe-exitnote span:nth-child(2) { flex: 1 1 auto; }
.kspe .kspe-exitnote .kspe-mono { font-size: 12px; color: var(--mut); }

.kspe .kspe-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.kspe .kspe-card.is-past { opacity: .6; }
.kspe .kspe-card-top { display: flex; gap: 8px; align-items: center; }
.kspe .kspe-cat { font-size: 12px; color: var(--mut); }
.kspe .kspe-tent { font-size: 11px; padding: 1px 6px; border: 1px dashed var(--mut); border-radius: 4px; color: var(--mut); }
.kspe .kspe-dday { margin-left: auto; font-size: 18px; font-weight: 600; color: var(--navy); }
.kspe .kspe-card-title { font-size: 16px; line-height: 22px; font-weight: 700; color: var(--ink); }
.kspe .kspe-stat { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--mut); }
.kspe .kspe-stat b { color: var(--ink); font-weight: 500; }
.kspe .kspe-plan { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; font-size: 12px; }
.kspe .kspe-plan > div { flex: 1 1 0; padding: 7px 10px; display: flex; flex-direction: column; }
.kspe .kspe-plan > div:first-child { background: var(--rec); }
.kspe .kspe-plan span { color: var(--mut); }
.kspe .kspe-plan b { font-weight: 600; }
.kspe .kspe-plan .kspe-plan-exit { background: var(--gb); }
.kspe .kspe-plan .kspe-plan-exit span, .kspe .kspe-plan .kspe-plan-exit b { color: var(--gc); }
.kspe .kspe-state { font-size: 12px; font-weight: 600; }
.kspe .kspe-state.is-now { color: var(--tl); }
.kspe .kspe-state.is-past { color: var(--mut); }
.kspe .kspe-nobuy { padding: 9px 12px; border-radius: 6px; background: var(--gb); color: var(--gc); font-size: 12px; font-weight: 600; }
.kspe .kspe-stocks { display: flex; gap: 6px; flex-wrap: wrap; }
.kspe .kspe-stock { padding: 3px 9px; border-radius: 12px; background: var(--rec); font-size: 12px; }
.kspe .kspe-note { font-size: 12px; color: var(--mut); line-height: 1.5; }
.kspe .kspe-desc { border-top: 1px solid var(--line); padding-top: 8px; }
.kspe .kspe-desc summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--tl); list-style: none; min-height: 28px; display: flex; align-items: center; gap: 6px; }
.kspe .kspe-desc summary::-webkit-details-marker { display: none; }
.kspe .kspe-desc summary::after { content: '⌄'; font-size: 13px; }
.kspe .kspe-desc[open] summary::after { content: '⌃'; }
.kspe .kspe-desc p { font-size: 13.5px; line-height: 1.7; color: var(--ink); margin-top: 6px; word-break: keep-all; }

.kspe .kspe-agenda { display: none; }
.kspe .kspe-next { display: flex; flex-direction: column; gap: 12px; }
.kspe .kspe-week { display: none; }
.kspe .kspe-fallback { padding-left: 20px; font-size: 14px; }
.kspe .kspe-foot { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; line-height: 18px; color: var(--mut); }

/* ── 모바일·태블릿: 위아래 나열 + 점 달력 ── */
@media (max-width: 1023px) {
	.kspe .kspe-title { font-size: 24px; line-height: 32px; }
	.kspe .kspe-lead { font-size: 13px; }
	.kspe .kspe-body { flex-direction: column; gap: 16px; }
	.kspe .kspe-side { position: static; flex: none; width: 100%; max-height: none; overflow: visible; scroll-margin-top: 150px; }
	.kspe .kspe-perf { order: 5; border: 0; border-radius: 0; flex-direction: column; gap: 8px; overflow: visible; }
	.kspe .kspe-perf-head { flex: none; background: none; color: var(--ink); padding: 0; flex-direction: row; gap: 8px; align-items: baseline; }
	.kspe .kspe-perf-head span { color: var(--mut); }
	.kspe .kspe-perf-cells { overflow-x: auto; gap: 8px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
	.kspe .kspe-perf-cell { flex: 0 0 136px; border: 1px solid var(--line); border-radius: 8px; scroll-snap-align: start; }
	.kspe .kspe-filters { flex-direction: column; align-items: stretch; gap: 8px; }
	.kspe .kspe-chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
	.kspe .kspe-ab { align-self: flex-end; }
	.kspe .kspe-mhead { justify-content: center; }
	.kspe .kspe-app .kspe-todaybtn { margin-left: 8px; }
	.kspe .kspe-grid { border: 0; }
	.kspe .kspe-wd { border: 0; text-align: center; padding: 4px 0; font-size: 11px; }
	.kspe .kspe-app .kspe-cell { min-height: 60px; border: 0; padding: 4px 0 6px; align-items: center; gap: 2px; background: #fff; }
	.kspe .kspe-app .kspe-cell.is-out { background: #fff; }
	.kspe .kspe-app .kspe-cell.is-today, .kspe .kspe-app .kspe-cell.is-sel { box-shadow: none; background: #fff; }
	.kspe .kspe-num { width: 30px; height: 30px; border-radius: 15px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
	.kspe .kspe-app .kspe-cell.is-today .kspe-num { box-shadow: inset 0 0 0 1.5px var(--teal); }
	.kspe .kspe-app .kspe-cell.is-sel .kspe-num { background: var(--navy); color: #fff; font-weight: 600; }
	.kspe .kspe-evs, .kspe .kspe-exittxt { display: none; }
	.kspe .kspe-dots { display: flex; gap: 3px; height: 6px; }
	.kspe .kspe-mlab { display: block; max-width: 100%; font-size: 9px; line-height: 11px; font-weight: 600; color: var(--gc); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
	.kspe .kspe-exitbar { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; height: 3px; border-radius: 0; }
	.kspe .kspe-legend { gap: 6px 12px; font-size: 11px; }
	.kspe .kspe-next { display: none; }
	.kspe .kspe-agenda { display: flex; flex-direction: column; gap: 16px; order: 4; }
	.kspe .kspe-ag-row { display: flex; gap: 12px; }
	.kspe .kspe-ag-date { flex: 0 0 40px; display: flex; flex-direction: column; align-items: center; padding-top: 4px; font-size: 11px; color: var(--mut); }
	.kspe .kspe-ag-date b { font-size: 20px; color: var(--ink); }
	.kspe .kspe-ag-cards { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
	.kspe .kspe-body { order: 3; }
	.kspe .kspe-filters { order: 2; }
	.kspe .kspe-card { padding: 14px; }
	.kspe .kspe-dday { font-size: 15px; }
	.kspe .kspe-plan > div { padding: 6px 8px; }
	.kspe .kspe-plan b { white-space: nowrap; font-size: 11.5px; }

	/* 스크롤하면 주간 줄 고정 */
	.kspe .kspe-week { display: block; position: fixed; left: 0; right: 0; top: 0; z-index: 60; background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 2px 8px rgba(27, 36, 64, .08); transform: translateY(-110%); transition: transform .18s ease; }
	body.admin-bar .kspe .kspe-week { top: 46px; }
	.kspe.kspe-show-week .kspe-week { transform: none; }
	.kspe .kspe-week-in { max-width: 520px; margin: 0 auto; padding: 8px 12px 10px; }
	.kspe .kspe-wk-head { display: flex; align-items: center; gap: 8px; }
	.kspe .kspe-wk-head b { font-size: 15px; }
	.kspe .kspe-app .kspe-wk-open { margin-left: auto; height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 17px; font-size: 12px; }
	.kspe .kspe-wk-days { display: flex; }
	.kspe .kspe-app .kspe-wk-day { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; min-height: 44px; }
	.kspe .kspe-wk-day > span:first-child { font-size: 11px; color: var(--mut); }
	.kspe .kspe-wk-day b { width: 30px; height: 30px; border-radius: 15px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 500; }
	.kspe .kspe-app .kspe-wk-day.is-sel b { background: var(--navy); color: #fff; }
	.kspe .kspe-wk-exit { display: flex; gap: 8px; align-items: center; font-size: 12px; margin-top: 4px; }
	.kspe .kspe-wk-exit b { padding: 3px 8px; border: 1px dashed var(--teal); border-radius: 4px; color: var(--tl); }
	.kspe .kspe-wk-exit span { color: var(--mut); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
}
@media (max-width: 1023px) and (min-width: 600px) {
	.kspe .kspe-app .kspe-cell { min-height: 72px; }
}
