:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #16181d;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --warn: #dc2626;
  --warn-soft: #fef2f2;
  --ok: #16a34a;
  --event: #2563eb;
  --todo: #9333ea;
  --sat: #2563eb;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #1a1d24;
    --text: #e8eaee;
    --muted: #9aa1ad;
    --line: #2a2f39;
    --accent: #818cf8;
    --accent-soft: #23264a;
    --warn: #f87171;
    --warn-soft: #3a1c1f;
    --ok: #4ade80;
    --event: #60a5fa;
    --todo: #c084fc;
    --sat: #60a5fa;
    --shadow: none;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  overscroll-behavior-y: contain;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

#app { max-width: 640px; margin: 0 auto; min-height: 100%; padding-bottom: calc(140px + var(--safe-b)); }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; background: var(--bg);
}
.top-title { font-size: 21px; font-weight: 700; letter-spacing: -.3px; }
.top-actions { display: flex; gap: 6px; }
.icon-btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 5px 12px; font-size: 13px;
}

/* 주간 스트립 */
.week { display: flex; align-items: center; gap: 2px; padding: 0 8px 8px; }
.week .nav { border: 0; background: none; color: var(--muted); font-size: 20px; padding: 4px 6px; }
.week-days { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.wd {
  border: 0; background: none; border-radius: 12px; padding: 6px 0 7px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.wd small { font-size: 11px; color: var(--muted); }
.wd b { font-size: 16px; font-weight: 600; }
.wd i { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.wd.has i { background: var(--muted); }
.wd.today b { color: var(--accent); }
.wd.sel { background: var(--accent); }
.wd.sel b, .wd.sel small { color: #fff; }
.wd.sel.has i { background: #fff; }
.wd.sun small { color: var(--warn); }
.wd.sel.sun small { color: #fff; }

.section { padding: 4px 16px 8px; }
.sec-h {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; color: var(--muted); font-weight: 600; margin: 10px 2px 6px;
}
.sec-h.warn { color: var(--warn); }
.sec-h button { border: 0; background: none; color: var(--accent); font-size: 13px; font-weight: 600; padding: 2px 4px; }
.list { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.list.warn { background: var(--warn-soft); }

.item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  border-bottom: 1px solid var(--line); position: relative;
}
.item:last-child { border-bottom: 0; }
.item .bar { position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; }
.item .bar { background: var(--c, var(--accent)); }
.chk-btn {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--muted); background: none; padding: 0;
  display: grid; place-items: center; color: #fff; font-size: 14px; line-height: 1;
}
.item.todo .chk-btn { border-radius: 7px; }
.item.done .chk-btn { background: var(--ok); border-color: var(--ok); }
.item .body { flex: 1; min-width: 0; }
.item .ttl { font-weight: 500; overflow-wrap: anywhere; }
.item.done .ttl { text-decoration: line-through; color: var(--muted); }
.item .meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 1px; }
.item .tm { flex: none; width: 48px; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--muted); text-align: right; line-height: 1.2; }
.item .tm b { display: block; color: var(--text); font-size: 14px; font-weight: 600; }
.item.past:not(.done) .tm b { color: var(--muted); }
.tag { color: var(--accent); }
.late { color: var(--warn); font-weight: 600; }
.star { color: #f59e0b; }

.now-line { display: flex; align-items: center; gap: 6px; padding: 0 12px; height: 18px; color: var(--warn); font-size: 11px; font-weight: 700; }
.now-line::after { content: ""; flex: 1; height: 2px; background: var(--warn); border-radius: 2px; }

.empty { text-align: center; color: var(--muted); padding: 28px 16px; font-size: 14px; }
.empty b { display: block; font-size: 28px; margin-bottom: 6px; }

/* 빠른 입력 */
.quick {
  position: fixed; left: 0; right: 0; bottom: calc(58px + var(--safe-b)); z-index: 10;
  max-width: 640px; margin: 0 auto; padding: 8px 12px; background: linear-gradient(to top, var(--bg) 70%, transparent);
}
#quickForm { display: flex; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 5px; box-shadow: var(--shadow); }
#quickInput { flex: 1; min-width: 0; border: 0; background: none; outline: none; padding: 8px 12px; font-size: 16px; }
.q-add, .q-more { flex: none; border: 0; border-radius: 50%; width: 40px; height: 40px; font-size: 22px; }
.q-add { background: var(--accent); color: #fff; }
.q-more { background: none; color: var(--muted); }
.preview {
  margin: 0 6px 6px; padding: 7px 12px; border-radius: 12px; background: var(--accent-soft);
  font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 10px;
}
.preview b { font-weight: 600; }

/* 하단 탭 */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b); max-width: 640px; margin: 0 auto;
}
.tabs button { border: 0; background: none; padding: 7px 0 8px; font-size: 11px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 1px; }
.tabs button span { font-size: 19px; filter: grayscale(1); opacity: .7; }
.tabs button.on { color: var(--accent); font-weight: 600; }
.tabs button.on span { filter: none; opacity: 1; }

/* 달력 */
.month-h { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 4px 16px 10px; }
.month-h b { font-size: 17px; min-width: 110px; text-align: center; }
.month-h button { border: 0; background: none; font-size: 22px; color: var(--muted); }
.mgrid { display: grid; grid-template-columns: repeat(7, 1fr); margin: 0 10px; background: var(--card); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.mgrid .dh { text-align: center; font-size: 11px; color: var(--muted); padding: 6px 0; border-bottom: 1px solid var(--line); }
.mgrid .dh:first-child { color: var(--warn); }
.mc { border: 0; background: none; min-height: 64px; padding: 4px 2px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; align-items: stretch; gap: 2px; text-align: left; overflow: hidden; }
.mc .n { font-size: 12px; text-align: center; font-weight: 500; }
.mc.other { opacity: .35; }
.mc.sun .n { color: var(--warn); }
.mc.today .n { background: var(--accent); color: #fff; border-radius: 999px; width: 22px; margin: 0 auto; }
.mc.sel { background: var(--accent-soft); }
.mc .lb { font-size: 10px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 3px; border-radius: 3px; }
.mc .lb { background: color-mix(in srgb, var(--c) 22%, transparent); border-left: 2px solid var(--c); }
.mc .lb.done { opacity: .45; text-decoration: line-through; }
.mc .more { font-size: 10px; color: var(--muted); text-align: center; }

/* 설정 */
.set-card { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); margin: 0 16px 14px; overflow: hidden; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row .l { flex: 1; }
.set-row .l small { display: block; color: var(--muted); font-size: 12px; }
.set-row select, .set-row .btn { flex: none; }
.set-row select { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 6px 8px; }
.help { padding: 12px 14px; font-size: 13px; color: var(--muted); }
.help code { background: var(--accent-soft); color: var(--text); padding: 1px 6px; border-radius: 6px; font-family: inherit; font-size: 13px; display: inline-block; margin: 2px 0; }
.status-ok { color: var(--ok); font-weight: 600; }
.status-bad { color: var(--warn); font-weight: 600; }

.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 14px; font-weight: 500; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: none; border-color: transparent; }
.btn.danger { color: var(--warn); }

/* 시트 */
.sheet-bg { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto;
  background: var(--card); border-radius: 20px 20px 0 0; padding: 8px 16px calc(16px + var(--safe-b));
  display: flex; flex-direction: column; gap: 10px; animation: up .18s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 2px auto 4px; }
.sheet label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); flex: 1; min-width: 0; }
.sheet input:not([type=checkbox]), .sheet select, .sheet textarea {
  border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 9px 10px; font-size: 15px; width: 100%; color: var(--text);
}
.sheet .f-title { font-size: 18px; font-weight: 600; border: 0 !important; background: none !important; padding: 6px 2px !important; }
.sheet label.chk { flex-direction: row; align-items: center; gap: 8px; font-size: 15px; color: var(--text); padding-top: 16px; }
.sheet label.chk input { width: 20px; height: 20px; }
.row2 { display: flex; gap: 8px; }
.row2 label:has(#fDate) { flex: 1.5; }
.seg { display: flex; background: var(--bg); border-radius: 10px; padding: 3px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 8px; padding: 7px; font-weight: 500; }
.seg button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.dows { display: flex; gap: 4px; }
.dows button { flex: 1; border: 1px solid var(--line); background: none; border-radius: 8px; padding: 6px 0; }
.dows button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.sheet-btns { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.grow { flex: 1; }

/* 알람 */
.alarm {
  position: fixed; inset: 0; z-index: 50; background: linear-gradient(160deg, #312e81, #7c3aed 60%, #db2777);
  color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { filter: brightness(1.15); } }
.alarm-time { font-size: 64px; font-weight: 200; font-variant-numeric: tabular-nums; }
.alarm-title { font-size: 26px; font-weight: 700; text-align: center; overflow-wrap: anywhere; }
.alarm-sub { opacity: .85; }
.alarm-unmute { border: 2px solid #fff; background: rgba(255,255,255,.15); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 16px; }
.alarm-snooze { display: flex; gap: 8px; margin-top: 24px; }
.alarm-snooze button { border: 1px solid rgba(255,255,255,.5); background: rgba(255,255,255,.12); color: #fff; border-radius: 999px; padding: 10px 16px; font-size: 15px; }
.alarm-main { display: flex; gap: 12px; margin-top: 8px; }
.alarm-main .btn { min-width: 120px; padding: 14px; font-size: 17px; border-radius: 999px; border: 0; }
.alarm-main .btn:not(.primary) { background: rgba(255,255,255,.2); color: #fff; }
.alarm-main .btn.primary { background: #fff; color: #4c1d95; font-weight: 700; }

/* 대기 모드 */
.night { position: fixed; inset: 0; z-index: 40; background: #000; color: #8b8fa8; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; user-select: none; }
.night-clock { font-size: 22vw; font-weight: 200; font-variant-numeric: tabular-nums; color: #c7cae0; line-height: 1; }
@media (min-width: 640px) { .night-clock { font-size: 140px; } }
.night-date { font-size: 18px; }
.night-next { font-size: 16px; color: #a5b4fc; margin-top: 18px; text-align: center; padding: 0 20px; }
.night-hint { position: absolute; bottom: 30px; font-size: 12px; text-align: center; opacity: .6; padding: 0 20px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(130px + var(--safe-b)); z-index: 60;
  background: #111827; color: #fff; border-radius: 12px; padding: 10px 14px; font-size: 14px;
  display: flex; gap: 14px; align-items: center; box-shadow: 0 6px 24px rgba(0,0,0,.25); max-width: calc(100% - 32px);
}
.toast button { border: 0; background: none; color: #a5b4fc; font-weight: 700; padding: 0; }

/* ===== v2: 토요일 파랑, 항목, 달력 보기, 다음날 준비 ===== */
.wd.sat small, .mc.sat .n, .mgrid .dh.sat, .wk-d.sat small, .ag-date.sat, .ymg i.sat { color: var(--sat); }
.mgrid .dh.sun, .wk-d.sun small, .ag-date.sun, .ymg i.sun { color: var(--warn); }
.wd.sel.sat small { color: #fff; }
.icon-btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.cat { display: inline-block; padding: 0 6px; border-radius: 6px; font-size: 11px; font-weight: 600; line-height: 18px;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.soft-warn { color: #d97706; }
.empty.small { padding: 14px; font-size: 13px; background: var(--card); border-radius: 14px; }
.hint { font-weight: 400; font-size: 12px; }

/* 시트: 항목 선택 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1.5px solid color-mix(in srgb, var(--c, var(--muted)) 55%, transparent); background: none; color: var(--c, var(--muted));
  border-radius: 999px; padding: 4px 10px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.chip.on { background: var(--c); border-color: var(--c); color: #fff; }
.chip.add { border-style: dashed; }

/* 달력 보기 전환 */
.cal-seg { display: flex; margin: 0 16px 8px; background: var(--card); border-radius: 12px; padding: 3px; box-shadow: var(--shadow); }
.cal-seg button { flex: 1; border: 0; background: none; border-radius: 9px; padding: 7px 0; font-weight: 600; color: var(--muted); }
.cal-seg button.on { background: var(--accent); color: #fff; }
.month-h b.sm { font-size: 14px; min-width: 0; }

/* 연간 */
.ygrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 12px; }
.ym { border: 0; background: var(--card); border-radius: 12px; padding: 8px 6px; box-shadow: var(--shadow); text-align: left; }
.ym > b { font-size: 13px; padding-left: 3px; }
.ym.cur > b { color: var(--accent); }
.ymg { display: grid; grid-template-columns: repeat(7, 1fr); margin-top: 4px; }
.ymg i { font-style: normal; font-size: 8.5px; text-align: center; line-height: 14px; border-radius: 3px; color: var(--text); }
.ymg i.yh { color: var(--muted); }
.ymg i.has { background: color-mix(in srgb, var(--c) 30%, transparent); font-weight: 700; }
.ymg i.today { background: var(--accent); color: #fff !important; }

/* 주간 */
.wk { margin: 0 8px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.wk-row { display: grid; grid-template-columns: 26px repeat(7, 1fr); }
.wk-head { border-bottom: 1px solid var(--line); }
.wk-d { border: 0; background: none; padding: 6px 0; display: flex; flex-direction: column; align-items: center; }
.wk-d small { font-size: 11px; color: var(--muted); }
.wk-d b { font-size: 15px; width: 26px; line-height: 26px; border-radius: 50%; text-align: center; }
.wk-d.today b { color: var(--accent); }
.wk-d.sel b { background: var(--accent); color: #fff; }
.wk-gut { font-size: 10px; color: var(--muted); text-align: center; }
.wk-all { border-bottom: 1px solid var(--line); padding: 3px 0; align-items: start; }
.wk-all > div { display: flex; flex-direction: column; gap: 2px; padding: 0 1px; min-width: 0; }
.wk-chip, .wk-ev { font-size: 10px; line-height: 1.25; border-radius: 4px; padding: 2px 3px; overflow: hidden; cursor: pointer;
  background: color-mix(in srgb, var(--c) 22%, var(--card)); border-left: 2px solid var(--c); word-break: break-all; }
.wk-chip { white-space: nowrap; text-overflow: ellipsis; }
.wk-body { max-height: calc(100vh - 330px); overflow-y: auto; position: relative; }
.wk-hr { border-top: 1px solid var(--line); box-sizing: border-box; font-size: 10px; line-height: 1; padding-top: 1px; }
.wk-col { position: relative; border-left: 1px solid var(--line);
  background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 44px); }
.wk-col.today { background-color: color-mix(in srgb, var(--accent) 5%, transparent); }
.wk-ev { position: absolute; box-sizing: border-box; border-right: 1px solid var(--card); }
.wk-ev b { display: block; font-weight: 700; }
.wk-ev small { display: block; opacity: .75; }
.wk-ev.done, .wk-chip.done { opacity: .45; text-decoration: line-through; }
.wk-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--warn); z-index: 2; }

/* 일정(목록) */
.ag-day { display: flex; gap: 10px; margin-bottom: 10px; }
.ag-date { flex: none; width: 40px; text-align: center; padding-top: 6px; display: flex; flex-direction: column; line-height: 1.15; }
.ag-date b { font-size: 20px; }
.ag-date small { font-size: 11px; color: inherit; opacity: .8; }
.ag-date.today b { color: var(--accent); }
.ag-day .list { flex: 1; min-width: 0; }
.more-btn { width: 100%; margin-top: 4px; }

/* 다음날 준비 */
.plan-banner { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; border: 0; border-radius: 14px; padding: 12px 14px;
  background: linear-gradient(135deg, #312e81, #6d28d9); color: #fff; box-shadow: var(--shadow); }
.plan-banner > span { font-size: 24px; }
.plan-banner div { flex: 1; display: flex; flex-direction: column; }
.plan-banner small { opacity: .8; }
.plan-banner em { font-style: normal; font-size: 22px; opacity: .8; }
.plan-hero { margin: 0 16px 6px; padding: 16px; border-radius: 16px; color: #fff; background: linear-gradient(135deg, #1e1b4b, #4c1d95 70%, #6d28d9);
  display: flex; flex-direction: column; gap: 2px; }
.plan-hero small { opacity: .75; }
.plan-hero b { font-size: 24px; }
.plan-hero span { opacity: .85; font-size: 13px; }
.pbtns { display: flex; gap: 4px; flex: none; }
.pbtns button { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 5px 8px; font-size: 12px; font-weight: 600; }
.pbtns button:first-child { background: var(--accent); border-color: var(--accent); color: #fff; }
.wake-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.wake-row > span { font-size: 22px; }
.wake-row input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 8px 10px; font-size: 18px; font-weight: 600; }
.plan-end { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; }
.btn.big { padding: 13px; font-size: 16px; border-radius: 12px; }
.alarm.plan { background: linear-gradient(160deg, #0f172a, #312e81 60%, #4c1d95); animation: none; }

/* 설정: 항목 */
.cat-row { gap: 8px; padding: 8px 10px 8px 14px; }
.cat-row input[type=color] { width: 30px; height: 30px; border: 0; padding: 0; background: none; border-radius: 8px; flex: none; }
.cat-row .btn { padding: 6px 8px; }
.inline-input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 8px 10px; color: var(--text); }
.inline-input.narrow { flex: none; width: 120px; }

/* ===== v3: 세부 할일 · 대기 · 주간 화면분할 · 루틴 ===== */
.muted { color: var(--muted); font-weight: 400; font-size: 11.5px; }
.muted code, .empty code { background: var(--accent-soft); color: var(--text); padding: 0 5px; border-radius: 5px; font-family: inherit; }
.subs { list-style: none; margin: 6px 0 0; padding: 0 0 0 2px; }
.subs .subs { margin-top: 2px; padding-left: 20px; border-left: 1.5px solid var(--line); margin-left: 9px; }
.subs li { margin: 1px 0; }
.sub-row { display: flex; align-items: flex-start; gap: 7px; padding: 2px 0; }
.sub-chk { flex: none; width: 19px; height: 19px; margin-top: 1px; border: 1.8px solid var(--muted); border-radius: 5px; background: none; padding: 0;
  color: #fff; font-size: 12px; line-height: 1; display: grid; place-items: center; }
.subs li.done > .sub-row .sub-chk { background: var(--ok); border-color: var(--ok); }
.sub-t { font-size: 14px; overflow-wrap: anywhere; }
.subs li.done > .sub-row .sub-t { color: var(--muted); text-decoration: line-through; }
.wait { color: #b45309; font-style: normal; font-weight: 600; font-size: 12px; }
@media (prefers-color-scheme: dark) { .wait { color: #fbbf24; } }
.prog { font-weight: 700; color: var(--accent); cursor: pointer; }
.prog.full { color: var(--ok); }
.hist { display: inline-flex; gap: 3px; vertical-align: middle; }
.hist i { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--muted); }
.hist i.done { background: var(--ok); border-color: var(--ok); }
.hist i.part { background: linear-gradient(90deg, var(--ok) 50%, transparent 50%); border-color: var(--ok); }
.hist i.none:not(.cur) { border-color: var(--warn); }
.hist i.cur { outline: 2px solid var(--accent-soft); }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; flex: none; }
.wait-row .btn.small { align-self: center; }
.wait-banner { width: 100%; text-align: left; border: 1px dashed #d97706; background: color-mix(in srgb, #f59e0b 10%, var(--card)); color: var(--text);
  border-radius: 12px; padding: 10px 12px; font-size: 13.5px; display: flex; gap: 4px; align-items: center; }
.wait-banner em { margin-left: auto; font-style: normal; color: var(--muted); }
.plan-banner.week, .plan-hero.week { background: linear-gradient(135deg, #0c4a6e, #1d4ed8 70%, #4f46e5); }
.sec-h.sat { color: var(--sat); }
.sec-h.sun { color: var(--warn); }
.sec-h button { font-size: 16px; line-height: 1; }

/* 주간 할일 화면분할 */
.sp-tools { display: flex; align-items: center; gap: 8px; padding: 0 12px 8px; }
.sp-prog { flex: 1; height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; }
.sp-prog i { display: block; height: 100%; background: var(--ok); border-radius: 8px; }
.sp-cnt { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.split { display: flex; flex-direction: column; margin: 0 8px; min-height: 320px; }
.pane { overflow-y: auto; overscroll-behavior: contain; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); }
.ptop { flex: 0 0 var(--top, 36%); }
.pbot { flex: 1 1 0; min-height: 0; background: none; box-shadow: none; border-radius: 0; }
.pbot .sp-sec { padding: 0 4px 4px; }
.pbot .sec-h { margin: 8px 4px 4px; }
.divider { flex: none; height: 20px; display: grid; place-items: center; cursor: row-resize; touch-action: none; }
.divider span { width: 44px; height: 5px; border-radius: 5px; background: var(--muted); opacity: .5; }
.sp-day { display: flex; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: flex-start; }
.sp-day:last-child { border-bottom: 0; }
.sp-day.today { background: var(--accent-soft); }
.sp-d { flex: none; width: 26px; text-align: center; line-height: 1.1; padding-top: 2px; }
.sp-d b { display: block; font-size: 15px; }
.sp-d small { font-size: 10.5px; }
.sp-d.sun { color: var(--warn); } .sp-d.sat { color: var(--sat); }
.sp-evs { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.sp-ev { font-size: 12px; padding: 2px 7px; border-radius: 6px; background: color-mix(in srgb, var(--c) 16%, transparent); border-left: 3px solid var(--c); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-ev.done { opacity: .45; text-decoration: line-through; }
.sp-ev b { font-variant-numeric: tabular-nums; }
.sp-none { color: var(--muted); font-size: 12px; padding: 2px 0; }
.glance .sp-day { cursor: pointer; }
@media (min-width: 900px) and (orientation: landscape) {
  #app:has(.split) { max-width: 1100px; }
  .split { flex-direction: row; }
  .ptop { flex: 0 0 var(--top, 40%); }
  .divider { width: 20px; height: auto; cursor: default; }
  .divider span { width: 5px; height: 44px; }
}

/* 붙여넣기 */
.paste-h { font-size: 17px; }
#pasteText { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 10px; padding: 10px; width: 100%; }
.paste-prev { max-height: 30vh; overflow-y: auto; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
.paste-prev b { margin-bottom: 4px; }
.pv-d { display: inline-block; min-width: 42px; color: var(--accent); font-weight: 700; }
#fSubs { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px !important; }

/* ===== v4: 범위(주/달/학기) · 편집 모드 · 리포트 ===== */
.cal-seg button { font-size: 13.5px; padding: 7px 0; }
.sp-tools .grow { flex: 1; }
.sp-tools.tools2 { justify-content: flex-start; flex-wrap: wrap; gap: 6px; }
.add-row { padding: 6px 10px; border-top: 1px solid var(--line); }
.list .add-row:first-child { border-top: 0; }
.inline-add { width: 100%; border: 0; background: none; outline: none; font-size: 15px; padding: 6px 2px; color: var(--text); }
.inline-add::placeholder, .sub-add::placeholder { color: var(--accent); opacity: .75; }
.sub-add { display: block; width: 100%; margin-top: 4px; border: 1px dashed var(--line); background: var(--bg); border-radius: 8px; padding: 6px 8px; font-size: 13.5px; color: var(--text); outline: none; }
.del-btn { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--warn-soft); color: var(--warn); font-size: 14px; font-weight: 700; align-self: center; }
.sub-del { flex: none; margin-left: auto; border: 0; background: none; color: var(--warn); font-size: 13px; padding: 0 4px; }
.item.editing { background: color-mix(in srgb, var(--accent) 4%, var(--card)); }
.mw-row { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 11px 12px; font-size: 13.5px; text-align: left; }
.mw-row:last-child { border-bottom: 0; }
.mw-row > span:first-child { flex: none; width: 128px; }
.mw-row.cur { background: var(--accent-soft); font-weight: 600; }
.sp-prog.ok i { background: var(--accent); }
.term-card { margin: 0 16px 8px; padding: 14px 16px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); display: flex; gap: 16px; align-items: center; }
.term-card > div:first-child { display: flex; flex-direction: column; flex: none; }
.term-card > div:first-child b { font-size: 26px; color: var(--accent); }
.term-card small { color: var(--muted); font-size: 12px; }
.term-bars { flex: 1; display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; font-size: 12px; color: var(--muted); }
.scope-links { display: flex; gap: 8px; }
.scope-links button { flex: 1; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 9px 10px; font-size: 13.5px; text-align: left; }
.scope-links b { color: var(--accent); }
.report-img { display: block; width: 100%; border-radius: 14px; box-shadow: var(--shadow); background: var(--card); min-height: 200px; }
.rep-btns { display: flex; gap: 8px; margin-top: 8px; }
.rep-btns .btn { flex: 1; }
.term-row { gap: 6px; flex-wrap: wrap; }
.term-row .inline-input { padding: 6px 8px; }
.term-row .inline-input[data-tf=name] { flex: 1 1 100%; }
.term-row .inline-input[type=date] { flex: 1; }

/* ===== v5: ⋯ 메뉴 · 글 리뷰 ===== */
.more-btn2 { flex: none; align-self: center; width: 30px; height: 34px; margin-right: -6px; border: 0; background: none; color: var(--muted); font-size: 20px; font-weight: 700; line-height: 1; border-radius: 8px; }
.more-btn2:active { background: var(--accent-soft); }
.item .tm { width: 42px; }
.menu { width: 100%; max-width: 640px; background: var(--card); border-radius: 20px 20px 0 0; padding: 10px 12px calc(12px + var(--safe-b)); display: flex; flex-direction: column; animation: up .16s ease-out; }
.menu-h { padding: 6px 10px 10px; font-weight: 700; color: var(--muted); font-size: 13.5px; border-bottom: 1px solid var(--line); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu button { border: 0; background: none; text-align: left; padding: 13px 10px; font-size: 16px; border-radius: 10px; }
.menu button:active { background: var(--accent-soft); }
.menu button.danger { color: var(--warn); }
.menu button.cancel { text-align: center; color: var(--muted); margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0; }
.narr { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px 6px; margin-bottom: 12px; }
.narr h4 { margin: 0 0 10px; font-size: 16px; }
.narr h4 small { font-weight: 400; color: var(--muted); font-size: 12px; }
.narr p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.6; }
.nl { display: block; margin-bottom: 1px; color: var(--accent); font-size: 12.5px; font-weight: 800; }
.prep-btns { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; }
.prep-btns .btn { text-align: left; white-space: normal; }

/* ===== v6: 이어지는 일정 막대 · 새 일정 표시 ===== */
.mgrid { display: block; }
.mhead { display: grid; grid-template-columns: repeat(7, 1fr); }
.mweek { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); }
.mweek:last-child { border-bottom: 0; }
.mweek .mc { border-bottom: 0; position: relative; padding-top: calc(21px + var(--lanes, 0) * 16px); min-height: calc(64px + var(--lanes, 0) * 8px); }
.mweek .mc .n { position: absolute; top: 3px; left: 0; right: 0; }
.mweek .mc.today .n { left: 50%; right: auto; transform: translateX(-50%); }
.span-bar { position: absolute; z-index: 2; font-size: 10px; line-height: 14px; padding: 0 5px; border-radius: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  background: color-mix(in srgb, var(--c) 30%, var(--card)); color: var(--text); font-weight: 600; cursor: pointer; border-left: 3px solid var(--c); box-sizing: border-box; display: flex; align-items: center; }
.span-bar.cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left-width: 0; }
.span-bar.cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.span-bar.done { opacity: .45; text-decoration: line-through; }
.wk-allin { grid-column: 2 / span 7; position: relative; }
.wk-allin .span-bar { font-size: 11px; }
.wk-allgrid { display: grid; grid-template-columns: repeat(7, 1fr); }
.wk-allgrid > div { display: flex; flex-direction: column; gap: 2px; padding: 0 1px; min-width: 0; }
.newb { display: inline-block; font-size: 9.5px; font-weight: 800; color: #fff; background: var(--accent); border-radius: 4px; padding: 0 4px; line-height: 15px; vertical-align: 1px; }
.sp-ev.is-new { font-weight: 700; }
.sp-ev.regular { opacity: .6; }

/* ===== v7: 접기 버튼 · 네모 체크 ===== */
.fold-btn { flex: none; width: 26px; height: 26px; margin-left: -6px; margin-right: -4px; border: 0; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 800; padding: 0; align-self: flex-start; margin-top: 0; line-height: 26px; }
.item:has(.fold-btn) { align-items: flex-start; }
.item:has(.fold-btn) .chk-btn, .item:has(.fold-btn) .more-btn2, .item:has(.fold-btn) .tm, .item:has(.fold-btn) .del-btn { align-self: flex-start; margin-top: 1px; }
.chk-btn.sq { border-radius: 7px; }

/* ===== v8: 세부 항목 편집 · 정렬 ===== */
.sub-t { cursor: text; flex: 1; min-width: 0; }
.sub-more { flex: none; margin-left: auto; border: 0; background: none; color: var(--muted); font-size: 16px; font-weight: 700; line-height: 1; padding: 0 6px; border-radius: 6px; height: 22px; }
.sub-more:active { background: var(--accent-soft); }
.sub-edit { flex: 1; min-width: 0; border: 1.5px solid var(--accent); background: var(--card); border-radius: 7px; padding: 3px 7px; font-size: 14px; color: var(--text); outline: none; }
.menu-sort { display: flex; align-items: center; gap: 6px; padding: 8px 10px; flex-wrap: wrap; }
.menu-sort span { font-size: 13px; color: var(--muted); margin-right: 4px; }
.menu .menu-sort button { flex: 1; text-align: center; padding: 8px 6px; font-size: 13.5px; border: 1px solid var(--line); border-radius: 9px; }
.menu .menu-sort button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.sort-row { display: flex; align-items: center; gap: 6px; padding: 0 16px 8px; font-size: 12.5px; color: var(--muted); }
.sort-row select { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 8px; padding: 4px 6px; font-size: 12.5px; }
.sort-row span + select { margin-right: 6px; }
