/* ============ 디자인 토큰 (깔끔한 핀테크 앱 느낌) ============ */
:root {
  --blue: #3182f6;
  --blue-strong: #1b64da;
  --blue-50: #e8f3ff;
  --blue-100: #c9e2ff;
  --blue-200: #90c2ff;
  --blue-300: #64a8ff;

  --grey-50: #f9fafb;
  --grey-100: #f2f4f6;
  --grey-200: #e5e8eb;
  --grey-300: #d1d6db;
  --grey-400: #b0b8c1;
  --grey-500: #8b95a1;
  --grey-600: #6b7684;
  --grey-700: #4e5968;
  --grey-800: #333d4b;
  --grey-900: #191f28;

  --red: #f04452;
  --green: #03b26c;
  --yellow-50: #fff9e7;

  --radius: 16px;
  --radius-lg: 24px;
  --shadow: 0 2px 8px rgba(0, 27, 55, 0.05);
  --sidebar-w: 232px;

  --font: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--grey-900);
  background: var(--grey-100);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }

.app { display: flex; height: 100vh; overflow: hidden; }

/* ============ 사이드바 ============ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--grey-200);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  gap: 18px;
}

.brand { display: flex; padding: 4px 10px; user-select: none; }
.brand-logo {
  width: 28px; height: 28px; border-radius: 9px;
  background: var(--blue); color: #fff;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 800;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 15px; font-weight: 600;
  color: var(--grey-700);
  text-align: left;
  transition: background .15s, transform .1s;
}
.nav-item:hover { background: var(--grey-100); }
.nav-item:active { transform: scale(0.98); }
.nav-item.active { background: var(--blue-50); color: var(--blue); }
.nav-ico { width: 20px; text-align: center; font-size: 16px; }
.nav-new { color: var(--blue); }

.side-section { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1; }
.side-search {
  margin: 0 4px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 0;
  background: var(--grey-100);
  font-size: 14px;
  outline: none;
}
.side-search:focus { box-shadow: 0 0 0 2px var(--blue-100); }

.note-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.note-list li { position: relative; }
.note-list .nl-empty { padding: 4px 12px 6px; font-size: 13px; color: var(--grey-400); }
/* 노트 한 줄: 제목만, 위아래 여백 같게 */
.note-list li a {
  display: flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 12px;
  border-radius: 10px;
  transition: background .15s;
}
/* 마우스를 올린 그 노트만 (폴더 li도 함께 hover 상태가 되므로 '바로 아래' 요소로 한정) */
.nl-note:hover > a, .nl-note > a.active { background: var(--grey-100); }
.nl-title {
  flex: 1; min-width: 0;
  font-size: 14px; font-weight: 600; line-height: 20px; color: var(--grey-800);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nl-title.empty { color: var(--grey-400); }
/* 타이머가 돌고 있는 노트 표시 (작은 점) */
.nl-live { flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--red); animation: blink 1.2s infinite; }
.nl-live.paused { background: var(--grey-400); animation: none; }
@keyframes blink { 50% { opacity: .2; } }
/* 마우스를 올리면 오른쪽에 버튼 (제목 끝을 덮음) */
.nl-actions {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  display: flex; gap: 2px; padding-left: 8px;
  background: var(--grey-100); border-radius: 0 10px 10px 0;
  opacity: 0; pointer-events: none; transition: opacity .1s;
}
.nl-note:hover > .nl-actions, .fd-row:hover > .nl-actions, .nl-actions:focus-within { opacity: 1; pointer-events: auto; }
.nl-btn {
  width: 26px; height: 26px; border-radius: 6px;
  display: grid; place-items: center;
  font-size: 12px; color: var(--grey-500);
  transition: background .1s, color .1s;
}
.nl-btn:hover { background: var(--grey-200); color: var(--grey-800); }
.nl-del:hover { background: #fdeced; color: var(--red); }

/* 검색창 + 폴더 추가 */
.side-tools { display: flex; gap: 6px; margin: 0 4px; }
.side-tools .side-search { flex: 1; min-width: 0; margin: 0; }
.side-add-folder {
  flex-shrink: 0; padding: 0 10px; border-radius: 10px;
  font-size: 13px; font-weight: 600; color: var(--grey-600);
  background: var(--grey-100); transition: background .12s, color .12s;
}
.side-add-folder:hover { background: var(--grey-200); color: var(--grey-900); }

/* 폴더 */
.fd-row {
  position: relative;
  display: flex; align-items: center; gap: 4px;
  height: 36px; padding: 0 12px 0 4px;
  border-radius: 10px;
  transition: background .12s, box-shadow .12s;
}
.fd-row:hover { background: var(--grey-100); }
.fd-toggle {
  width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 11px; color: var(--grey-500);
  transition: transform .15s;
}
.fd.open > .fd-row .fd-toggle { transform: rotate(90deg); }
.fd-name {
  flex: 1; min-width: 0;
  font-size: 14px; font-weight: 700; color: var(--grey-800);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: default;
}
.fd-count { font-size: 12px; color: var(--grey-400); font-variant-numeric: tabular-nums; }
.fd-input {
  flex: 1; min-width: 0; height: 28px; padding: 0 8px;
  border: 1px solid var(--blue); border-radius: 8px; outline: none;
  box-shadow: 0 0 0 3px var(--blue-50);
  font-size: 14px; font-weight: 600;
}
.fd-notes { list-style: none; margin: 0; padding: 0 0 0 16px; }
.fd-notes .nl-empty { padding: 4px 12px 8px; }

/* 노트 끌어서 옮기기 */
.nl-note > a { -webkit-user-drag: none; }
body.note-dragging, body.note-dragging * { cursor: grabbing !important; user-select: none; }
.drag-ghost {
  position: fixed; left: 0; top: 0; z-index: 300;
  max-width: 220px; padding: 7px 12px;
  border-radius: 10px; background: #fff;
  box-shadow: 0 8px 24px rgba(0, 27, 55, 0.18);
  font-size: 14px; font-weight: 600; color: var(--grey-800);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
.fd.drop-on > .fd-row { background: var(--blue-50); box-shadow: inset 0 0 0 2px var(--blue-200); }
.note-list.drop-root { box-shadow: inset 0 0 0 2px var(--grey-200); border-radius: 10px; }
@media (hover: none) { .nl-actions { opacity: 1; pointer-events: auto; } }

/* 사이드바 너비 조절 손잡이 */
.sidebar { position: relative; }
.sidebar-resizer {
  position: absolute; top: 0; right: -4px; bottom: 0;
  width: 8px; cursor: col-resize; z-index: 5;
}
.sidebar-resizer::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px;
  background: transparent; transition: background .15s;
}
.sidebar-resizer:hover::after, body.resizing .sidebar-resizer::after { background: var(--blue-200); }
body.resizing { cursor: col-resize; user-select: none; }


/* ============ 메인 ============ */
.main { flex: 1; overflow-y: auto; min-width: 0; }
.main.white { background: #fff; }

.page { max-width: 960px; margin: 0 auto; padding: 40px 32px 80px; }
.page-title { font-size: 26px; font-weight: 700; margin: 0 0 6px; }

.card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 48px; padding: 0 20px;
  border-radius: 14px;
  font-size: 16px; font-weight: 600;
  transition: background .15s, transform .1s, opacity .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-strong); }
.btn-secondary { background: var(--blue-50); color: var(--blue); }
.btn-secondary:hover { background: var(--blue-100); }
.btn-grey { background: var(--grey-100); color: var(--grey-700); }
.btn-grey:hover { background: var(--grey-200); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }

.icon-btn {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  color: var(--grey-500); font-size: 16px;
}
.icon-btn:hover { background: var(--grey-100); color: var(--grey-800); }

.input {
  height: 48px; padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--grey-200);
  background: #fff;
  font-size: 15px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-50); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #d93a47; }

/* 확인창 */
.dialog-back {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: 16px;
  background: rgba(0, 12, 30, 0.32);
  opacity: 0; transition: opacity .15s;
}
.dialog-back.show { opacity: 1; }
.dialog {
  width: 100%; max-width: 340px;
  background: #fff;
  border-radius: 22px;
  padding: 26px 22px 20px;
  box-shadow: 0 16px 48px rgba(0, 27, 55, 0.18);
  transform: scale(.96); transition: transform .15s;
}
.dialog-back.show .dialog { transform: scale(1); }
.dialog h3 { margin: 0; font-size: 19px; font-weight: 700; }
.dialog p { margin: 8px 0 0; font-size: 15px; line-height: 1.55; color: var(--grey-600); word-break: keep-all; }
.dialog-btns { display: flex; gap: 8px; margin-top: 22px; }
.dialog-btns .btn { flex: 1; height: 50px; outline: none; }
.dialog-btns .btn:focus-visible { box-shadow: 0 0 0 3px var(--blue-100); }

/* 토스트 */
#toast {
  position: fixed; left: 50%; bottom: 32px;
  transform: translate(-50%, 20px);
  background: rgba(25, 31, 40, 0.92); color: #fff;
  padding: 14px 22px; border-radius: 14px;
  font-size: 15px; font-weight: 500;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 100;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ 노트 에디터 ============ */
/* 노트 영역: 화면(사이드바 제외) 너비의 75%, 왼쪽에서 10% 띄운 곳에서 시작 */
.note-page { width: 75%; min-width: min(100%, 640px); margin: 0 0 0 10%; padding: 48px 0 80px; }
/* 제목과 본문 사이 흐린 구분선 */
.note-rule { border: 0; border-top: 1px solid var(--grey-200); margin: 0 0 28px; }
/* 접힌 타이머 높이만큼만 자리 차지 → 펼쳐도 노트가 밀려 내려가지 않음 */
.note-top { position: relative; height: 40px; margin-bottom: 20px; }

/* 노트 타이머 블록 (접기/펼치기, 노트 위에 떠 있음) */
.tblock {
  position: absolute; top: 0; right: 0; z-index: 20;
  width: 220px;
  border-radius: 16px;
  background: var(--grey-50);
  box-shadow: inset 0 0 0 1px var(--grey-200);
  overflow: hidden;
}
.tblock:not(.collapsed) { background: #fff; box-shadow: 0 8px 28px rgba(0, 27, 55, 0.12), inset 0 0 0 1px var(--grey-200); }
.tb-head {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px 14px;
  font-size: 14px; font-weight: 700; color: var(--grey-800);
}
.tb-head:hover { background: var(--grey-100); }
.tb-mini { margin-left: auto; font-size: 13px; color: var(--blue); font-variant-numeric: tabular-nums; }
.tb-caret { color: var(--grey-400); font-size: 12px; transition: transform .15s; }
.tblock:not(.collapsed) .tb-mini { display: none; }
.tblock:not(.collapsed) .tb-caret { margin-left: auto; }
.tblock.collapsed .tb-caret { transform: rotate(-90deg); }
.tblock.collapsed .tb-body { display: none; }
.tblock.collapsed { width: auto; min-width: 140px; }

.tb-body { padding: 4px 14px 14px; }
.tb-time {
  font-size: 34px; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
  margin-bottom: 10px;
  transition: color .2s;
}
.tb-time.paused { color: var(--grey-400); }
.tb-btns { display: flex; gap: 6px; }
.tb-btns .btn { flex: 1; }
.tb-other { font-size: 13px; font-weight: 600; color: var(--blue); }
.tb-goal { display: flex; align-items: center; gap: 4px; margin-top: 12px; font-size: 13px; color: var(--grey-500); }
.tb-goal b { color: var(--grey-800); }
.tb-goal .goal-btn { margin-left: 2px; }

.note-title {
  width: 100%;
  border: 0; outline: none; resize: none; overflow: hidden;
  font-size: 36px; font-weight: 700; line-height: 1.3;
  padding: 0; margin: 0 0 16px;
  background: transparent;
}
.note-title::placeholder { color: var(--grey-300); }

/* 자유 배치 캔버스: 노트 칸 안 어디든 블록을 놓을 수 있음 */
.canvas {
  position: relative;
  min-height: 60vh;
  border-radius: 12px;
}
/* 빈 노트일 때만 보이는 첫 블록 버튼 */
.canvas-add {
  position: absolute; top: 0; left: 0;
  height: 36px; padding: 0 14px;
  border-radius: 10px;
  font-size: 15px; font-weight: 600; color: var(--grey-500);
  transition: background .12s, color .12s;
}
.canvas-add:hover { background: var(--grey-100); color: var(--grey-800); }

/* 블록 밑 + 버튼: 블록에 마우스를 올리거나 쓰는 중일 때만 */
.blk-plus {
  position: absolute; left: 50%; top: calc(100% - 11px); z-index: 3;
  width: 22px; height: 22px; margin-left: -11px;
  border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 1px var(--grey-200), 0 2px 6px rgba(0, 27, 55, 0.08);
  display: grid; place-items: center;
  font-size: 16px; line-height: 1; color: var(--grey-500);
  opacity: 0; pointer-events: none; transition: opacity .1s, color .1s, box-shadow .1s;
}
.block:hover .blk-plus, .block:focus-within .blk-plus { opacity: 1; pointer-events: auto; }
.blk-plus:hover { color: var(--blue); box-shadow: 0 0 0 1px var(--blue-200), 0 2px 6px rgba(0, 27, 55, 0.12); }
.block.moving .blk-plus { opacity: 0; }

.block {
  position: absolute;
  min-width: 120px; /* 너비를 정하지 않은 블록은 글 길이만큼 (최소 이만큼) */
  padding: 2px 6px 2px 22px; /* 왼쪽은 ⋮⋮ 손잡이 자리 */
  border-radius: 10px;
  cursor: default;
  transition: box-shadow .12s;
}
.block:hover { box-shadow: inset 0 0 0 1px var(--grey-200); }
.block:focus-within { box-shadow: inset 0 0 0 1px var(--blue-200); z-index: 2; }
.block.moving { z-index: 10; box-shadow: 0 10px 30px rgba(0, 27, 55, 0.14), inset 0 0 0 1px var(--blue-200); background: #fff; }

.blk-drag {
  position: absolute; left: 1px; top: 6px;
  width: 20px; height: 22px; border-radius: 6px;
  display: grid; place-items: center;
  color: var(--grey-400); font-size: 12px; letter-spacing: -2px;
  cursor: grab; touch-action: none;
  opacity: 0; transition: opacity .1s;
}
.blk-drag:hover { background: var(--grey-100); color: var(--grey-700); }
.blk-resize {
  position: absolute; top: 0; right: -3px; bottom: 0; width: 7px;
  cursor: ew-resize; touch-action: none;
}
.blk-resize::after {
  content: ''; position: absolute; top: 25%; bottom: 25%; left: 2px; width: 3px;
  border-radius: 2px; background: var(--grey-300);
  opacity: 0; transition: opacity .1s;
}
.block:hover .blk-drag, .block:focus-within .blk-drag, .block:hover .blk-resize::after { opacity: 1; }
body.block-dragging, body.block-dragging * { cursor: grabbing !important; user-select: none; }
body.block-resizing, body.block-resizing * { cursor: ew-resize !important; user-select: none; }

.block-body { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.block-content {
  flex: 1; min-width: 0;
  outline: none;
  padding: 4px 2px;
  font-size: 16px; line-height: 1.7;
  cursor: text;
  /* 블록 너비 안에서만 줄바꿈, 한글 단어는 중간에서 안 끊기게 */
  white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere;
}
.block-content:empty::before {
  content: attr(data-placeholder);
  color: var(--grey-300);
  pointer-events: none;
}

.block-h1 .block-content { font-size: 28px; font-weight: 700; line-height: 1.4; }
.block-h2 .block-content { font-size: 22px; font-weight: 700; line-height: 1.4; }
.block-h3 .block-content { font-size: 18px; font-weight: 700; line-height: 1.5; }
.block-h1 .blk-drag { top: 11px; }
.block-h2 .blk-drag { top: 8px; }

.marker {
  flex-shrink: 0;
  padding-top: 4px;
  font-size: 20px; line-height: 1.36;
  color: var(--grey-800);
  user-select: none;
}

.todo-check {
  flex-shrink: 0;
  width: 20px; height: 20px; margin-top: 7px;
  border-radius: 6px;
  border: 2px solid var(--grey-300);
  display: grid; place-items: center;
  color: #fff; font-size: 13px; font-weight: 800;
  transition: background .15s, border-color .15s;
}
.todo-check:hover { border-color: var(--blue-300); }
.block-todo.checked .todo-check { background: var(--blue); border-color: var(--blue); }
.block-todo.checked .block-content { color: var(--grey-400); text-decoration: line-through; }

.block-quote .block-body { border-left: 3px solid var(--grey-800); padding-left: 14px; }

.block-callout .block-body { background: var(--blue-50); border-radius: 14px; padding: 12px 16px; }
.block-callout .callout-ico { padding-top: 4px; font-size: 18px; line-height: 1.6; user-select: none; }
.block-callout .callout-label { display: block; font-size: 12px; font-weight: 700; color: var(--blue); margin-bottom: 2px; user-select: none; }
.block-callout .callout-wrap { flex: 1; min-width: 0; padding-top: 4px; }
.block-callout .block-content { font-weight: 500; padding: 0 2px; }
.block-callout .blk-drag, .block-code .blk-drag { top: 14px; }

.block-code .block-body { background: var(--grey-100); border-radius: 12px; padding: 14px 16px; }
.block-code .block-content {
  font-family: 'SFMono-Regular', Consolas, 'D2Coding', monospace;
  font-size: 14px; line-height: 1.6; padding: 0;
  word-break: normal; overflow-wrap: anywhere; tab-size: 2;
}

.block-divider .block-body { padding: 12px 0; outline: none; border-radius: 6px; cursor: default; }
.block-divider .block-body:focus { background: var(--blue-50); }
.block-divider hr { flex: 1; border: 0; border-top: 1px solid var(--grey-300); margin: 0; }
.block-divider .blk-drag { top: 3px; }

.block-content b, .block-content strong { font-weight: 700; }
.block-content code {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: .88em;
  background: var(--grey-100); color: var(--red);
  padding: 2px 5px; border-radius: 5px;
}
.block-code .block-content code { background: none; color: inherit; padding: 0; }

/* 슬래시 메뉴 */
.slash-menu {
  position: fixed;
  width: 280px; max-height: 340px; overflow-y: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 27, 55, 0.16), 0 0 0 1px rgba(0, 27, 55, 0.04);
  padding: 6px;
  z-index: 50;
}
.slash-menu .sm-head { padding: 8px 10px 6px; font-size: 12px; font-weight: 600; color: var(--grey-500); }
.slash-menu .sm-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 8px 10px;
  border-radius: 10px; text-align: left;
}
.slash-menu .sm-item.on { background: var(--grey-100); }
.slash-menu .sm-ico {
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid var(--grey-200);
  display: grid; place-items: center;
  font-size: 14px; font-weight: 700; color: var(--grey-700);
}
.slash-menu .sm-name { display: block; font-size: 14px; font-weight: 600; }
.slash-menu .sm-desc { display: block; font-size: 12px; color: var(--grey-500); margin-top: 1px; }
.slash-menu .sm-none { padding: 12px; font-size: 13px; color: var(--grey-500); }

.stat-big { font-size: 30px; font-weight: 700; margin: 4px 0 12px; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 14px; color: var(--grey-600); font-weight: 500; }

/* ============ 달력 ============ */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stats .card { padding: 20px; }
.stats .stat-big { font-size: 24px; margin: 6px 0 0; }

.cal-head { display: flex; align-items: center; gap: 4px; margin-bottom: 16px; }
.cal-head h2 { font-size: 20px; margin: 0 8px 0 0; }
.cal-head .spacer { flex: 1; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 13px; font-weight: 600; color: var(--grey-500); padding-bottom: 6px; }
.cal-dow.sun { color: var(--red); }
.cal-dow.sat { color: var(--blue); }

.cal-day {
  position: relative;
  overflow: hidden; /* 채움이 둥근 모서리 밖으로 안 나가게 */
  min-height: 84px;
  border-radius: 14px;
  padding: 8px;
  display: flex; flex-direction: column; justify-content: space-between;
  text-align: left;
  background: var(--grey-50);
  cursor: default;
  transition: box-shadow .15s;
}
.cal-day.other { opacity: .35; cursor: pointer; }
.cal-day.other:hover { box-shadow: inset 0 0 0 2px var(--grey-200); }
.cal-day > span:not(.cal-fill) { position: relative; z-index: 1; } /* 글자는 채움 위에 */

/* 하루 목표 대비 공부한 비율만큼 아래에서부터 채움 */
.cal-fill {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--blue-100);
  transition: height .3s;
}
.cal-day.done .cal-fill { background: var(--blue); }

.cal-num { font-size: 14px; font-weight: 600; color: var(--grey-700); }
.cal-day.today .cal-num {
  background: var(--grey-900); color: #fff;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; margin: -2px 0 0 -2px;
  font-size: 13px;
}
.cal-time { font-size: 12px; font-weight: 700; color: var(--blue-strong); font-variant-numeric: tabular-nums; }
.cal-day.done .cal-num, .cal-day.done .cal-time { color: #fff; }
.cal-check {
  position: absolute !important; top: 8px; right: 8px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; color: var(--blue);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 800;
}

/* 달력 머리의 하루 목표 선택 */
.goal-pick {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: 10px;
  font-size: 14px; font-weight: 600; color: var(--grey-600);
}
/* 하루 목표: 둥근 알약 버튼 */
.goal-btn {
  display: inline-flex; align-items: center; gap: 4px;
  height: 32px; padding: 0 10px 0 14px;
  border-radius: 999px;
  background: var(--blue-50); color: var(--blue);
  font-size: 14px; font-weight: 700;
  transition: background .12s, transform .1s;
}
.goal-btn:hover { background: var(--blue-100); }
.goal-btn:active { transform: scale(0.96); }
.goal-btn.sm { height: 26px; padding: 0 8px 0 10px; font-size: 13px; }

/* 하루 목표: 1~12시간 칩 카드 */
.goal-pop {
  position: fixed; z-index: 250;
  width: 244px; padding: 14px;
  border-radius: 20px; background: #fff;
  box-shadow: 0 12px 40px rgba(0, 27, 55, 0.16), 0 0 0 1px rgba(0, 27, 55, 0.04);
  opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top left;
  transition: opacity .14s, transform .14s;
}
.goal-pop.show { opacity: 1; transform: none; }
.goal-pop-title { padding: 0 4px 10px; font-size: 13px; font-weight: 600; color: var(--grey-500); }
.goal-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.goal-chip {
  height: 38px; border-radius: 999px;
  background: var(--grey-100); color: var(--grey-700);
  font-size: 14px; font-weight: 600;
  outline: none;
  transition: background .12s, color .12s, transform .1s;
}
.goal-chip:hover { background: var(--grey-200); color: var(--grey-900); }
.goal-chip:active { transform: scale(0.95); }
.goal-chip:focus-visible { box-shadow: 0 0 0 3px var(--blue-100); }
.goal-chip.on { background: var(--blue); color: #fff; }

/* ============ 반응형 ============ */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .sidebar { width: 72px !important; padding: 16px 8px; }
  .nav-item span:not(.nav-ico), .side-section, .sidebar-resizer { display: none; }
  .nav-item { justify-content: center; }
  .page { padding: 24px 16px 64px; }
  .note-page { width: 100%; min-width: 0; margin: 0; padding: 24px 16px 64px; }
  .blk-drag { opacity: 1; } /* 터치 화면엔 hover가 없으니 항상 보이게 */
  .cal-day { min-height: 58px; padding: 6px; }
  .cal-time { font-size: 10px; }
  .cal-check { display: none; }
}

/* ============ 로그인 ============ */
body.locked .sidebar { display: none; }
.login {
  width: 100%; max-width: 360px;
  margin: 18vh auto 0; padding: 0 24px;
  display: flex; flex-direction: column; align-items: center;
}
.login-logo { width: 48px; height: 48px; border-radius: 16px; font-size: 24px; }
.login h1 { margin: 16px 0 4px; font-size: 24px; }
.login p { margin: 0 0 24px; font-size: 15px; color: var(--grey-600); }
.login .input { width: 100%; }
.login-error { min-height: 20px; margin: 8px 0; font-size: 14px; color: var(--red); }
.login .btn { width: 100%; }

/* ============ 여러 블록 선택 ============ */
.marquee {
  position: absolute; z-index: 15; pointer-events: none;
  border: 1px solid var(--blue-300); border-radius: 4px;
  background: rgba(49, 130, 246, 0.08);
}
.block.selected { background: rgba(232, 243, 255, 0.7); box-shadow: inset 0 0 0 2px var(--blue-200); }
.block.selected .blk-drag { opacity: 1; }
body.marquee-selecting, body.marquee-selecting * { user-select: none; }
