/* 색 토큰(테마)은 themes.css 에서 정의합니다. 여기서는 그 토큰을 사용만 함. */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
:root {
  /* 기기 시스템 글꼴 스택 (모바일 기본). JS가 선택에 따라 --app-font 를 덮어씀. */
  --sys-font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Segoe UI", "Malgun Gothic", system-ui, "Noto Sans KR", sans-serif;
  --app-font: var(--sys-font);
}
body {
  font-family: var(--app-font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.hidden { display: none !important; }
button { font-family: inherit; color: inherit; }
svg { display: block; }

/* ---------- 로그인 ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(120% 80% at 50% -10%, var(--accent-soft), var(--bg) 55%); }
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
  padding: 40px 30px 30px; width: 100%; max-width: 340px; text-align: center; box-shadow: var(--shadow-lg);
}
.login-logo { width: 68px; height: 68px; border-radius: 18px; box-shadow: var(--shadow); }
.login-card h1 { margin: 16px 0 2px; font-size: 23px; font-weight: 800; letter-spacing: -.02em; }
.login-sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.login-card input {
  width: 100%; padding: 14px 15px; border: 1px solid var(--border-strong); border-radius: 13px;
  font-size: 16px; background: var(--bg); color: var(--text); margin-bottom: 12px; outline: none; transition: border-color .15s;
}
.login-card input:focus { border-color: var(--accent); }
.login-card button {
  width: 100%; padding: 14px; border: 0; border-radius: 13px; background: var(--accent);
  color: var(--accent-ink); font-weight: 700; font-size: 16px; cursor: pointer; transition: background .15s;
}
.login-card button:hover { background: var(--accent-hover); }
.login-err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 10px 0 0; }

/* ---------- 상단바 ---------- */
.app { max-width: 720px; margin: 0 auto; padding-bottom: 60px; }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center;
  justify-content: space-between; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 800; font-size: 17px; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand-logo { width: 26px; height: 26px; border-radius: 7px; }
.topbar-actions { display: flex; align-items: center; gap: 2px; }
.icon-btn {
  border: 0; background: transparent; cursor: pointer; width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 11px; color: var(--muted); transition: background .15s, color .15s;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.on { background: var(--accent-soft); color: var(--accent); }
.sync-status { font-size: 12px; color: var(--muted); margin-right: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 440px) { .sync-status { display: none; } .topbar { padding-left: 12px; padding-right: 8px; } }

/* ---------- 세그먼트 탭 ---------- */
.tabs { display: flex; gap: 3px; padding: 4px; margin: 14px 16px 6px; background: var(--surface-2); border-radius: 14px; }
.tab {
  flex: 1; padding: 9px; border: 0; background: transparent; border-radius: 11px; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .18s, color .18s, box-shadow .18s;
}
.tab svg { width: 17px; height: 17px; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tab.active svg { color: var(--accent); }

.view { padding: 12px 16px; }
.empty { text-align: center; color: var(--muted); padding: 56px 0; font-size: 14px; }

/* ---------- 할 일 ---------- */
.todo-add { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.todo-add input#todo-input {
  flex: 1 1 160px; padding: 13px 15px; border: 1px solid var(--border-strong); border-radius: 13px;
  font-size: 15px; background: var(--surface); color: var(--text); outline: none; transition: border-color .15s;
}
.todo-add input#todo-input:focus { border-color: var(--accent); }
.todo-add input#todo-due {
  padding: 11px; border: 1px solid var(--border-strong); border-radius: 13px; background: var(--surface);
  color: var(--muted); font-size: 13px; outline: none;
}
.todo-add button {
  padding: 0 20px; border: 0; border-radius: 13px; background: var(--accent);
  color: var(--accent-ink); font-weight: 700; cursor: pointer; transition: background .15s;
}
.todo-add button:hover { background: var(--accent-hover); }
.todo-list { display: flex; flex-direction: column; gap: 8px; }
.todo-item {
  display: flex; align-items: center; gap: 13px; padding: 14px 15px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); transition: opacity .2s;
}
.todo-item.done { opacity: .62; }
.todo-item.done .todo-title { text-decoration: line-through; text-decoration-color: var(--muted); color: var(--muted); }
.todo-check {
  width: 23px; height: 23px; border-radius: 50%; border: 2px solid var(--border-strong);
  cursor: pointer; flex-shrink: 0; display: grid; place-items: center; background: transparent;
  color: transparent; font-size: 13px; transition: .15s;
}
.todo-check:hover { border-color: var(--accent); }
.todo-check svg { width: 13px; height: 13px; }
.todo-item.done .todo-check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.todo-main { flex: 1; min-width: 0; }
.todo-title { font-size: 15px; word-break: break-word; }
.todo-title.important::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); margin-right: 7px; vertical-align: middle; }
.todo-due { font-size: 12.5px; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 5px; }
.todo-due svg { width: 13px; height: 13px; }
.todo-due.overdue { color: var(--danger); font-weight: 600; }
.todo-del, .todo-star { border: 0; background: transparent; cursor: pointer; padding: 6px; color: var(--muted);
  border-radius: 9px; line-height: 1; transition: .15s; display: grid; place-items: center; }
.todo-del svg, .todo-star svg { width: 18px; height: 18px; }
.todo-del:hover { color: var(--danger); background: var(--surface-2); }
.todo-star { color: var(--border-strong); }
.todo-star:hover { color: var(--muted); }
.todo-star.on { color: var(--accent); }
.todo-star.on svg { fill: var(--accent); }

/* ---------- 메모 상단 ---------- */
.notes-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.search-wrap { flex: 1; display: flex; align-items: center; gap: 9px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 13px; padding: 0 13px; transition: border-color .15s; }
.search-wrap:focus-within { border-color: var(--accent); }
.search-ico { display: grid; place-items: center; color: var(--muted); }
.search-ico svg { width: 17px; height: 17px; }
#note-search, #global-search, #link-global-search, #link-search { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font-size: 15px; padding: 12px 0; outline: none; }
#view-toggle { border: 1px solid var(--border-strong); }

/* 메모 레이아웃: 좌측 폴더 사이드바 + 우측 목록 */
.notes-layout { display: flex; gap: 18px; align-items: flex-start; }
.folder-sidebar { width: 188px; flex-shrink: 0; display: flex; flex-direction: column; gap: 1px;
  position: sticky; top: 118px; }
.notes-main { flex: 1; min-width: 0; }
.sidebar-title { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); padding: 2px 10px 8px; }
.folder-row { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 10px;
  cursor: pointer; color: var(--text); font-size: 14px; font-weight: 500; position: relative; }
.folder-row:hover { background: var(--surface-2); }
.folder-row.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.folder-row.drop { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.folder-row .fr-ico { display: grid; place-items: center; color: var(--muted); flex-shrink: 0; }
.folder-row.active .fr-ico { color: var(--accent); }
.folder-row .fr-ico svg { width: 17px; height: 17px; }
.folder-row .fr-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-row .fr-more { opacity: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 3px; border-radius: 6px; display: grid; place-items: center; flex-shrink: 0; }
.folder-row:hover .fr-more { opacity: .75; }
.folder-row .fr-more:hover { background: var(--border); opacity: 1; }
.folder-row .fr-more svg { width: 16px; height: 16px; }
.folder-add { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 9px 10px; border: 0;
  background: transparent; color: var(--accent); font-size: 14px; font-weight: 600; cursor: pointer; border-radius: 10px; }
.folder-add:hover { background: var(--surface-2); }
.folder-add svg { width: 15px; height: 15px; }
.only-narrow { display: none; }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.42); z-index: 44; }

/* 좁은 화면(폰/접힘): 사이드바를 서랍(drawer)으로 */
@media (max-width: 640px) {
  .notes-layout { display: block; }
  .only-narrow { display: grid; }
  .folder-sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 250px; max-width: 82vw; z-index: 46;
    background: var(--surface); border-right: 1px solid var(--border);
    padding: max(16px, env(safe-area-inset-top)) 12px 16px; gap: 1px;
    transform: translateX(-104%); transition: transform .22s ease; overflow-y: auto; }
  .folder-sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
}

/* 메모 카드 */
.note-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
.note-card {
  background: var(--note-default); border: 1px solid var(--border); border-radius: 18px;
  padding: 15px 16px; cursor: pointer; min-height: 96px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 7px; position: relative; overflow: hidden;
  transition: transform .12s ease, box-shadow .15s ease;
  touch-action: pan-y; -webkit-user-select: none; user-select: none;
}
.note-card.dragging { opacity: .45; }
.note-card.will-delete { box-shadow: inset 0 0 0 2px var(--danger); }
.note-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.note-card[data-color=yellow] { background: var(--note-yellow); border-color: transparent; }
.note-card[data-color=green]  { background: var(--note-green); border-color: transparent; }
.note-card[data-color=blue]   { background: var(--note-blue); border-color: transparent; }
.note-card[data-color=pink]   { background: var(--note-pink); border-color: transparent; }
.note-card[data-color=purple] { background: var(--note-purple); border-color: transparent; }
.note-card .n-title { font-weight: 700; font-size: 15px; word-break: break-word; letter-spacing: -.01em; }
.note-card .n-body { font-size: 13px; color: var(--muted); white-space: pre-wrap; line-height: 1.55;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; }
.note-card .n-folder { font-size: 11px; font-weight: 600; color: var(--muted); background: color-mix(in srgb, var(--text) 7%, transparent);
  align-self: flex-start; padding: 3px 9px; border-radius: 8px; }
.note-card .pin { position: absolute; top: 11px; right: 12px; font-size: 12px; opacity: .8; }

/* 목록 보기 */
.note-grid.list { grid-template-columns: 1fr; gap: 8px; }
.note-grid.list .note-card { min-height: 0; flex-direction: row; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; }
.note-grid.list .note-card:hover { transform: none; }
.note-grid.list .note-card .n-folder { order: -1; }
.note-grid.list .note-card .n-body { -webkit-line-clamp: 1; flex: 1; }

/* 플로팅 버튼 */
.fab { position: fixed; right: max(20px, calc(50% - 340px)); bottom: 24px; width: 56px; height: 56px;
  border-radius: 18px; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 28px; line-height: 1;
  cursor: pointer; box-shadow: var(--shadow-lg); z-index: 20; display: grid; place-items: center; transition: transform .12s, background .15s; }
.fab:hover { background: var(--accent-hover); transform: translateY(-2px); }
.fab:active { transform: scale(.94); }

/* ---------- 전체화면 에디터 ---------- */
.editor { position: fixed; inset: 0; background: var(--bg); z-index: 60; display: flex; flex-direction: column; }
.editor-top { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); border-bottom: 1px solid var(--border); }
.ed-back { border: 0; background: transparent; color: var(--accent); font-size: 15px; font-weight: 600;
  cursor: pointer; padding: 8px 8px 8px 4px; display: flex; align-items: center; gap: 2px; border-radius: 10px; }
.ed-back svg { width: 20px; height: 20px; }
.ed-back:hover { background: var(--surface-2); }
.editor-top-actions { display: flex; align-items: center; gap: 2px; }
.chip-btn { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 20px; padding: 7px 13px;
  font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; display: flex; align-items: center; gap: 6px;
  max-width: 150px; }
.chip-btn svg { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }
.chip-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.editor-body { flex: 1; overflow-y: auto; padding: 20px 20px 120px; max-width: 720px; width: 100%; margin: 0 auto; }
.ed-title { width: 100%; border: 0; background: transparent; color: var(--text); font-size: 25px;
  font-weight: 800; outline: none; padding: 4px 0; letter-spacing: -.02em; }
.ed-title::placeholder { color: var(--border-strong); }
.ed-date { font-size: 12.5px; color: var(--muted); padding: 4px 0 2px; font-variant-numeric: tabular-nums; }
.ed-content { min-height: 320px; outline: none; font-size: 16px; line-height: 1.75; color: var(--text); padding-top: 10px; }
.ed-content:empty::before { content: attr(data-ph); color: var(--muted); }
.ed-content h1 { font-size: 21px; font-weight: 800; margin: 14px 0 6px; letter-spacing: -.01em; }
.ed-content h2 { font-size: 18px; font-weight: 700; margin: 12px 0 4px; }
.ed-content p { margin: 5px 0; }
.ed-content ul, .ed-content ol { margin: 6px 0; padding-left: 26px; }
.ed-content li { margin: 3px 0; }
.ed-content mark, .ed-content span[style*="background"] { border-radius: 3px; padding: 0 2px; }
.ed-content mark { background: #ffe08a; color: #201d18; }

/* ===== 형광펜/글자색 색상 토큰 (라이트 기본) ===== */
:root {
  --hl-yellow:#fde68a; --hl-green:#bbf7d0; --hl-blue:#bfdbfe; --hl-pink:#fbcfe8; --hl-orange:#fed7aa; --hl-purple:#e9d5ff;
  --tc-red:#dc2626; --tc-orange:#ea580c; --tc-yellow:#b45309; --tc-green:#15803d; --tc-blue:#2563eb; --tc-purple:#9333ea; --tc-gray:#6b7280;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --hl-yellow:rgba(250,204,21,.30); --hl-green:rgba(74,222,128,.28); --hl-blue:rgba(96,165,250,.32);
    --hl-pink:rgba(244,114,182,.30); --hl-orange:rgba(251,146,60,.30); --hl-purple:rgba(192,132,252,.32);
    --tc-red:#f87171; --tc-orange:#fb923c; --tc-yellow:#fbbf24; --tc-green:#4ade80; --tc-blue:#60a5fa; --tc-purple:#c084fc; --tc-gray:#9ca3af;
  }
}
:root[data-theme="dark"] {
  --hl-yellow:rgba(250,204,21,.30); --hl-green:rgba(74,222,128,.28); --hl-blue:rgba(96,165,250,.32);
  --hl-pink:rgba(244,114,182,.30); --hl-orange:rgba(251,146,60,.30); --hl-purple:rgba(192,132,252,.32);
  --tc-red:#f87171; --tc-orange:#fb923c; --tc-yellow:#fbbf24; --tc-green:#4ade80; --tc-blue:#60a5fa; --tc-purple:#c084fc; --tc-gray:#9ca3af;
}
/* 형광펜 */
.hl { border-radius: 3px; padding: 0 .12em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.hl-yellow { background: var(--hl-yellow); } .hl-green { background: var(--hl-green); }
.hl-blue { background: var(--hl-blue); } .hl-pink { background: var(--hl-pink); }
.hl-orange { background: var(--hl-orange); } .hl-purple { background: var(--hl-purple); }
/* 글자색 */
.tc-red { color: var(--tc-red); } .tc-orange { color: var(--tc-orange); } .tc-yellow { color: var(--tc-yellow); }
.tc-green { color: var(--tc-green); } .tc-blue { color: var(--tc-blue); } .tc-purple { color: var(--tc-purple); } .tc-gray { color: var(--tc-gray); }

/* ===== 인용구 / 코드 / 표 ===== */
.ed-content blockquote { margin: 10px 0; padding: 6px 14px; border-left: 3px solid var(--accent);
  background: var(--surface-2); border-radius: 0 8px 8px 0; color: var(--text); }
.ed-content code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }
.ed-content pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; overflow-x: auto; margin: 10px 0; }
.ed-content pre code { background: none; border: 0; padding: 0; display: block; white-space: pre-wrap; word-break: break-word; }
.ed-content .ed-table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: .95em; }
.ed-content .ed-table td, .ed-content .ed-table th { border: 1px solid var(--border-strong);
  padding: 7px 9px; min-width: 38px; vertical-align: top; }
.ed-content .ed-table td:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.ed-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

/* 체크리스트 */
.ed-content .cl { display: flex; align-items: flex-start; gap: 11px; margin: 5px 0; }
.ed-content .cl > .cl-box { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--border-strong); margin-top: 2px; cursor: pointer; display: grid; place-items: center;
  color: transparent; font-size: 12px; user-select: none; transition: .15s; }
.ed-content .cl > .cl-box:hover { border-color: var(--accent); }
.ed-content .cl[data-checked="1"] > .cl-box { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ed-content .cl[data-checked="1"] > .cl-text { text-decoration: line-through; text-decoration-color: var(--muted); color: var(--muted); }
.ed-content .cl > .cl-text { flex: 1; outline: none; }

/* 서식 툴바 */
.editor-toolbar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 2px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px); border-top: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.editor-toolbar::-webkit-scrollbar { display: none; }
.tb { flex-shrink: 0; min-width: 40px; height: 40px; border: 0; background: transparent; color: var(--text);
  font-size: 16px; border-radius: 10px; cursor: pointer; transition: background .12s, color .12s; }
.tb:hover { background: var(--surface-2); }
.tb.on { background: var(--accent-soft); color: var(--accent); }
.tb-sep { width: 1px; height: 22px; background: var(--border); margin: 0 5px; flex-shrink: 0; }

/* 팝오버 */
.pop { position: absolute; background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 10px; z-index: 70; display: flex; gap: 7px; flex-wrap: wrap; }
.pop button { border: 0; background: var(--surface-2); color: var(--text); border-radius: 10px; padding: 10px 15px;
  cursor: pointer; font-size: 14px; font-weight: 600; transition: .12s; }
.pop button:not(.swatch):not(.ghost-btn):not(.primary-btn):hover { background: var(--accent-soft); color: var(--accent); }

/* 글자색 툴바 버튼 */
.tb-tc { position: relative; }
.tb-tc b { display: block; line-height: 1; }
.tb-tc-bar { position: absolute; left: 9px; right: 9px; bottom: 7px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--tc-red), var(--tc-yellow), var(--tc-green), var(--tc-blue), var(--tc-purple)); }

/* 형광펜/글자색 스와치 팝오버 */
.swatch-pop { max-width: 232px; }
.swatch { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2);
  cursor: pointer; padding: 0; display: grid; place-items: center; font-weight: 800; font-size: 15px; transition: transform .1s; }
.swatch:hover { transform: scale(1.12); }
.swatch-none { color: var(--muted); font-size: 13px; }

/* 표 크기 그리드 피커 */
.table-pop { flex-direction: column; align-items: center; gap: 8px; }
.tbl-grid { display: grid; grid-template-columns: repeat(6, 20px); grid-auto-rows: 20px; gap: 4px; }
.tbl-cell { width: 20px; height: 20px; border: 1px solid var(--border-strong); border-radius: 4px;
  background: var(--surface-2); cursor: pointer; }
.tbl-cell.on { background: var(--accent-soft); border-color: var(--accent); }
.tbl-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* 정렬 팝오버 */
.align-pop button { min-width: 42px; font-size: 17px; }

/* 링크 팝오버 */
.link-pop { flex-direction: column; align-items: stretch; gap: 8px; width: min(320px, 82vw); }
.link-pop input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text); font-size: 14px; font-family: inherit; }
.link-pop-row { display: flex; gap: 6px; justify-content: flex-end; }

.color-dot { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 2px solid var(--border); transition: transform .1s; }
.color-dot:hover { transform: scale(1.12); }
.color-dot.sel { border-color: var(--text); border-width: 3px; }
.folder-pop { flex-direction: column; max-width: 240px; min-width: 180px; }
.folder-pop input { border: 1px solid var(--border-strong); background: var(--bg); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font-size: 14px; outline: none; width: 100%; }
.folder-pop input:focus { border-color: var(--accent); }
.folder-pop .fp-item { text-align: left; width: 100%; background: transparent; }
.folder-pop .fp-item:hover { background: var(--surface-2); }

/* ---------- 설정 시트 ---------- */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 80; display: flex;
  align-items: flex-end; justify-content: center; padding: 0; }
@media (min-width: 560px){ .sheet { align-items: center; padding: 20px; } }
.sheet-card { background: var(--surface); width: 100%; max-width: 460px; border-radius: 24px 24px 0 0;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg);
  max-height: 88dvh; overflow-y: auto; }
@media (min-width: 560px){ .sheet-card { border-radius: 24px; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h3 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.sheet-label { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); margin: 16px 2px 10px; }
.theme-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.theme-row { display: flex; align-items: center; gap: 10px; padding: 10px 11px; border-radius: 13px;
  border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; text-align: left;
  transition: border-color .15s, background .15s; min-width: 0; position: relative; }
.theme-row:hover { background: var(--surface-2); }
.theme-row.sel { border-color: var(--accent); background: var(--accent-soft); }
.theme-meta { flex: 1; min-width: 0; }
.theme-meta b { display: block; font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-meta span { display: block; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-check { position: absolute; top: 6px; right: 6px; color: var(--accent); opacity: 0; }
.theme-row.sel .theme-check { opacity: 1; }
.theme-check svg { width: 16px; height: 16px; }
.mode-seg { display: flex; gap: 3px; padding: 4px; background: var(--surface-2); border-radius: 13px; }
.mode-seg button { flex: 1; padding: 10px; border: 0; background: transparent; border-radius: 10px;
  font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; transition: .15s; }
.mode-seg button.sel { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.sheet-action { display: flex; align-items: center; gap: 10px; width: 100%; padding: 13px 14px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); border-radius: 13px; font-size: 15px; font-weight: 600; cursor: pointer; }
.sheet-action:hover { background: var(--surface-2); }
.sheet-action svg { width: 20px; height: 20px; color: var(--accent); }
.sheet-hint { font-size: 12.5px; color: var(--muted); margin: 8px 2px 0; }
.font-custom { margin-top: 8px; }
#font-clear { margin-top: 6px; width: 100%; padding: 9px; border: 1px solid var(--border); background: transparent;
  color: var(--muted); border-radius: 11px; font-size: 13px; font-weight: 600; cursor: pointer; }
#font-clear:hover { background: var(--surface-2); color: var(--text); }

/* 기기 미리보기 */
.device-preview { position: fixed; inset: 0; background: var(--bg); z-index: 200; display: flex; flex-direction: column; }
.dp-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px; border-bottom: 1px solid var(--border); }
.dp-modes { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; }
.dp-modes button { border: 0; background: transparent; padding: 8px 15px; border-radius: 9px; font-size: 14px;
  font-weight: 600; color: var(--muted); cursor: pointer; }
.dp-modes button.sel { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.dp-size { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; margin-left: auto; }
.dp-close { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); padding: 9px 18px;
  border-radius: 11px; font-weight: 600; cursor: pointer; }
.dp-stage { flex: 1; display: grid; place-items: center; overflow: hidden; padding: 16px; }
.dp-frame { border: 1px solid var(--border-strong); border-radius: 26px; overflow: hidden; box-shadow: var(--shadow-lg);
  transform-origin: center center; flex-shrink: 0; background: var(--bg); }
.dp-frame iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--bg); }

/* ---------- 컨텍스트 메뉴(우클릭/롱프레스) ---------- */
.ctx-menu { position: fixed; z-index: 95; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 190px; max-height: 60dvh; overflow-y: auto; }
.ctx-menu button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 12px; border: 0;
  background: transparent; color: var(--text); border-radius: 10px; font-size: 14px; font-weight: 500;
  cursor: pointer; text-align: left; }
.ctx-menu button:hover { background: var(--surface-2); }
.ctx-menu button.danger { color: var(--danger); }
.ctx-menu button svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.ctx-menu .ctx-sep { height: 1px; background: var(--border); margin: 5px 6px; }
.ctx-menu .ctx-title { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); padding: 6px 12px 4px; }

/* 토스트 */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(8px);
  background: var(--text); color: var(--bg); padding: 11px 20px; border-radius: 22px;
  font-size: 14px; font-weight: 500; z-index: 100; box-shadow: var(--shadow-lg);
}

/* ============ 폴더 색/구분선/재정렬 ============ */
.folder-row .fdot { width: 13px; height: 13px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.folder-row.dragging { opacity: .5; }
.folder-row.reorder-over { box-shadow: inset 0 2px 0 var(--accent); }
.folder-divider { height: 0; border-top: 1px solid var(--border-strong); margin: 8px 12px; }
.folder-trash { margin-top: 6px; }

/* ============ 날짜별 모아보기 ============ */
#note-grid.grouped { display: block; }
.note-group { margin-bottom: 20px; }
.note-group-title { font-size: 13px; font-weight: 700; color: var(--muted); margin: 4px 2px 10px; }
.note-grid-inner { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
.note-grid-inner.list { grid-template-columns: 1fr; gap: 8px; }
.note-grid-inner.list .note-card { flex-direction: row; align-items: center; min-height: 0; }

/* ============ 복수 선택 ============ */
.note-card .sel-check { position: absolute; top: 10px; left: 10px; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--border-strong); background: var(--surface); z-index: 2; }
.note-card.selected { box-shadow: inset 0 0 0 2px var(--accent); }
.note-card.selected .sel-check { background: var(--accent); border-color: var(--accent); }
.note-card.selected .sel-check::after { content: "✓"; color: var(--accent-ink); font-size: 13px; line-height: 18px;
  display: block; text-align: center; }
.n-trash-info { font-size: 11px; color: var(--danger); font-weight: 600; margin-top: 4px; }

.select-bar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 90;
  display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); border-radius: 16px; padding: 10px 14px; max-width: 92vw; }
.select-bar .sb-count { font-size: 14px; font-weight: 700; white-space: nowrap; }
.select-bar .sb-cancel { border: 0; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; font-size: 14px; }
.select-bar .sb-actions { display: flex; gap: 8px; }
.sb-btn { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: 10px;
  padding: 8px 14px; font-weight: 600; cursor: pointer; font-size: 14px; white-space: nowrap; }
.sb-btn.danger { color: var(--danger); border-color: transparent; background: color-mix(in srgb, var(--danger) 14%, transparent); }

/* ============ 컨텍스트 메뉴 색상 줄 ============ */
.ctx-colors { display: flex; gap: 7px; padding: 6px 10px 8px; flex-wrap: wrap; }
.ctx-menu .ctx-color { width: 24px; height: 24px; min-width: 0; padding: 0; border-radius: 50%;
  border: 2px solid var(--border); cursor: pointer; flex: 0 0 auto; }
.ctx-menu .ctx-color:hover { background: initial; }
.ctx-menu .ctx-color.sel { border-color: var(--text); border-width: 3px; }

/* ============ 폴더 만들기 / 할 일 상세 ============ */
.fd-name { width: 100%; padding: 13px 14px; border: 1px solid var(--border-strong); border-radius: 12px;
  font-size: 16px; background: var(--bg); color: var(--text); outline: none; }
.fd-name:focus { border-color: var(--accent); }
.fd-colors { display: flex; gap: 10px; flex-wrap: wrap; }
.fd-colors .color-dot { width: 32px; height: 32px; }
.modal-buttons { display: flex; gap: 8px; }
.tm-detail { width: 100%; min-height: 120px; padding: 12px 14px; border: 1px solid var(--border-strong);
  border-radius: 12px; font-size: 15px; background: var(--bg); color: var(--text); outline: none; resize: vertical;
  font-family: inherit; line-height: 1.6; box-sizing: border-box; }
.tm-detail:focus { border-color: var(--accent); }
.tm-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 2px; }
.tm-row label { font-size: 14px; font-weight: 600; color: var(--muted); }
.tm-row input[type=datetime-local] { border: 1px solid var(--border-strong); background: var(--bg); color: var(--text);
  border-radius: 10px; padding: 9px 12px; font-size: 14px; outline: none; }
.tm-toggle { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 10px; padding: 8px 14px;
  cursor: pointer; font-size: 16px; opacity: .4; }
.tm-toggle.on { opacity: 1; background: var(--accent-soft); border-color: var(--accent); }

/* ============ 할 일 도구 / 상세 미리보기 ============ */
.todo-tools { display: flex; justify-content: flex-end; margin-bottom: 10px; }
#todo-sort-btn { display: inline-flex; align-items: center; gap: 6px; }
#todo-sort-btn svg { width: 15px; height: 15px; color: var(--muted); }
.todo-detail-prev { font-size: 12.5px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-main { cursor: pointer; }

/* ============ 갤러리(그리드) 카드 균일 높이 ============ */
.note-grid:not(.list) .note-card,
.note-grid-inner:not(.list) .note-card { height: 152px; }
.note-grid:not(.list) .note-card .n-title,
.note-grid-inner:not(.list) .note-card .n-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note-grid:not(.list) .note-card .n-body,
.note-grid-inner:not(.list) .note-card .n-body { -webkit-line-clamp: 2; }
.fr-lock { font-size: 11px; opacity: .7; margin-left: auto; }
.folder-row.active .fr-ico { color: var(--accent); }

/* ============ 잠금(비밀번호) ============ */
.pw-card { max-width: 360px; }
.pw-card h3 { margin: 0 0 6px; font-size: 19px; font-weight: 800; }
.pw-sub { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); }
.pw-card .login-err { text-align: left; }
.locked-hint { color: var(--muted); font-style: italic; }

/* ============ 폴더 홈(드릴다운) ============ */
#folder-home-list { display: flex; flex-direction: column; gap: 8px; }
.fh-row { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.fh-row:hover { background: var(--surface-2); }
.fh-row .fr-ico { display: grid; place-items: center; color: var(--muted); flex-shrink: 0; }
.fh-row .fr-ico svg { width: 22px; height: 22px; }
.fh-row .fr-name { flex: 1; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fh-row .fr-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fh-row .fr-chevron { display: grid; place-items: center; color: var(--border-strong); }
.fh-row .fr-chevron svg { width: 18px; height: 18px; }
.fh-row .fr-more { opacity: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 8px; display: grid; place-items: center; }
.fh-row:hover .fr-more { opacity: .8; }
.fh-row .fr-more:hover { background: var(--border); opacity: 1; }
.fh-row .fr-more svg { width: 18px; height: 18px; }
.fh-row .fr-lock { font-size: 12px; opacity: .7; }
.fh-row.reorder-over { box-shadow: inset 0 3px 0 var(--accent); }
.fh-row.drop { box-shadow: inset 0 0 0 2px var(--accent); }
.fh-row.dragging { opacity: .5; }
.fh-trash { margin-top: 6px; }
#folder-home .folder-add { margin: 4px 0; }
#folder-home-list .folder-divider { height: 0; border-top: 1px solid var(--border-strong); margin: 6px 14px; }

/* ============ notes-view 헤더 ============ */
.notes-folder-title { font-size: 17px; font-weight: 800; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nh-spacer { flex: 1; }
#notes-back { flex-shrink: 0; }
.search-row { margin-bottom: 12px; }

/* ============ 할 일 태그 칩 바 ============ */
.chip-bar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; scrollbar-width: none; }
.chip-bar::-webkit-scrollbar { display: none; }
.tag-chip { flex-shrink: 0; padding: 7px 14px; border: 1px solid var(--border-strong); background: var(--surface);
  border-radius: 20px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tag-chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tag-chip.add { color: var(--accent); border-style: dashed; display: inline-flex; align-items: center; gap: 5px; }
.tag-chip.add svg { width: 13px; height: 13px; }

/* ============ 할 일: 추가 폼 하단 고정 ============ */
#view-todos { display: flex; flex-direction: column; min-height: calc(100dvh - 140px); }
.todo-list { flex: 1 0 auto; }
.todo-add { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  margin-top: 12px; border-top: 1px solid var(--border); z-index: 5; }
.todo-tools { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-bottom: 10px; }

/* ============ 할 일 태그/복수선택 ============ */
.todo-tag { display: inline-block; font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 7px; margin-top: 4px; }
.todo-item.selected { box-shadow: inset 0 0 0 2px var(--accent); }
.todo-item.selected .todo-check { background: var(--accent); border-color: var(--accent); }
.todo-item.selected .todo-check::after { content: "✓"; color: var(--accent-ink); font-size: 12px; font-weight: 700; }

/* 상세 모달 만든날짜 */
.tm-created { font-size: 12px; color: var(--muted); margin: 12px 2px 0; text-align: center; }

/* 선택 바: 좁은 화면에서 압축 */
.select-bar .sb-cancel { white-space: nowrap; }
@media (max-width: 460px) {
  .select-bar { gap: 8px; padding: 9px 10px; }
  .select-bar .sb-actions { gap: 6px; }
  .sb-btn { padding: 8px 10px; font-size: 13px; }
  .select-bar .sb-count { font-size: 13px; }
}

/* 메모 카드 폴더 태그: 폴더 색 반영 */
.n-folder { display: inline-flex; align-items: center; gap: 4px; }
.n-folder .nf-ico { display: grid; place-items: center; }
.n-folder .nf-ico svg { width: 12px; height: 12px; }

/* 구분선: 탭 영역 확보(모바일 롱프레스용) */
.folder-divider { border: 0 !important; height: auto !important; padding: 7px 14px; margin: 2px 0 !important; cursor: pointer; }
.folder-divider::before { content: ''; display: block; border-top: 1px solid var(--border-strong); }

/* 모바일(호버 없음): 폴더 ⋯ 버튼 항상 보이게 */
@media (hover: none) {
  .fh-row .fr-more { opacity: .55; }
  .fh-row .fr-more:active { opacity: 1; background: var(--border); }
}

/* ============ 다이얼로그 버튼 통일(모던) ============ */
.primary-btn { padding: 12px 20px; border: 0; border-radius: 12px; background: var(--accent);
  color: var(--accent-ink); font-weight: 700; font-size: 15px; cursor: pointer; transition: background .15s; }
.primary-btn:hover { background: var(--accent-hover); }
.ghost-btn { padding: 12px 18px; border: 0; border-radius: 12px; background: var(--surface-2);
  color: var(--text); font-weight: 600; font-size: 15px; cursor: pointer; transition: background .15s; }
.ghost-btn:hover { background: var(--border); }
.danger-btn { padding: 12px 18px; border: 0; border-radius: 12px; background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger); font-weight: 700; font-size: 15px; cursor: pointer; transition: background .15s; }
.danger-btn:hover { background: color-mix(in srgb, var(--danger) 22%, transparent); }
.modal-buttons { display: flex; gap: 10px; }

/* 가져오기 다이얼로그 */
.imp-or { text-align: center; font-size: 12px; color: var(--muted); margin: 16px 0 8px; }
.imp-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-top: 10px; cursor: pointer; }
.imp-check input { width: 16px; height: 16px; accent-color: var(--accent); }
#imp-text { margin-top: 2px; min-height: 140px; }

/* 테마 미리보기(라이브 시안) */
.theme-prev { width: 58px; height: 46px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center;
  border: 1px solid rgba(128,128,128,.22); overflow: hidden; }
.tp-card { width: 40px; height: 32px; border-radius: 7px; padding: 6px; display: flex; flex-direction: column;
  justify-content: center; gap: 3px; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.tp-dot { width: 11px; height: 11px; border-radius: 50%; margin-bottom: 2px; }
.tp-line { height: 3px; border-radius: 2px; opacity: .85; }
.tp-line.short { width: 60%; opacity: .45; }
.theme-row { color: var(--text); }

/* 동기화 상태 점 (초록=완료) */
.sync-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }

/* 폴더 홈 섹션 제목(즐겨찾기/폴더) */
.fh-section-title { font-size: 12px; font-weight: 700; letter-spacing: .03em; color: var(--muted); margin: 14px 4px 8px; }
.fh-fav { margin-bottom: 4px; }

/* 메모 카드 배지(즐겨찾기/고정/잠금) */
.n-badges { position: absolute; top: 10px; right: 11px; font-size: 12px; display: flex; gap: 2px; line-height: 1; }
/* 할 일 중요 아이콘(맨 앞) */
.todo-imp { flex-shrink: 0; font-size: 15px; line-height: 1; }

/* 입장 비밀번호 변경 (설정) */
.entry-pw { display: flex; flex-direction: column; gap: 8px; }
.entry-pw input { width: 100%; padding: 11px 13px; border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 11px; font-size: 14px; color: var(--text); font-family: inherit; }
.entry-pw input:focus { outline: none; border-color: var(--accent); }
.entry-pw .primary-btn { margin-top: 2px; align-self: flex-start; }

/* ==================== 링크(딸깍) ==================== */
.chip { flex-shrink: 0; padding: 7px 14px; border: 1px solid var(--border-strong); background: var(--surface);
  border-radius: 20px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.link-add { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.link-add-row { display: flex; gap: 8px; }
.link-add-row input { flex: 1; min-width: 0; padding: 12px 14px; border: 1px solid var(--border-strong);
  background: var(--surface); border-radius: 12px; font-size: 15px; color: var(--text); font-family: inherit; }
.link-add-row input:focus { border-color: var(--accent); outline: none; }
.link-add-row button { flex-shrink: 0; padding: 0 18px; border: 0; border-radius: 12px; background: var(--accent);
  color: var(--accent-ink); font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit; }
.link-add-row button:hover { background: var(--accent-hover); }
.link-memo-input { width: 100%; padding: 10px 14px; border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 12px; font-size: 14px; color: var(--text); font-family: inherit; }
.link-memo-input:focus { border-color: var(--accent); outline: none; }

.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.link-card { position: relative; display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px; overflow: hidden; cursor: pointer; transition: transform .12s, box-shadow .12s; }
.link-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.lc-thumb { width: 100%; aspect-ratio: 1.9 / 1; background: var(--surface-2); overflow: hidden; }
.lc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lc-thumb.noimg { display: flex; align-items: center; justify-content: center; }
.lc-thumb.noimg::after { content: "🔗"; font-size: 26px; opacity: .35; }
.lc-body { padding: 11px 13px 13px; display: flex; flex-direction: column; gap: 4px; }
.lc-title { font-size: 14.5px; font-weight: 700; color: var(--text); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lc-desc { font-size: 12.5px; color: var(--muted); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lc-meta { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.lc-fav { width: 15px; height: 15px; border-radius: 4px; flex-shrink: 0; object-fit: cover; }
.lc-site { font-size: 11.5px; color: var(--muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-folder { font-size: 11px; color: var(--accent); background: var(--accent-soft); padding: 2px 7px; border-radius: 6px;
  font-weight: 600; white-space: nowrap; flex-shrink: 0; margin-left: auto; }
.lc-more { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border: 0; border-radius: 9px;
  background: color-mix(in srgb, var(--surface) 78%, transparent); backdrop-filter: blur(6px); color: var(--text);
  cursor: pointer; display: grid; place-items: center; opacity: .85; }
.lc-more:hover { background: var(--surface-2); opacity: 1; }
.lc-more svg { width: 18px; height: 18px; }

.lm-memo { width: 100%; min-height: 90px; resize: vertical; padding: 11px 13px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface-2); color: var(--text); font-size: 14px; font-family: inherit; line-height: 1.5; }
.lm-memo:focus { outline: none; border-color: var(--accent); }
.lm-newfolder { flex-shrink: 0; padding: 7px 12px; border: 1px dashed var(--border-strong); background: transparent;
  border-radius: 20px; font-size: 13px; color: var(--text); font-family: inherit; width: 120px; }
#lm-folders { flex-wrap: wrap; }

/* 링크 폴더 추가 다이얼로그 */
.lfd-name { width: 100%; padding: 12px 14px; border: 1px solid var(--border-strong); background: var(--surface-2);
  border-radius: 12px; font-size: 15px; color: var(--text); font-family: inherit; }
.lfd-name:focus { outline: none; border-color: var(--accent); }
.lfd-actions { display: flex; gap: 8px; margin-top: 14px; }
.lfd-actions button { flex: 1; }

/* 링크 저장(공유) 다이얼로그 */
.lsd-preview { display: flex; gap: 11px; align-items: center; border: 1px solid var(--border); border-radius: 12px;
  padding: 10px; background: var(--surface-2); min-height: 62px; margin-bottom: 4px; }
.lsd-preview img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.lsd-p-body { min-width: 0; }
.lsd-p-title { font-weight: 700; font-size: 14px; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lsd-p-site { font-size: 12px; color: var(--muted); margin-top: 3px; }
.lsd-loading { color: var(--muted); font-size: 13px; padding: 8px 2px; }
.lsd-save-btn { width: 100%; margin-top: 14px; }
#lsd-folders, #lm-folders { flex-wrap: wrap; }

/* 본문 삽입 링크 카드(에디터) */
.ed-content .embed-card { display: flex; gap: 10px; border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; margin: 10px 0; text-decoration: none; background: var(--surface); max-width: 420px; }
.ed-content .embed-card img { width: 96px; height: 96px; object-fit: cover; flex-shrink: 0; }
.ed-content .embed-card .ec-body { padding: 9px 11px; min-width: 0; }
.ed-content .embed-card .ec-title { font-weight: 700; font-size: 14px; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ed-content .embed-card .ec-site { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
