/* ---------------- 메모(구글 Keep 모양) ---------------- */

.app[data-section="notes"] { grid-template-columns: var(--side-w) 256px minmax(0, 1fr); }
:root[data-sidebar="closed"] .app[data-section="notes"] { grid-template-columns: 0 256px minmax(0, 1fr); }
:root[data-sched-panel="closed"] .app[data-section="notes"] { grid-template-columns: var(--side-w) 0 minmax(0, 1fr); }
:root[data-sched-panel="closed"][data-sidebar="closed"] .app[data-section="notes"] { grid-template-columns: 0 0 minmax(0, 1fr); }
:root[data-sched-panel="closed"] .app[data-section="notes"] .listpane { overflow: hidden; border-right: 0; }
.app[data-section="notes"] .listpane { background: var(--bg); }
.app[data-section="notes"] .list-head { border-bottom: 0; }
.detail[data-mode="notes"] .detail-head { display: none; }
.detail[data-mode="notes"] .detail-body { display: flex; }

.notes-side { display: grid; align-content: start; padding: 4px 0 24px; overflow-y: auto; flex: 1; }
.notes-nav { border-radius: 0 999px 999px 0; margin-right: 10px; padding-left: 22px; min-height: 46px; gap: 18px; }
.notes-nav.is-on { background: #FEEFC3; color: #202124; }
:root[data-theme="dark"] .notes-nav.is-on { background: #41331C; color: #F1E5C2; }
.notes-side-foot { padding: 18px 16px 0; }

.notes-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.notes-head { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.notes-title { font-size: 1.25rem; font-weight: 500; margin: 0 12px 0 4px; }
.notes-search { flex: 1; max-width: 720px; border-radius: 10px; background: var(--bg-sunken); border-color: transparent; height: 44px; padding: 0 16px; }
.notes-search:focus { background: var(--bg); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.notes-body { flex: 1; overflow-y: auto; padding: 28px 24px 80px; }
.notes-view-title { max-width: 1200px; margin: 0 auto 18px; font-size: 1.3rem; font-weight: 500; }
.notes-sec { max-width: 1200px; margin: 24px auto 8px; font-size: .72rem; font-weight: 600; letter-spacing: .06em; color: var(--text-2); }
.notes-banner { max-width: 1200px; margin: 0 auto 22px; display: flex; align-items: center; justify-content: center; gap: 14px; font-style: italic; color: var(--text-2); }
.notes-empty { display: grid; justify-items: center; gap: 18px; margin-top: 12vh; color: var(--text-3); }
.notes-empty .ico { opacity: .25; }
.notes-empty p { font-size: 1.3rem; margin: 0; color: var(--text-2); }

/* 메모 색(Keep 팔레트) */
.note-composer, .note-card, .note-editor, .color-dot { --nbg: var(--bg); --nline: var(--line); }
[data-color="red"] { --nbg: #FAAFA8; }
[data-color="orange"] { --nbg: #F39F76; }
[data-color="yellow"] { --nbg: #FFF8B8; }
[data-color="green"] { --nbg: #E2F6D3; }
[data-color="teal"] { --nbg: #B4DDD3; }
[data-color="blue"] { --nbg: #D4E4ED; }
[data-color="darkblue"] { --nbg: #AECCDC; }
[data-color="purple"] { --nbg: #D3BFDB; }
[data-color="pink"] { --nbg: #F6E2DD; }
[data-color="brown"] { --nbg: #E9E3D4; }
[data-color="gray"] { --nbg: #EFEFF1; }
:root[data-theme="dark"] [data-color="red"] { --nbg: #77172E; }
:root[data-theme="dark"] [data-color="orange"] { --nbg: #692B17; }
:root[data-theme="dark"] [data-color="yellow"] { --nbg: #7C4A03; }
:root[data-theme="dark"] [data-color="green"] { --nbg: #264D3B; }
:root[data-theme="dark"] [data-color="teal"] { --nbg: #0C625D; }
:root[data-theme="dark"] [data-color="blue"] { --nbg: #256377; }
:root[data-theme="dark"] [data-color="darkblue"] { --nbg: #284255; }
:root[data-theme="dark"] [data-color="purple"] { --nbg: #472E5B; }
:root[data-theme="dark"] [data-color="pink"] { --nbg: #6C394F; }
:root[data-theme="dark"] [data-color="brown"] { --nbg: #4B443A; }
:root[data-theme="dark"] [data-color="gray"] { --nbg: #232427; }

/* 메모 작성 상자 */
.note-composer { max-width: 600px; margin: 0 auto 30px; border-radius: 10px; background: var(--nbg); border: 1px solid var(--nline);
  box-shadow: 0 1px 2px rgba(60, 64, 67, .3), 0 2px 6px 2px rgba(60, 64, 67, .15); }
.note-composer:not([data-color="default"]) { border-color: transparent; }
.nc-collapsed { display: flex; align-items: center; gap: 4px; padding: 4px 8px 4px 16px; min-height: 46px; cursor: text; }
.nc-ph { flex: 1; color: var(--text-2); font-weight: 500; }
.nc-top { display: flex; align-items: flex-start; gap: 6px; padding: 10px 8px 0 16px; }
.nc-title { flex: 1; border: 0; background: transparent; font-size: 1.05rem; font-weight: 500; padding: 4px 0; color: inherit; outline: none; min-width: 0; }
.nc-text { display: block; width: 100%; border: 0; background: transparent; resize: none; padding: 8px 16px 10px; font: inherit; line-height: 1.5; color: inherit; outline: none; min-height: 40px; }
.nc-pin.is-on, .card-pin.is-on { color: var(--text); }
.nc-pin.is-on .ico, .card-pin.is-on .ico { fill: currentColor; }
.nc-tools { display: flex; align-items: center; gap: 2px; padding: 4px 8px 6px; flex-wrap: wrap; }
.nc-tools .ibtn { color: var(--text-2); }
.btn.ghost { background: transparent; border-color: transparent; font-weight: 600; }
.btn.ghost:hover { background: var(--bg-hover); }

/* 카드 격자: 바둑판(세로로 쌓는 Masonry) / 목록 */
.notes-grid { max-width: 1200px; margin: 0 auto; }
.notes-grid.is-grid { columns: 240px; column-gap: 16px; }
.notes-grid.is-list { max-width: 600px; display: grid; gap: 16px; }
.note-card { position: relative; break-inside: avoid; margin: 0 0 16px; border-radius: 10px; background: var(--nbg); border: 1px solid var(--line);
  padding: 0 0 4px; cursor: default; transition: box-shadow .15s; overflow: hidden; display: flow-root; }
.note-card:not([data-color="default"]) { border-color: transparent; }
.notes-grid.is-list .note-card { margin: 0; }
.note-card:hover, .note-card:focus-visible { box-shadow: 0 1px 2px rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15); outline: none; }
.note-title { margin: 0; padding: 12px 40px 0 16px; font-size: 1rem; font-weight: 500; word-break: break-word; }
.note-body { margin: 0; padding: 10px 16px 6px; white-space: pre-wrap; word-break: break-word; line-height: 1.45; font-size: .93rem; max-height: 22em; overflow: hidden; }
.note-title + .note-body { padding-top: 8px; }
.card-pin { position: absolute; top: 4px; right: 4px; opacity: 0; transition: opacity .15s; color: var(--text-2); }
.card-pin.is-on { opacity: 1; }
.note-card:hover .card-pin, .note-card:focus-within .card-pin { opacity: 1; }
.card-tools { display: flex; justify-content: space-between; padding: 0 6px; opacity: 0; transition: opacity .15s; }
.note-card:hover .card-tools, .note-card:focus-within .card-tools { opacity: 1; }
.card-tools .ibtn { color: var(--text-2); width: 32px; height: 32px; }
@media (hover: none) { .card-tools, .card-pin { opacity: 1; } }
.note-items { padding: 8px 12px 4px; display: grid; gap: 2px; }
.nc-item { display: flex; align-items: flex-start; gap: 8px; font-size: .93rem; line-height: 1.4; cursor: pointer; }
.nc-item input { margin-top: 3px; flex: none; }
.nc-item.is-done span { text-decoration: line-through; color: var(--text-3); }
.note-done-count { margin: 4px 0 0 4px; font-size: .82rem; color: var(--text-2); }
.note-imgs { display: grid; gap: 2px; }
.note-imgs.n2 { grid-template-columns: 1fr 1fr; }
.note-imgs.n3 { grid-template-columns: 1fr 1fr 1fr; }
.note-imgs img { width: 100%; display: block; max-height: 360px; object-fit: cover; }
.note-imgs.n2 img, .note-imgs.n3 img { aspect-ratio: 1; height: 100%; }
.note-img { position: relative; }
.note-img .img-del { position: absolute; right: 6px; bottom: 6px; background: rgba(0, 0, 0, .55); color: #fff; opacity: 0; }
.note-img:hover .img-del { opacity: 1; }
.note-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 12px 4px; }
.note-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .76rem; background: rgba(0, 0, 0, .08); cursor: pointer; }
:root[data-theme="dark"] .note-chip { background: rgba(255, 255, 255, .12); }
.note-chip.is-past { text-decoration: line-through; opacity: .7; }
.chip-x { display: none; border: 0; background: none; padding: 0; color: inherit; cursor: pointer; }
.note-chip:hover .chip-x { display: inline-grid; }

/* 편집 창 */
.modal-card.note-modal { background: var(--bg); overflow: hidden; }
.note-modal .modal-body { padding: 0; }
.note-editor { background: var(--nbg); min-height: 120px; max-height: calc(100dvh - 120px); overflow-y: auto; }
.note-editor .nc-title { font-size: 1.35rem; }
.note-edited-row { display: flex; justify-content: flex-end; padding: 6px 16px 0; }
.note-edited { font-size: .76rem; color: var(--text-2); }

/* 체크리스트 편집 */
.cl { padding: 6px 4px 8px; }
.cl-row { display: flex; align-items: center; gap: 8px; padding: 2px 8px 2px 16px; border-top: 1px solid transparent; border-bottom: 1px solid transparent; }
.cl-row:focus-within { border-color: var(--line); }
.cl-row.is-done .cl-text { text-decoration: line-through; color: var(--text-3); }
.cl-row.is-new { color: var(--text-2); }
.cl-text { flex: 1; border: 0; background: transparent; font: inherit; padding: 6px 0; color: inherit; outline: none; min-width: 0; }
.cl-del { opacity: 0; width: 28px; height: 28px; }
.cl-row:hover .cl-del, .cl-row:focus-within .cl-del { opacity: 1; }
.cl-done-toggle { display: flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--text-2); padding: 10px 16px 6px; cursor: pointer; font: inherit; font-size: .88rem; }

/* 색 고르기·알림·라벨 */
.color-pick { display: grid; grid-template-columns: repeat(6, 32px); gap: 6px; padding: 8px; }
.color-dot { width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; background: var(--nbg); display: grid; place-items: center; cursor: pointer; color: var(--text-2); padding: 0; }
.color-dot[data-color="default"] { border-color: var(--line); }
.color-dot:hover { border-color: var(--text-2); }
.color-dot.is-on { border-color: #A142F4; }
.remind-pick { display: grid; gap: 2px; min-width: 260px; padding: 6px 0; }
.remind-pick > b { padding: 4px 14px 6px; }
.remind-pick .menu-item { display: flex; justify-content: space-between; gap: 16px; }
.remind-custom { display: flex; gap: 6px; padding: 8px 12px; }
.remind-custom .input { flex: 1; min-width: 0; }
.remind-pick .tiny { padding: 0 14px; margin: 4px 0 0; }
.label-pick-box { display: grid; gap: 8px; padding: 10px 12px; width: 240px; }
.label-pick-list { display: grid; max-height: 260px; overflow-y: auto; }
.label-pick { display: flex; align-items: center; gap: 10px; padding: 6px 2px; cursor: pointer; }
.label-edit { display: grid; gap: 6px; }
.label-row { display: flex; align-items: center; gap: 8px; }
.label-row .input { flex: 1; }

@media (max-width: 767px) {
  .app[data-section="notes"], :root[data-sidebar="closed"] .app[data-section="notes"] { grid-template-columns: 100%; }
  .app[data-section="notes"] .listpane { display: none; }
  .app[data-section="notes"] .detail { display: flex; }
  .app[data-section="notes"][data-drawer="open"] .listpane {
    display: flex; position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 60; box-shadow: var(--shadow);
  }
  .app[data-section="notes"][data-drawer="open"]::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 55; }
  .app[data-section="notes"] .fab { display: none !important; }
  .notes-head { padding: calc(6px + env(safe-area-inset-top)) 8px 6px; }
  .notes-title { display: none; }
  .notes-body { padding: 14px 10px 90px; }
  .notes-grid.is-grid { columns: 2; column-gap: 8px; }
  .note-card { margin-bottom: 8px; }
}
