/* ================================================================ 기본 */
* { box-sizing: border-box; }
:root {
  --bg: #ffffff;
  --side: #f6f5f4;
  --panel: #fbfbfb;
  --text: #1d1d1f;
  --text2: #86868b;
  --text3: #c2c2c7;
  --line: #e7e7e9;
  --hover: rgba(0, 0, 0, .045);
  --sel: rgba(0, 0, 0, .075);
  --yellow: #e3a400;
  --note-sel: #ffe590;
  --blue: #3d7cf5;
  --red: #e5484d;
  --sat: #3d7cf5;
  --shadow: 0 12px 32px rgba(0, 0, 0, .16), 0 0 0 .5px rgba(0, 0, 0, .1);
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Segoe UI", sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1e1e1e;
    --side: #262626;
    --panel: #2c2c2e;
    --text: #ececec;
    --text2: #98989d;
    --text3: #5a5a5e;
    --line: #38383a;
    --hover: rgba(255, 255, 255, .06);
    --sel: rgba(255, 255, 255, .1);
    --yellow: #f5b800;
    --note-sel: #5b4a16;
    --blue: #4c8bff;
    --red: #ff5b5f;
    --sat: #5c9bff;
    --shadow: 0 12px 32px rgba(0, 0, 0, .5), 0 0 0 .5px rgba(255, 255, 255, .14);
  }
}

html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
body { overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.spacer { flex: 1; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.icon-btn { width: 34px; height: 34px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--text2); flex: none; }
.icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.icon-btn:disabled { opacity: .35; }
.text-btn { color: var(--blue); padding: 4px 8px; border-radius: 6px; font-size: 15px; }
.text-btn:hover { background: var(--hover); }
.text-btn.strong { font-weight: 600; }

/* ================================================================ 로그인 */
.login { min-height: 100dvh; display: flex; align-items: center; justify-content: center; background: var(--side); padding: 16px; }
.login-card { width: min(340px, 100%); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.login-icon { width: 72px; height: 72px; border-radius: 16px; box-shadow: 0 4px 16px rgba(0, 0, 0, .12); }
.login-card h1 { font-size: 22px; margin: 6px 0 10px; }
.login-card input { width: 100%; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); padding: 0 14px; font-size: 16px; outline: none; }
.login-card input:focus { border-color: var(--yellow); }
.login-card button { width: 100%; height: 44px; border-radius: 10px; background: var(--yellow); color: #fff; font-weight: 600; font-size: 16px; }
.login-otp { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.login-card #login-code { letter-spacing: .3em; text-align: center; }
.login-card #login-code::placeholder { letter-spacing: normal; }
.login-remember { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text2); }
.login-remember input { width: auto; height: auto; margin: 0; accent-color: var(--yellow); }
.login-err { color: var(--red); min-height: 1.4em; margin: 0; font-size: 14px; text-align: center; }

/* ================================================================ 레이아웃 */
#app { display: flex; height: 100dvh; }
.rail { flex: 0 0 68px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 0; background: var(--side); border-right: 1px solid var(--line); }
.rail a, .rail button { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 56px; padding: 8px 0; border-radius: 10px; color: var(--text2); text-decoration: none; font-size: 11px; }
.rail a:hover, .rail button:hover { background: var(--hover); }
.rail a.active { color: var(--text); background: var(--sel); }
.rail a.active[data-tab=notes] .ic { color: var(--yellow); }
.rail a.active[data-tab=calendar] .ic { color: var(--blue); }
.rail .ic { width: 22px; height: 22px; }
.view { flex: 1; min-width: 0; height: 100%; display: none; }
.view.active { display: flex; }

/* ================================================================ 메모 */
.n-folders { flex: 0 0 220px; display: flex; flex-direction: column; background: var(--side); border-right: 1px solid var(--line); min-width: 0; }
.pane-head { padding: 18px 16px 8px; }
.pane-head h2 { margin: 0; font-size: 12px; font-weight: 600; color: var(--text2); }
.folder-list { list-style: none; margin: 0; padding: 0 8px; overflow: auto; flex: 1; }
.folder { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 6px 0 10px; border-radius: 8px; user-select: none; cursor: default; }
.folder .ic { color: var(--yellow); width: 18px; height: 18px; }
.f-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f-count { color: var(--text2); font-size: 13px; }
.folder:hover { background: var(--hover); }
.folder.active { background: var(--sel); }
.folder.drop { background: var(--note-sel); }
.f-more { width: 24px; height: 24px; border-radius: 6px; display: none; align-items: center; justify-content: center; color: var(--text2); }
.f-more:hover { background: var(--sel); }
.f-more .ic { color: currentColor; width: 16px; height: 16px; stroke-width: 2.4; }
.folder:hover .f-more { display: inline-flex; }
@media (hover: none) { .f-more { display: inline-flex; } }
.new-folder { display: flex; align-items: center; gap: 6px; margin: 8px; padding: 8px 10px; border-radius: 8px; color: var(--text2); }
.new-folder:hover { background: var(--hover); color: var(--text); }
.new-folder .ic { width: 16px; height: 16px; }

.n-list { flex: 0 0 310px; display: flex; flex-direction: column; border-right: 1px solid var(--line); min-width: 0; }
.list-head { padding: 12px 12px 6px; }
.row1 { display: flex; align-items: center; gap: 4px; min-height: 34px; }
.list-head h2 { flex: 1; min-width: 0; margin: 0 0 0 4px; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compose { color: var(--yellow); }
.compose:hover:not(:disabled) { color: var(--yellow); }
.search { display: block; position: relative; margin-top: 8px; }
.search .ic { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text2); }
.search input { width: 100%; height: 32px; border: 0; border-radius: 9px; background: var(--sel); padding: 0 10px 0 30px; outline: none; }
.search input:focus { box-shadow: 0 0 0 2px var(--yellow) inset; }
.note-list { flex: 1; overflow: auto; padding: 0 8px 16px; }
.nl-group { font-size: 13px; font-weight: 700; padding: 14px 10px 6px; }
.nl-item { position: relative; padding: 9px 12px; border-radius: 9px; cursor: default; user-select: none; }
.nl-item + .nl-item::before { content: ''; position: absolute; left: 12px; right: 12px; top: 0; border-top: 1px solid var(--line); }
.nl-item.active::before, .nl-item.active + .nl-item::before { display: none; }
.nl-item.active { background: var(--note-sel); }
.nl-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.nl-title .pin { width: 14px; height: 14px; color: var(--yellow); }
.nl-sub { display: flex; gap: 8px; font-size: 13px; color: var(--text2); min-width: 0; }
.nl-date { flex: none; color: var(--text); opacity: .75; }
.nl-snip { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nl-folder { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 12px; color: var(--text2); }
.nl-folder .ic { width: 13px; height: 13px; }
.list-empty { padding: 48px 0; text-align: center; color: var(--text2); }

.n-editor { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.editor-bar { display: flex; align-items: center; gap: 2px; height: 52px; padding: 0 10px; flex: none; }
.aa { width: auto; padding: 0 9px; font-weight: 600; font-size: 15px; }
.back { display: none; align-items: center; color: var(--yellow); font-size: 16px; padding: 4px 6px 4px 0; }
.back .ic { width: 24px; height: 24px; stroke-width: 2.2; }
.editor-scroll { flex: 1; overflow: auto; padding: 0 max(28px, calc((100% - 760px) / 2)) 40vh; }
.note-date { text-align: center; font-size: 12px; color: var(--text2); padding: 2px 0 16px; }
.trash-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding: 10px 14px; border-radius: 10px; background: var(--sel); font-size: 14px; color: var(--text2); }
.trash-banner button { color: var(--yellow); font-weight: 600; flex: none; }
.editor-empty { position: absolute; inset: 52px 0 0; display: flex; align-items: center; justify-content: center; color: var(--text3); font-size: 15px; pointer-events: none; }

.editor { outline: none; min-height: 50vh; font-size: 16px; line-height: 1.55; word-break: break-word; caret-color: var(--yellow); }
.editor h1 { font-size: 1.75em; line-height: 1.25; margin: 0 0 .25em; font-weight: 700; }
.editor h2 { font-size: 1.35em; line-height: 1.3; margin: .5em 0 .15em; font-weight: 700; }
.editor h3 { font-size: 1.12em; margin: .4em 0 .1em; font-weight: 600; }
.editor pre { font: 14px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; margin: 0; white-space: pre-wrap; }
.editor p { margin: 0; }
.editor ul, .editor ol { margin: .15em 0; padding-left: 1.6em; }
.editor a { color: var(--yellow); }
.editor blockquote { margin: .3em 0; padding-left: 12px; border-left: 3px solid var(--line); color: var(--text2); }
.editor table { border-collapse: collapse; margin: .4em 0; }
.editor td, .editor th { border: 1px solid var(--line); padding: 4px 8px; }
.editor ul.checklist { list-style: none; padding-left: 0; }
.editor ul.checklist ul { padding-left: 0; }
.editor ul.checklist li { position: relative; padding-left: 30px; margin: .3em 0; min-height: 1.55em; }
.editor ul.checklist li::before {
  content: ''; position: absolute; left: 1px; top: .15em; width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--text3); box-sizing: border-box; cursor: pointer;
}
.editor ul.checklist li.checked::before {
  border-color: var(--yellow);
  background: var(--yellow) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 13px no-repeat;
}
.editor ul.checklist li.checked { color: var(--text2); }
.editor[contenteditable=false] { cursor: default; }

/* ================================================================ 팝업 메뉴 / 대화상자 / 토스트 */
.popmenu { position: fixed; z-index: 1000; min-width: 210px; max-width: 290px; max-height: 70vh; overflow: auto; padding: 5px; border-radius: 10px; background: var(--panel); box-shadow: var(--shadow); font-size: 14px; }
@supports (backdrop-filter: blur(1px)) {
  .popmenu { background: color-mix(in srgb, var(--panel) 82%, transparent); backdrop-filter: blur(24px) saturate(1.8); -webkit-backdrop-filter: blur(24px) saturate(1.8); }
}
.pm-item { display: flex; align-items: center; gap: 4px; width: 100%; padding: 4px 8px; border-radius: 6px; text-align: left; min-height: 28px; }
.pm-item:hover:not(:disabled) { background: var(--blue); color: #fff; }
.pm-item:disabled { opacity: .4; }
.pm-item.danger { color: var(--red); }
.pm-item.danger:hover { background: var(--red); color: #fff; }
.pm-check { width: 16px; flex: none; font-size: 12px; }
.pm-label { flex: 1; }
.pm-hint { color: var(--text2); font-size: 12px; }
.pm-item:hover .pm-hint { color: rgba(255, 255, 255, .8); }
.pm-item.fmt-title .pm-label { font-size: 20px; font-weight: 700; }
.pm-item.fmt-heading .pm-label { font-size: 17px; font-weight: 700; }
.pm-item.fmt-sub .pm-label { font-size: 15px; font-weight: 600; }
.pm-item.fmt-mono .pm-label { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.pm-header { padding: 6px 8px 2px 28px; font-size: 12px; font-weight: 600; color: var(--text2); }
.popmenu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }

dialog { border: 0; padding: 0; color: var(--text); background: var(--panel); }
dialog::backdrop { background: rgba(0, 0, 0, .3); }
.mini-dialog { width: min(360px, calc(100vw - 32px)); border-radius: 14px; box-shadow: var(--shadow); }
.mini-dialog form { padding: 20px; }
.mini-dialog h3 { margin: 0 0 6px; font-size: 16px; }
.mini-dialog p { margin: 0 0 16px; font-size: 14px; color: var(--text2); }
.md-input { width: 100%; height: 38px; margin: 8px 0 16px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); outline: none; }
.md-input:focus { border-color: var(--blue); }
.md-btns { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.md-btns button { padding: 7px 14px; border-radius: 8px; background: var(--sel); font-weight: 500; }
.md-btns .primary { background: var(--blue); color: #fff; }
.md-btns .danger { background: var(--red); color: #fff; }

.toast { position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 2000; max-width: calc(100vw - 32px); padding: 9px 16px; border-radius: 20px; background: rgba(28, 28, 30, .92); color: #fff; font-size: 14px; }

/* ================================================================ 캘린더 */
.cal { flex-direction: column; position: relative; }
.cal-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.cal-title { margin: 0 4px 0 2px; font-size: 21px; font-weight: 700; white-space: nowrap; }
.cal-nav { display: flex; }
.seg { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--sel); }
.seg button { padding: 4px 13px; border-radius: 7px; font-size: 13px; color: var(--text2); }
.seg button.active { background: var(--bg); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.today-btn { width: 28px; height: 28px; margin: 0 3px 0 8px; border: 1.7px solid var(--text2); border-top-width: 5px; border-radius: 6px; font-size: 11px; font-weight: 700; color: var(--text2); line-height: 1; }
.today-btn:hover { color: var(--blue); border-color: var(--blue); }
.cal-search { display: flex; gap: 8px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.cal-search input { flex: 1; height: 34px; border: 0; border-radius: 9px; background: var(--sel); padding: 0 12px; outline: none; }
.cal-body { flex: 1; display: flex; min-height: 0; }
.cal-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.cal-day { flex: 0 0 300px; display: flex; flex-direction: column; border-left: 1px solid var(--line); overflow: hidden; }

/* 월 */
.m-head { display: grid; grid-template-columns: repeat(7, 1fr); padding: 6px 0; font-size: 12px; text-align: center; color: var(--text2); border-bottom: 1px solid var(--line); }
.m-head .sun { color: var(--red); }
.m-head .sat { color: var(--sat); }
.m-grid { flex: 1; min-height: 0; display: grid; grid-template-rows: repeat(var(--weeks), minmax(0, 1fr)); }
.m-week { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); min-height: 0; }
.m-cell { padding: 4px; border-right: 1px solid var(--line); min-width: 0; cursor: default; user-select: none; }
.m-cell:nth-child(7) { border-right: 0; }
.m-num { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 12px; font-size: 13px; font-weight: 500; }
.m-cell.sun .m-num { color: var(--red); }
.m-cell.sat .m-num { color: var(--sat); }
.m-cell.out .m-num { opacity: .35; }
.m-cell.sel { background: color-mix(in srgb, var(--blue) 8%, transparent); }
.m-cell.today .m-num { background: var(--blue); color: #fff; opacity: 1; }
.m-bars { position: absolute; inset: 0; pointer-events: none; }
.m-bar { position: absolute; padding: 0 5px; border-radius: 4px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: auto; cursor: pointer; }
.m-bar.fill { background: var(--c); color: #fff; }
.m-bar.timed { padding-left: 13px; color: var(--text); }
.m-bar.timed::before { content: ''; position: absolute; left: 4px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--c); }
.m-bar.timed:hover { background: var(--hover); }
.m-bar.holiday { color: var(--red); font-weight: 500; pointer-events: none; }
.m-more { position: absolute; font-size: 11px; color: var(--text2); padding-left: 5px; pointer-events: none; }

/* 날짜 상세 패널 */
.dp-head { padding: 18px 18px 10px; font-size: 16px; font-weight: 700; }
.dp-head.sun { color: var(--red); }
.dp-head.sat { color: var(--sat); }
.dp-list { flex: 1; overflow: auto; padding: 0 10px; }
.dp-empty { padding: 10px 8px; font-size: 14px; color: var(--text2); }
.dp-add { margin: 10px 14px 16px; padding: 9px; border-radius: 9px; background: var(--sel); font-weight: 500; }
.dp-add:hover { background: color-mix(in srgb, var(--blue) 16%, transparent); color: var(--blue); }
.ev-row { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 9px; cursor: pointer; }
.ev-row:hover { background: var(--hover); }
.ev-row.holiday { cursor: default; }
.ev-row.holiday:hover { background: none; }
.ev-dot { width: 4px; align-self: stretch; min-height: 34px; border-radius: 2px; background: var(--c, var(--blue)); flex: none; }
.ev-row.holiday .ev-dot { background: var(--red); }
.ev-main { flex: 1; min-width: 0; }
.ev-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-row.holiday .ev-title { color: var(--red); }
.ev-time { font-size: 12.5px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-rep .ic { width: 15px; height: 15px; color: var(--text2); }

/* 주 / 일 */
.tg { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tg-head, .tg-allday { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.tg-gutter { flex: 0 0 58px; padding: 4px 8px 0 0; font-size: 11px; color: var(--text2); text-align: right; }
.tg-dhs { flex: 1; display: grid; grid-template-columns: repeat(var(--n), 1fr); }
.tg-dh { padding: 6px 0; text-align: center; cursor: pointer; }
.tg-dh:hover .tg-dn { background: var(--hover); }
.tg-wd { display: block; font-size: 12px; color: var(--text2); }
.tg-dn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; font-size: 17px; font-weight: 600; }
.tg-dh.sun .tg-wd, .tg-dh.sun .tg-dn { color: var(--red); }
.tg-dh.sat .tg-wd, .tg-dh.sat .tg-dn { color: var(--sat); }
.tg-dh.today .tg-dn, .tg-dh.today:hover .tg-dn { background: var(--blue); color: #fff; }
.tg-ad { flex: 1; position: relative; min-height: 24px; cursor: default; }
.tg-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; }
.tg-body { display: flex; position: relative; }
.tg-hours { flex: 0 0 58px; position: relative; }
.tg-hours span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--text2); white-space: nowrap; }
.tg-cols { flex: 1; display: grid; grid-template-columns: repeat(var(--n), 1fr); background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 48px); }
.tg-col { position: relative; border-left: 1px solid var(--line); }
.tg-col.today { background: color-mix(in srgb, var(--blue) 4%, transparent); }
.tg-ev { position: absolute; z-index: 1; padding: 2px 5px; border-radius: 5px; border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 20%, var(--bg)); font-size: 12px; line-height: 1.3; overflow: hidden; cursor: pointer; }
.tg-ev:hover { background: color-mix(in srgb, var(--c) 30%, var(--bg)); }
.tg-ev-t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.tg-ev-time { font-size: 11px; color: var(--text2); }
.tg-now { position: absolute; left: -1px; right: 0; z-index: 2; border-top: 2px solid var(--red); pointer-events: none; }
.tg-now::before { content: ''; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }

/* 연 */
.year { flex: 1; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 22px 28px; padding: 18px 22px 90px; align-content: start; }
.y-month h4 { display: inline-block; margin: 0 0 6px; padding: 0 4px; font-size: 16px; font-weight: 700; cursor: pointer; border-radius: 6px; }
.y-month h4:hover { background: var(--hover); }
.y-month h4.cur { color: var(--blue); }
.y-grid { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 11.5px; text-align: center; }
.y-grid span { position: relative; display: flex; justify-content: center; height: 24px; align-items: center; }
.y-grid .wd { color: var(--text2); font-size: 10.5px; }
.y-grid .d { cursor: pointer; }
.y-grid .d i { font-style: normal; width: 22px; height: 22px; line-height: 22px; border-radius: 50%; }
.y-grid .d:hover i { background: var(--hover); }
.y-grid .sun { color: var(--red); }
.y-grid .sat { color: var(--sat); }
.y-grid .today i, .y-grid .today:hover i { background: var(--blue); color: #fff; }
.y-grid .busy::after { content: ''; position: absolute; bottom: -1px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--text3); }

/* 목록 / 검색 */
.agenda { flex: 1; overflow: auto; padding: 4px 16px 100px; }
.ls-day { display: flex; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ls-date { flex: 0 0 48px; display: flex; flex-direction: column; align-items: center; padding-top: 4px; }
.ls-y { font-size: 11px; color: var(--text2); }
.ls-dn { font-size: 21px; font-weight: 700; line-height: 1.1; }
.ls-wd { font-size: 12px; color: var(--text2); }
.ls-day.sun .ls-dn, .ls-day.sun .ls-wd { color: var(--red); }
.ls-day.sat .ls-dn, .ls-day.sat .ls-wd { color: var(--sat); }
.ls-day.today .ls-dn { color: var(--blue); }
.ls-evs { flex: 1; min-width: 0; }
.empty-state { padding: 60px 0; text-align: center; color: var(--text2); }

.fab { position: absolute; right: 24px; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 5; width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--blue); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--blue) 45%, transparent); }
.fab:hover { filter: brightness(1.08); }
.fab .ic { width: 26px; height: 26px; stroke-width: 2.3; }
.cal.has-panel .fab { right: 324px; }

/* 일정 편집 시트 */
.sheet { width: min(460px, calc(100vw - 32px)); max-height: min(760px, calc(100dvh - 32px)); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.sheet form { display: flex; flex-direction: column; max-height: inherit; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px; border-bottom: 1px solid var(--line); background: var(--panel); }
.sheet-head h3 { margin: 0; font-size: 16px; }
.sheet-body { overflow: auto; display: flex; flex-direction: column; gap: 12px; padding: 14px; background: var(--side); }
.ev-title-input { padding: 12px 14px; border: 0; border-radius: 10px; background: var(--bg); font-size: 19px; font-weight: 600; outline: none; }
.color-row { display: flex; flex-wrap: wrap; gap: 9px; padding: 2px 4px; }
.color-row label { position: relative; width: 26px; height: 26px; border-radius: 50%; background: var(--c); cursor: pointer; }
.color-row input { position: absolute; opacity: 0; pointer-events: none; }
.color-row label:has(input:checked)::after { content: ''; position: absolute; inset: -4px; border: 2px solid var(--c); border-radius: 50%; }
.field-group { display: flex; flex-direction: column; border-radius: 10px; background: var(--bg); overflow: hidden; }
.field-group .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 6px 14px; border-bottom: 1px solid var(--line); }
.field-group > :last-child { border-bottom: 0; }
.dt { display: flex; gap: 6px; }
.dt input, .row select, .row input[type=date] { padding: 5px 8px; border: 0; border-radius: 7px; background: var(--sel); outline: none; }
#ev-form.all-day input[type=time] { display: none; }
.field-group .plain { width: 100%; padding: 13px 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; outline: none; resize: vertical; }
.switch { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 46px; height: 28px; margin: 0; border-radius: 14px; background: var(--text3); cursor: pointer; transition: background .2s; }
.switch::after { content: ''; position: absolute; left: 2px; top: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: left .2s; }
.switch:checked { background: #34c759; }
.switch:checked::after { left: 20px; }
.danger-btn { padding: 13px; border-radius: 10px; background: var(--bg); color: var(--red); font-weight: 500; }

/* ================================================================ 중간 폭 */
@media (max-width: 1100px) and (min-width: 761px) {
  .n-folders { flex-basis: 180px; }
  .n-list { flex-basis: 260px; }
  .cal-day { flex-basis: 250px; }
  .cal.has-panel .fab { right: 274px; }
}

/* ================================================================ 모바일 */
@media (max-width: 760px) {
  #app { flex-direction: column; }
  .rail { order: 2; flex: 0 0 auto; flex-direction: row; justify-content: space-around; gap: 0; padding: 4px 0 calc(4px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  .rail .spacer { display: none; }
  .rail a, .rail button { width: 80px; padding: 4px 0; }
  .rail a.active { background: none; }
  body.in-editor .rail { display: none; }
  .view { flex: 1; min-height: 0; height: auto; }
  input, select, textarea { font-size: 16px; }

  /* 메모: 한 번에 한 화면 */
  .notes .n-folders, .notes .n-list, .notes .n-editor { display: none; flex: 1 1 auto; width: 100%; border: 0; }
  .notes[data-pane=folders] .n-folders, .notes[data-pane=list] .n-list, .notes[data-pane=editor] .n-editor { display: flex; }
  .n-folders { background: var(--bg); }
  .back { display: inline-flex; }
  .pane-head { padding: 20px 16px 10px; }
  .pane-head h2 { font-size: 30px; font-weight: 800; color: var(--text); }
  .folder { height: 46px; font-size: 16px; }
  .list-head h2 { font-size: 20px; text-align: center; margin: 0; }
  .editor-scroll { padding: 0 18px 40vh; }
  .editor-bar { padding: 0 6px; padding-top: env(safe-area-inset-top); height: auto; min-height: 50px; }
  .icon-btn { width: 40px; height: 40px; }
  .ic { width: 22px; height: 22px; }

  /* 캘린더 */
  .cal-head { padding: 8px 10px; gap: 2px; }
  .cal-title { font-size: 19px; }
  .seg { order: 10; width: 100%; margin-top: 6px; }
  .seg button { flex: 1; padding: 5px 0; }
  .cal-body { flex-direction: column; }
  .cal.has-panel .cal-main { flex: 0 0 58%; }
  .cal-day { flex: 1; border-left: 0; border-top: 1px solid var(--line); }
  .dp-head { padding: 12px 16px 6px; font-size: 15px; }
  .dp-add { display: none; }
  .m-cell { padding: 2px; }
  .m-num { min-width: 20px; height: 20px; font-size: 12px; padding: 0 3px; }
  .m-bar { font-size: 10px; padding: 0 3px; border-radius: 3px; pointer-events: none; }
  .m-bar.timed { padding-left: 9px; }
  .m-bar.timed::before { left: 2px; width: 5px; height: 5px; margin-top: -2.5px; }
  .tg-gutter, .tg-hours { flex-basis: 44px; }
  .tg-hours span { font-size: 9.5px; right: 4px; }
  .tg-dn { width: 28px; height: 28px; font-size: 15px; }
  .tg-ev { font-size: 10.5px; padding: 1px 3px; }
  .year { grid-template-columns: repeat(2, 1fr); gap: 16px 14px; padding: 12px 12px 90px; }
  .y-grid span { height: 20px; }
  .y-grid .d i { width: 18px; height: 18px; line-height: 18px; font-size: 10px; }
  .fab, .cal.has-panel .fab { right: 16px; bottom: 16px; width: 52px; height: 52px; }
  .sheet { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .sheet form { height: 100%; }
  .sheet-head { padding-top: calc(10px + env(safe-area-inset-top)); }
  .sheet-body { flex: 1; }
}
