/* 두번째 뇌 — 옵시디언 기본 테마를 본뜬 모양 */
:root {
  --font-ui: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Inter", sans-serif;
  --font-text: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Inter", sans-serif;
  --font-mono: "SF Mono", Menlo, ui-monospace, monospace;
  --editor-font-size: 16px;
  --line-width: 720px;
  --ribbon: 44px; --left-w: 260px; --right-w: 280px; --top: 40px;
}
[data-theme="dark"] {
  --bg: #1e1e1e; --bg-secondary: #262626; --bg-alt: #2a2a2a; --bg-hover: #2f2f2f; --border: #363636;
  --text: #dadada; --text-muted: #a3a3a3; --text-faint: #666; --accent: #8a6cf0; --accent-soft: rgba(138,108,240,.18);
  --link: #a58cff; --unresolved: #7d6eb8; --tag-bg: rgba(138,108,240,.15); --tag-text: #b7a6ff;
  --code-bg: #262626; --code-text: #e59cbf; --highlight: rgba(255,208,0,.28); --selection: rgba(138,108,240,.35);
  --graph-node: #9a9a9a; --graph-tag: #6a8f6a; --graph-line: #444; --shadow: 0 10px 30px rgba(0,0,0,.45);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #ffffff; --bg-secondary: #f6f6f6; --bg-alt: #efefef; --bg-hover: #e9e9e9; --border: #e0e0e0;
  --text: #222; --text-muted: #5c5c5c; --text-faint: #ababab; --accent: #7350e8; --accent-soft: rgba(115,80,232,.12);
  --link: #6a48e0; --unresolved: #9a8ad6; --tag-bg: rgba(115,80,232,.1); --tag-text: #6a48e0;
  --code-bg: #f3f3f3; --code-text: #c03070; --highlight: rgba(255,208,0,.4); --selection: rgba(115,80,232,.22);
  --graph-node: #888; --graph-tag: #5a8a5a; --graph-line: #d4d4d4; --shadow: 0 10px 30px rgba(0,0,0,.15);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 13px/1.5 var(--font-ui); overflow: hidden; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
kbd { font: 11px var(--font-mono); background: var(--bg-alt); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; color: var(--text-muted); }
.svg-icon { flex: none; stroke-width: 1.75; }
[hidden] { display: none !important; }

/* 큰 틀: 리본 | 왼쪽 | 가운데 | 오른쪽 */
.app { display: grid; grid-template-columns: var(--ribbon) var(--left-w) 1fr var(--right-w); height: 100vh; }
body.left-closed .app { grid-template-columns: var(--ribbon) 0 1fr var(--right-w); }
body.right-closed .app { grid-template-columns: var(--ribbon) var(--left-w) 1fr 0; }
body.left-closed.right-closed .app { grid-template-columns: var(--ribbon) 0 1fr 0; }
body.left-closed .side.left, body.right-closed .side.right { visibility: hidden; }

.ribbon { background: var(--bg-secondary); border-right: 1px solid var(--border); display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: calc(var(--top) + 6px) 0 10px; -webkit-app-region: drag; }
.ribbon-top, .ribbon-bottom { display: flex; flex-direction: column; gap: 4px; }
.ribbon-btn { width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; color: var(--text-muted); -webkit-app-region: no-drag; }
.ribbon-btn:hover { background: var(--bg-hover); color: var(--text); }

.side { background: var(--bg-secondary); display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.side.left { border-right: 1px solid var(--border); }
.side.right { border-left: 1px solid var(--border); }
.side-tabs { height: var(--top); display: flex; align-items: center; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--border); -webkit-app-region: drag; flex: none; }
.side.left .side-tabs { padding-left: 34px; }
.side-tab { width: 30px; height: 28px; border-radius: 6px; display: grid; place-items: center; color: var(--text-muted); -webkit-app-region: no-drag; }
.side-tab:hover { background: var(--bg-hover); color: var(--text); }
.side-tab.is-active { background: var(--bg-alt); color: var(--text); }
.side-tab.collapse { margin-left: auto; }
.side-body { overflow: auto; flex: 1; padding: 6px 6px 40px; }
.pane-title { font-size: 12px; font-weight: 600; color: var(--text-muted); padding: 10px 8px 6px; display: flex; align-items: center; gap: 6px; }
.count { margin-left: auto; font-size: 11px; color: var(--text-faint); background: var(--bg-alt); padding: 0 6px; border-radius: 8px; }
.empty { color: var(--text-faint); padding: 10px 10px; font-size: 12.5px; }

.nav-buttons { display: flex; justify-content: center; gap: 4px; padding: 4px 0 8px; }
.nav-buttons button { width: 30px; height: 28px; border-radius: 6px; display: grid; place-items: center; color: var(--text-muted); }
.nav-buttons button:hover { background: var(--bg-hover); color: var(--text); }
.tree-item { display: flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 5px; color: var(--text-muted); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 26px; }
.tree-item > span:not(.spacer):not(.tree-sub) { overflow: hidden; text-overflow: ellipsis; }
.tree-item:hover { background: var(--bg-hover); color: var(--text); }
.tree-item.is-active { background: var(--accent-soft); color: var(--text); }
.tree-item.folder { color: var(--text); font-weight: 500; }
.tree-item.folder .svg-icon { color: var(--text-faint); }
.tree-item.file { opacity: .75; }
.tree-item.unresolved { color: var(--unresolved); }
.tree-item .spacer { width: 14px; flex: none; }
.tree-sub { margin-left: auto; padding-left: 8px; font-size: 11px; color: var(--text-faint); }
.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; }
.link-btn { margin-left: auto; font-size: 11.5px; color: var(--accent); padding: 0 4px; }
.link-btn:hover { text-decoration: underline; }

.search-box { padding: 4px 4px 6px; }
.search-box input { width: 100%; padding: 7px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; outline: none; }
.search-box input:focus { border-color: var(--accent); }
.search-count { color: var(--text-faint); font-size: 12px; padding: 2px 8px 6px; }
.search-result { margin-bottom: 6px; }
.search-line, .bl-line { font-size: 12px; color: var(--text-muted); padding: 3px 10px 3px 22px; cursor: pointer; border-radius: 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.search-line:hover, .bl-line:hover { background: var(--bg-hover); }
mark { background: var(--highlight); color: inherit; border-radius: 2px; padding: 0 1px; }
.bl { margin-bottom: 4px; }
.tag-row { display: flex; align-items: center; padding: 4px 8px; border-radius: 5px; cursor: pointer; }
.tag-row:hover { background: var(--bg-hover); }
.outline-item { padding: 4px 8px; border-radius: 5px; cursor: pointer; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.outline-item:hover { background: var(--bg-hover); color: var(--text); }

/* 가운데: 탭 · 머리줄 · 내용 */
.main { display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.tabbar { height: var(--top); background: var(--bg-secondary); border-bottom: 1px solid var(--border); display: flex; align-items: flex-end; -webkit-app-region: drag; flex: none; }
.tab-edge { height: var(--top); width: 34px; display: grid; place-items: center; color: var(--text-faint); -webkit-app-region: no-drag; flex: none; }
.tab-edge:hover { color: var(--text); }
.tabs { display: flex; align-items: flex-end; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tab { -webkit-app-region: no-drag; height: 32px; display: flex; align-items: center; gap: 6px; padding: 0 6px 0 12px; border-radius: 8px 8px 0 0; color: var(--text-muted); cursor: pointer; max-width: 220px; min-width: 90px; flex: 0 1 220px; }
.tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.tab:hover { background: var(--bg-hover); }
.tab.is-active { background: var(--bg); color: var(--text); }
.tab-close { width: 20px; height: 20px; border-radius: 4px; display: grid; place-items: center; opacity: 0; color: var(--text-muted); }
.tab:hover .tab-close, .tab.is-active .tab-close { opacity: 1; }
.tab-close:hover { background: var(--bg-hover); }
.tab-new { -webkit-app-region: no-drag; width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; color: var(--text-faint); margin: 0 4px 3px; }
.tab-new:hover { background: var(--bg-hover); color: var(--text); }
body.left-closed .tabbar { padding-left: 30px; }

.view-header { height: 40px; display: flex; align-items: center; padding: 0 12px 0 16px; gap: 8px; flex: none; }
.view-crumb { flex: 1; display: flex; align-items: center; gap: 6px; justify-content: center; min-width: 0; color: var(--text-muted); }
.crumb { color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex-shrink: 1; }
.view-title { flex-shrink: 0; max-width: 70%; text-overflow: ellipsis; }
.crumb-sep { color: var(--text-faint); }
.view-title, .view-title-static { color: var(--text); font-weight: 500; outline: none; padding: 2px 6px; border-radius: 4px; white-space: nowrap; overflow: hidden; }
.view-title:focus { background: var(--bg-alt); box-shadow: 0 0 0 1px var(--accent); }
.view-actions { display: flex; gap: 2px; }
.view-actions button { width: 30px; height: 28px; border-radius: 6px; display: grid; place-items: center; color: var(--text-muted); }
.view-actions button:hover { background: var(--bg-hover); color: var(--text); }
.view-actions button.is-on { color: #e8b339; }
.view-content { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.editor-host { flex: 1; min-height: 0; overflow: hidden; }
.reader { flex: 1; overflow: auto; padding: 24px 32px 40vh; }
.graph-host { flex: 1; min-height: 0; overflow: hidden; }
.graph-host canvas { display: block; cursor: grab; }

/* 속성 */
.props { flex: none; }
.props-inner { max-width: var(--line-width); margin: 8px auto 0; padding: 0 32px; }
.props-head { display: flex; align-items: center; gap: 6px; color: var(--text-faint); font-size: 12px; padding: 4px 0; }
.props.is-empty .props-inner { opacity: .55; }
.props-empty { color: var(--text-faint); font-size: 12px; padding: 0 0 6px 20px; }
.prop-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.prop-key { width: 110px; flex: none; color: var(--text-muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prop-val { flex: 1; background: transparent; border: 1px solid transparent; border-radius: 4px; padding: 3px 6px; color: var(--text); font: 13px var(--font-ui); }
.prop-val:hover { border-color: var(--border); }
.prop-val:focus { outline: none; border-color: var(--accent); background: var(--bg-alt); }
.prop-del { opacity: 0; color: var(--text-faint); }
.prop-row:hover .prop-del { opacity: 1; }

/* 편집기 장식 */
.cm-wikilink { color: var(--link); }
.cm-hashtag { color: var(--tag-text); background: var(--tag-bg); border-radius: 10px; padding: 0 3px; }
.cm-mark { background: var(--highlight); }
.cm-placeholder { color: var(--text-faint); }

/* 읽기 화면 (옵시디언 Reading view 모양) */
.markdown-preview { max-width: var(--line-width); margin: 0 auto; font: var(--editor-font-size)/1.75 var(--font-text); word-break: keep-all; overflow-wrap: anywhere; }
.markdown-preview h1, .markdown-preview h2, .markdown-preview h3, .markdown-preview h4 { line-height: 1.3; margin: 1.4em 0 .5em; font-weight: 700; }
.markdown-preview h1 { font-size: 1.75em; } .markdown-preview h2 { font-size: 1.45em; } .markdown-preview h3 { font-size: 1.2em; }
.markdown-preview > :first-child { margin-top: .2em; }
.markdown-preview a { color: var(--link); text-decoration: none; cursor: pointer; }
.markdown-preview a:hover { text-decoration: underline; }
.internal-link.is-unresolved { color: var(--unresolved); opacity: .8; }
a.tag, .tag { color: var(--tag-text); background: var(--tag-bg); border-radius: 12px; padding: 1px 8px; font-size: .85em; text-decoration: none !important; cursor: pointer; }
.markdown-preview code { font-family: var(--font-mono); font-size: .85em; background: var(--code-bg); color: var(--code-text); padding: .1em .35em; border-radius: 4px; }
.markdown-preview pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; overflow: auto; }
.markdown-preview pre code { background: none; color: var(--text); padding: 0; }
.markdown-preview blockquote { margin: 1em 0; padding: 0 0 0 16px; border-left: 3px solid var(--accent); color: var(--text-muted); }
.markdown-preview table { border-collapse: collapse; margin: 1em 0; }
.markdown-preview th, .markdown-preview td { border: 1px solid var(--border); padding: 6px 12px; }
.markdown-preview th { background: var(--bg-secondary); }
.markdown-preview hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.markdown-preview img { max-width: 100%; border-radius: 6px; }
.markdown-preview ul, .markdown-preview ol { padding-left: 1.6em; }
.markdown-preview li:has(> .task-cb) { list-style: none; margin-left: -1.3em; }
.task-cb { width: 15px; height: 15px; accent-color: var(--accent); vertical-align: -2px; margin-right: 6px; cursor: pointer; }
li:has(> .task-cb:checked) { color: var(--text-faint); text-decoration: line-through; }
.markdown-embed { border-left: 2px solid var(--accent); padding: 4px 0 4px 16px; margin: 1em 0; }
.embed-title { font-weight: 600; font-size: .9em; color: var(--text-muted) !important; display: block; margin-bottom: 4px; }
.embed.missing { color: var(--text-faint); }

/* 콜아웃 */
.callout { --c: 138,108,240; margin: 1em 0; border-radius: 8px; background: rgba(var(--c), .09); border: 1px solid rgba(var(--c), .25); padding: 10px 14px; }
.callout > summary { list-style: none; cursor: pointer; }
.callout > summary::-webkit-details-marker { display: none; }
.callout-title { display: flex; align-items: center; gap: 8px; font-weight: 650; color: rgb(var(--c)); }
.callout-content > :first-child { margin-top: .4em; } .callout-content > :last-child { margin-bottom: 0; }
.callout[data-callout="tip"], .callout[data-callout="success"], .callout[data-callout="check"], .callout[data-callout="done"] { --c: 52,180,120; }
.callout[data-callout="warning"], .callout[data-callout="caution"], .callout[data-callout="question"] { --c: 236,150,40; }
.callout[data-callout="danger"], .callout[data-callout="error"], .callout[data-callout="bug"] { --c: 233,73,80; }
.callout[data-callout="info"], .callout[data-callout="todo"], .callout[data-callout="abstract"], .callout[data-callout="summary"] { --c: 70,150,235; }
.callout[data-callout="quote"], .callout[data-callout="example"] { --c: 150,150,150; }

/* 비었을 때 */
.empty-state { max-width: 460px; margin: 18vh auto 0; text-align: center; color: var(--text-muted); }
.empty-state h2 { color: var(--text); font-weight: 600; }
.empty-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 24px; }
.empty-actions button { color: var(--accent); padding: 6px; border-radius: 6px; display: flex; justify-content: center; gap: 10px; align-items: center; }
.empty-actions button:hover { background: var(--bg-hover); }

/* 상태 줄 (오른쪽 아래) */
.statusbar { position: fixed; right: 0; bottom: 0; display: flex; gap: 14px; padding: 3px 12px; font-size: 11.5px; color: var(--text-faint); background: var(--bg-secondary); border: 1px solid var(--border); border-right: 0; border-bottom: 0; border-top-left-radius: 8px; z-index: 5; }
.status-mode { cursor: pointer; display:inline-flex; align-items:center; gap:4px; } .callout-icon { display:inline-flex; vertical-align:-3px; } .status-mode:hover { color: var(--text); }

/* 작은 창들 */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; z-index: 30; }
.modal { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.modal.prompt { width: min(640px, 92vw); overflow: hidden; }
.prompt-input { width: 100%; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); font: 16px var(--font-ui); padding: 14px 16px; outline: none; }
.prompt-results { max-height: 50vh; overflow: auto; padding: 6px; }
.suggestion { padding: 8px 12px; border-radius: 6px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 10px; }
.suggestion-sub { grid-column: 1; font-size: 12px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion kbd { grid-row: 1 / span 2; grid-column: 2; }
.suggestion.is-selected { background: var(--accent-soft); }
.prompt-instructions { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-faint); }
.modal.dialog { width: min(420px, 92vw); padding: 20px; }
.dialog-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.dialog-sub { color: var(--text-muted); margin-bottom: 14px; }
.dialog-input { width: 100%; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: 14px var(--font-ui); outline: none; margin-bottom: 14px; }
.dialog-input:focus { border-color: var(--accent); }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-buttons button { padding: 6px 14px; border-radius: 6px; background: var(--bg-alt); }
.dialog-buttons .mod-cta { background: var(--accent); color: #fff; }
.dialog-buttons .mod-warning { background: #d9434c; color: #fff; }

.popover { position: fixed; z-index: 25; width: 460px; max-height: 360px; overflow: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 12px 20px; }
.popover .markdown-preview { font-size: 14px; }
.popover-title { font-weight: 600; color: var(--text-muted); font-size: 12px; margin-bottom: 4px; }
.menu { position: fixed; z-index: 40; min-width: 210px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 4px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 5px; cursor: pointer; }
.menu-item:hover { background: var(--accent-soft); }
.menu-item.danger { color: #e5575f; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.toast { position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 20px); opacity: 0; transition: .25s; background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 8px; z-index: 50; pointer-events: none; font-weight: 500; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 마우스 올리면 이름 보이기 */
[data-tip] { position: relative; }
[data-tip]:hover::after { content: attr(data-tip); position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--bg-alt); color: var(--text); border: 1px solid var(--border); font-size: 11.5px; padding: 3px 8px; border-radius: 5px; white-space: nowrap; z-index: 60; pointer-events: none; }
.ribbon [data-tip]:hover::after { top: 50%; left: calc(100% + 8px); transform: translateY(-50%); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }

/* ---- 2단계: 그래프 설정 패널 ---- */
.graph-host { position: relative; }
.graph-canvas { position: absolute; inset: 0; }
.graph-controls { position: absolute; top: 10px; right: 10px; width: min(250px, calc(100% - 20px)); max-height: calc(100% - 20px); overflow: auto; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 6px 12px 10px; }
.graph-controls:has(.gc-toggle:only-child) { width: auto; padding: 0; background: none; border: 0; box-shadow: none; }
.gc-toggle { float: right; width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; color: var(--text-muted); background: var(--bg-secondary); }
.gc-toggle:hover { color: var(--text); background: var(--bg-hover); }
.gc-section { clear: both; padding: 8px 0 4px; border-bottom: 1px solid var(--border); }
.gc-section:last-child { border-bottom: 0; }
.gc-title { font-weight: 600; color: var(--text-muted); font-size: 12px; margin-bottom: 6px; }
.gc-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; font-size: 12.5px; color: var(--text-muted); }
.gc-row.slider input { width: 110px; }
.gc-search, .gc-q { width: 100%; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: 12.5px var(--font-ui); outline: none; margin-bottom: 4px; }
.gc-search:focus, .gc-q:focus { border-color: var(--accent); }
.gc-group { display: flex; gap: 4px; align-items: center; }
.gc-group .gc-q { flex: 1; margin: 2px 0; }
.gc-group input[type=color] { width: 26px; height: 26px; border: 0; background: none; padding: 0; cursor: pointer; }
.gc-group button { color: var(--text-faint); }
.gc-add { color: var(--accent); font-size: 12.5px; padding: 4px 0; }
input[type=range] { accent-color: var(--accent); }

/* 켜기/끄기 스위치 */
.toggle { appearance: none; width: 34px; height: 20px; border-radius: 10px; background: var(--bg-hover); border: 1px solid var(--border); position: relative; cursor: pointer; transition: .15s; flex: none; margin: 0; }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-muted); transition: .15s; }
.toggle:checked { background: var(--accent); border-color: var(--accent); }
.toggle:checked::after { left: 16px; background: #fff; }

/* 로컬 그래프 (오른쪽 패널) */
.local-wrap { display: flex; flex-direction: column; padding: 0; }
.local-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; color: var(--text-muted); font-size: 12px; border-bottom: 1px solid var(--border); }
.local-bar input { flex: 1; }
#local-graph { flex: 1; min-height: 300px; position: relative; overflow: hidden; }

/* 설정 창 */
.modal.settings { width: min(900px, 94vw); height: min(640px, 86vh); display: grid; grid-template-columns: 190px 1fr; overflow: hidden; padding: 0; }
.modal-bg:has(.settings) { align-items: center; padding-top: 0; }
.set-nav { background: var(--bg); border-right: 1px solid var(--border); padding: 14px 8px; display: flex; flex-direction: column; gap: 2px; }
.set-nav button { text-align: left; padding: 6px 12px; border-radius: 6px; color: var(--text-muted); }
.set-nav button:hover { background: var(--bg-hover); color: var(--text); }
.set-nav button.is-active { background: var(--accent-soft); color: var(--text); }
.set-body { overflow: auto; padding: 18px 28px 30px; }
.set-head { font-size: 17px; font-weight: 650; padding-bottom: 12px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.set-close { color: var(--text-muted); width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; }
.set-close:hover { background: var(--bg-hover); }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.set-name { color: var(--text); font-size: 13.5px; }
.set-desc { color: var(--text-faint); font-size: 12px; margin-top: 2px; }
.set-row select { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; font: 13px var(--font-ui); }
.set-slider { display: flex; align-items: center; gap: 10px; }
.set-slider span { color: var(--text-muted); min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.swatches { display: flex; align-items: center; gap: 6px; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; }
.swatch.on { border-color: var(--text); }
.swatches input[type=color] { width: 28px; height: 28px; border: 0; background: none; padding: 0; cursor: pointer; }
/* 캔버스가 자기 상자를 키우지 않도록 */
.local-wrap { flex: 1; overflow: hidden; }
#local-graph { flex: 1; min-height: 0; }
#local-graph canvas, .graph-canvas canvas { position: absolute; inset: 0; }
#left, #right, main { min-height: 0; }
.local-wrap { min-height: 0; }

/* ---------- 3단계: 캔버스 ---------- */
.canvas-host { position: absolute; inset: 0; }
.cv-root { position: absolute; inset: 0; overflow: hidden; outline: none; cursor: default; touch-action: none;
  background-color: var(--bg); background-image: radial-gradient(circle, var(--border) 1.1px, transparent 1.2px); }
.cv-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.cv-edges { position: absolute; left: -50000px; top: -50000px; overflow: visible; pointer-events: none; }
.cv-edge { --ec: var(--text-faint); color: var(--ec); }
.cv-line { fill: none; stroke: var(--ec); stroke-width: 2.5; }
.cv-hit { fill: none; stroke: transparent; stroke-width: 16; pointer-events: stroke; cursor: pointer; }
.cv-head { fill: var(--ec); }
.cv-edge.is-sel .cv-line { stroke-width: 4; filter: drop-shadow(0 0 3px var(--accent)); }
.cv-elabel { fill: var(--text); font-size: 14px; text-anchor: middle; dominant-baseline: middle; paint-order: stroke; stroke: var(--bg); stroke-width: 6px; stroke-linejoin: round; }
.cv-temp { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 6 5; }
.cv-node { position: absolute; border-radius: 10px; border: 2px solid var(--cv-c, var(--border));
  background: color-mix(in srgb, var(--cv-c, transparent) 10%, var(--bg-secondary)); box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.cv-node.is-sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), 0 2px 10px rgba(0,0,0,.25); }
.cv-group { background: color-mix(in srgb, var(--cv-c, var(--text-faint)) 7%, transparent); box-shadow: none; border-style: solid; }
.cv-group-label { position: absolute; bottom: 100%; left: 0; margin-bottom: 6px; padding: 3px 10px; border-radius: 6px; font-size: 15px; font-weight: 600;
  background: color-mix(in srgb, var(--cv-c, var(--text-faint)) 22%, var(--bg-secondary)); color: var(--text); white-space: nowrap; }
.cv-body { position: absolute; inset: 0; overflow: auto; padding: 10px 16px; border-radius: 8px; cursor: grab; }
.cv-body .markdown-preview { font-size: 15px; }
.cv-body .markdown-preview > :first-child { margin-top: 0; }
.cv-file-title { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.cv-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cv-body:has(.cv-img) { padding: 0; }
.cv-link { display: flex; flex-direction: column; gap: 4px; }
.cv-link b { font-size: 15px; }
.cv-link a { color: var(--link); word-break: break-all; font-size: 13px; }
.cv-missing { color: var(--text-faint); }
.cv-edit { width: 100%; height: 100%; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); font: 15px/1.5 var(--font-text); cursor: text; }
.cv-dot { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--bg-secondary); border: 2px solid var(--accent); opacity: 0; cursor: crosshair; transition: opacity .12s; }
.cv-node:hover > .cv-dot, .cv-node.is-sel > .cv-dot { opacity: 1; }
.cv-dot[data-side=top] { top: -8px; left: calc(50% - 7px); } .cv-dot[data-side=bottom] { bottom: -8px; left: calc(50% - 7px); }
.cv-dot[data-side=left] { left: -8px; top: calc(50% - 7px); } .cv-dot[data-side=right] { right: -8px; top: calc(50% - 7px); }
.cv-resize { position: absolute; right: -3px; bottom: -3px; width: 16px; height: 16px; cursor: nwse-resize; }
.cv-toolbar, .cv-zoom, .cv-selbar { position: absolute; display: flex; gap: 2px; padding: 4px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); z-index: 2; }
.cv-toolbar { bottom: 16px; left: 50%; transform: translateX(-50%); }
.cv-zoom { right: 14px; bottom: 16px; flex-direction: column; }
.cv-toolbar button, .cv-zoom button, .cv-selbar button { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 7px; color: var(--text-muted); }
.cv-toolbar button:hover, .cv-zoom button:hover, .cv-selbar button:hover { background: var(--bg-hover); color: var(--text); }
.cv-selbar { align-items: center; }
.cv-selbar .cv-sw { width: 20px; height: 20px; border-radius: 50%; margin: 0 2px; border: 2px solid transparent; }
.cv-selbar .cv-sw.on { border-color: var(--text); }
.cv-selbar .cv-sw.none { background: linear-gradient(135deg, transparent 45%, var(--text-faint) 46% 54%, transparent 55%), var(--bg); border-color: var(--border); }
.cv-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.cv-hint { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); color: var(--text-faint); pointer-events: none; font-size: 15px; }

/* ---------- 파일 복구 창 ---------- */
.modal.history .set-nav { overflow-y: auto; }
.modal.history .set-nav button { display: flex; flex-direction: column; gap: 2px; }
.modal.history .set-nav small { color: var(--text-faint); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal.history .set-body { display: flex; flex-direction: column; min-height: 0; }
.history-preview { flex: 1; min-height: 0; overflow: auto; margin: 12px 0; padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.history-preview pre { white-space: pre-wrap; font-size: 12px; }

/* ---------- 슬라이드 ---------- */
.slides { position: fixed; inset: 0; z-index: 1000; background: var(--bg); display: grid; place-items: center; cursor: pointer; }
.slide { width: min(1100px, 88vw); max-height: 86vh; overflow: auto; font-size: 30px; line-height: 1.5; }
.slide h1 { font-size: 2.1em; } .slide h2 { font-size: 1.6em; }
.slide-count { position: absolute; right: 26px; bottom: 20px; color: var(--text-faint); font-size: 15px; }
.slide-close { position: absolute; right: 18px; top: 18px; color: var(--text-faint); padding: 8px; border-radius: 8px; }
.slide-close:hover { background: var(--bg-hover); color: var(--text); }
.tree-item.file.canvas { color: var(--text-muted); }
.tree-item.file .svg-icon { flex: none; margin-right: 4px; }

/* ================= 나이디어: 화면 바꾸기 줄 ================= */
:root { --modebar: 44px; }
.modebar { height: var(--modebar); display: flex; align-items: center; justify-content: center; background: var(--bg-secondary); border-bottom: 1px solid var(--border); -webkit-app-region: drag; position: relative; z-index: 6; }
.mode-seg { display: flex; gap: 2px; padding: 3px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; -webkit-app-region: no-drag; }
.mode-btn { display: flex; align-items: center; gap: 6px; padding: 5px 16px; border-radius: 7px; color: var(--text-muted); font-size: 13px; font-weight: 500; transition: background .15s, color .15s; }
.mode-btn:hover { color: var(--text); background: var(--bg-hover); }
.mode-btn.is-active { background: var(--brand, #FF7A45); color: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.app { height: calc(100vh / var(--z, 1) - var(--modebar)); } /* --z: 폰 글자 크기(zoom) — 확대해도 화면 높이 그대로 */
.ribbon { padding-top: 10px; }
.mode-host { height: calc(100vh / var(--z, 1) - var(--modebar)); overflow: hidden; }
body:not([data-mode="brain"]) .statusbar { display: none; }
@media (max-width: 700px) { .modebar { justify-content: flex-start; padding-left: 78px; } .mode-btn { padding: 5px 10px; } .mode-btn span { display: none; } .mode-btn.is-active span { display: inline; } }

/* ================= 할 일 (나이디어 스타일) ================= */
:root { --brand: #FF7A45; }
.td { display: grid; grid-template-columns: 240px 1fr; height: 100%; position: relative; --lc: var(--brand); }
.td.detail-open { grid-template-columns: 240px 1fr 360px; }
.td-side { background: var(--bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.td-search { margin: 14px 14px 4px; display: flex; align-items: center; gap: 6px; padding: 0 10px; height: 32px; border-radius: 16px; background: var(--bg-secondary); color: var(--text-faint); }
.td-search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font-size: 13px; }
.td-nav { flex: 1; overflow-y: auto; padding: 0 10px 8px; }
.td-label { margin: 16px 8px 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--text-faint); }
.td-nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; cursor: pointer; color: var(--text-muted); font-size: 13.5px; transition: background .12s, color .12s; }
.td-nav-item:hover { background: var(--bg-hover); color: var(--text); }
.td-nav-item.is-active { background: var(--bg-secondary); color: var(--text); font-weight: 650; box-shadow: inset 3px 0 0 var(--brand); }
.td-nav-item span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-nav-item b { font-weight: 600; font-size: 11.5px; color: var(--text-faint); }
.td-ic { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); }
.td-ic.emoji { font-size: 14px; line-height: 1; }
.td-newlist { display: flex; align-items: center; gap: 8px; margin: 6px 14px 14px; padding: 9px 12px; border-radius: 10px; border: 1px dashed var(--border); color: var(--text-muted); font-size: 13px; }
.td-newlist:hover { border-color: var(--brand); color: var(--brand); }
.td-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.td-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 28px 36px 14px; }
.td-burger { display: none; color: var(--text-muted); padding: 4px; border-radius: 6px; align-self: flex-start; }
.td-titlewrap { flex: 1; min-width: 8em; }
.td-greet { font-size: 13px; color: var(--lc); font-weight: 600; margin-bottom: 2px; }
.td-head h1 { display: flex; align-items: center; gap: 10px; white-space: nowrap; margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.td-head h1 .td-emoji, .td-head h1 > .svg-icon { color: var(--lc); }
.td-date { color: var(--text-muted); margin-top: 4px; font-size: 13px; }
.td-ring { position: relative; width: 52px; height: 52px; flex: none; }
.td-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.td-ring circle { fill: none; stroke-width: 5; }
.td-ring .bg { stroke: var(--bg-hover); }
.td-ring .fg { stroke: var(--lc); stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.td-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11.5px; color: var(--text); }
.td-tools { display: flex; gap: 2px; }
.td-tools button { display: flex; align-items: center; gap: 5px; padding: 6px 11px; border-radius: 16px; color: var(--text-muted); font-size: 12.5px; }
.td-tools button:hover { background: var(--bg-secondary); color: var(--text); }
.td-add { display: flex; align-items: center; gap: 8px; margin: 0 36px 6px; padding: 0 8px 0 14px; min-height: 46px; border-radius: 23px; background: var(--bg-secondary); border: 1.5px solid transparent; transition: border-color .15s, box-shadow .15s; }
.td-add:focus-within { border-color: var(--lc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--lc) 18%, transparent); }
.td-add-plus { color: var(--lc); display: grid; }
.td-add-input { flex: 1; min-width: 60px; background: none; border: 0; outline: 0; color: var(--text); font-size: 14px; }
.td-add-input::placeholder { color: var(--text-faint); }
.td-add-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 36px; min-height: 8px; }
.td-add-chips:not(:empty) { margin: 2px 36px 8px 50px; }
.td-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px 2px 9px; border-radius: 12px; background: color-mix(in srgb, var(--lc) 16%, transparent); color: var(--lc); font-size: 12px; font-weight: 600; }
.td-chip.auto { border: 1px dashed color-mix(in srgb, var(--lc) 60%, transparent); background: none; padding-right: 9px; }
.td-chip button { color: inherit; display: grid; opacity: .7; }
.td-add-opts { display: flex; }
.td-add-opts button { padding: 7px; border-radius: 50%; color: var(--text-faint); display: grid; }
.td-add-opts button:hover { background: var(--bg-hover); color: var(--lc); }
.td-list { flex: 1; overflow-y: auto; padding: 6px 36px 30px; overflow-anchor: none; }
.td-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 10px; border-radius: 12px; cursor: pointer; position: relative; transition: background .12s; }
.td-row + .td-row::before { content: ''; position: absolute; left: 44px; right: 10px; top: 0; border-top: 1px solid var(--border); opacity: .6; }
.td-row:hover, .td-row.is-open { background: var(--bg-secondary); }
.td-row:hover::before, .td-row:hover + .td-row::before, .td-row.is-open::before, .td-row.is-open + .td-row::before { opacity: 0; }
.td-row.td-drop, .td-nav-item.td-drop { box-shadow: inset 0 2px 0 var(--lc); }
.td-row-main { flex: 1; min-width: 0; }
.td-title { font-size: 14.5px; color: var(--text); word-break: break-word; line-height: 1.45; }
.td-row.is-done .td-title { text-decoration: line-through; text-decoration-color: var(--text-faint); color: var(--text-faint); }
.td-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 4px; }
.td-pill { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 10px; font-size: 11.5px; color: var(--text-muted); background: var(--bg-hover); }
.td-pill.today { color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, transparent); }
.td-pill.late { color: #fff; background: #E5484D; }
.td-from { font-size: 11.5px; color: var(--text-faint); }
.td-check { flex: none; padding: 0; width: 21px; height: 21px; border-radius: 7px; border: 2px solid color-mix(in srgb, var(--lc) 70%, var(--text-faint)); display: grid; place-items: center; color: transparent; transition: background .15s, transform .15s, border-color .15s; }
.td-check:hover { color: var(--lc); border-color: var(--lc); }
.td-check.on { background: var(--lc); border-color: var(--lc); color: #fff; animation: td-pop .3s ease; }
@keyframes td-pop { 50% { transform: scale(1.2); } }
.td-check svg { stroke-width: 3; }
.td-check.sm { width: 17px; height: 17px; border-radius: 6px; border-width: 1.5px; }
.td-star { flex: none; color: var(--text-faint); padding: 4px; border-radius: 8px; opacity: 0; transition: opacity .12s; }
.td-row:hover .td-star, .td-star.on, .tdd-head .td-star { opacity: 1; }
.td-star:hover { color: #F5A524; }
.td-star.on { color: #F5A524; }
.td-star.on svg { fill: currentColor; }
.td-link { color: var(--link); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent); }
.td-tag { color: var(--tag-text); background: var(--tag-bg); border-radius: 10px; padding: 0 6px; font-size: 12px; }
.td-group { margin: 18px 10px 6px; font-weight: 700; font-size: 12.5px; color: var(--lc); }
.td-group b { color: var(--text-faint); font-weight: 600; margin-left: 4px; }
.td-donetoggle { display: flex; align-items: center; gap: 6px; width: 100%; margin: 18px 0 6px; padding: 4px 10px; color: var(--text-muted); font-size: 12.5px; font-weight: 700; }
.td-donetoggle b { color: var(--text-faint); font-weight: 600; }
.td-donetoggle i { flex: 1; height: 1px; background: var(--border); }
.td-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 70px 20px; text-align: center; color: var(--text-muted); line-height: 1.6; }
.td-empty .svg-icon { color: var(--lc, var(--brand)); opacity: .55; }
.td-empty.small { padding: 30px 10px; }
.td-pop { position: absolute; z-index: 20; display: flex; gap: 6px; padding: 8px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.td-pop input { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; color-scheme: dark light; }
/* 오른쪽 자세히 */
.td-detail { background: var(--bg-secondary); border-left: 1px solid var(--border); overflow-y: auto; padding: 10px 18px 16px; display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.tdd-top { display: flex; align-items: center; justify-content: space-between; min-height: 32px; }
.tdd-top b { display: flex; align-items: center; gap: 6px; font-size: 15px; }
.tdd-crumb { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-faint); }
.tdd-close { color: var(--text-muted); padding: 5px; border-radius: 50%; }
.tdd-close:hover { background: var(--bg-hover); }
.tdd-head { display: flex; align-items: flex-start; gap: 12px; padding: 6px 0 4px; }
.tdd-head .td-check { margin-top: 4px; }
.tdd-title { flex: 1; resize: none; border: 0; outline: 0; background: none; color: var(--text); font: 700 19px/1.4 var(--font-ui); overflow: hidden; letter-spacing: -.01em; }
.tdd-title.done { text-decoration: line-through; color: var(--text-muted); }
.tdd-sec { margin: 14px 2px 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--text-faint); }
.tdd-steps { display: flex; flex-direction: column; gap: 2px; }
.tdd-step { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; }
.tdd-step:hover { background: var(--bg-hover); }
.tdd-step input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font-size: 13.5px; }
.tdd-step input.done { text-decoration: line-through; color: var(--text-muted); }
.tdd-step.add { color: var(--brand); }
.tdd-step.add input::placeholder { color: var(--text-faint); }
.tdd-x { color: var(--text-faint); display: grid; padding: 3px; border-radius: 6px; }
.tdd-x:hover { color: var(--text); background: var(--bg-hover); }
.tdd-field { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; margin-bottom: 4px; border-radius: 10px; background: var(--bg); color: var(--text-muted); cursor: pointer; position: relative; font-size: 13.5px; text-align: left; }
.tdd-field:hover { color: var(--text); }
.tdd-field span { flex: 1; }
.tdd-field.on { color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--bg)); font-weight: 600; }
.tdd-field.late { color: #E5484D; background: color-mix(in srgb, #E5484D 10%, var(--bg)); }
.tdd-field input[type=date], .tdd-field input[type=datetime-local] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.tdd-field .tdd-x { position: relative; z-index: 1; }
.tdd-field select { background: transparent; color: var(--text); border: 0; outline: 0; font-size: 13.5px; cursor: pointer; }
.tdd-field:has(.tdd-list) select { flex: 1; }
.tdd-quick { display: flex; gap: 6px; padding: 0 2px 8px 2px; flex-wrap: wrap; }
.tdd-quick button { padding: 3px 11px; border-radius: 12px; background: var(--bg); font-size: 12px; color: var(--text-muted); }
.tdd-quick button:hover { color: var(--brand); }
.tdd-note { min-height: 110px; resize: vertical; padding: 12px 14px; background: var(--bg); border: 1.5px solid transparent; border-radius: 10px; color: var(--text); font: 13.5px/1.6 var(--font-ui); outline: 0; }
.tdd-note:focus { border-color: var(--brand); }
.tdd-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; padding-top: 14px; color: var(--text-faint); font-size: 12px; }
.tdd-foot span { flex: 1; text-align: center; }
.tdd-foot button { display: flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 16px; color: var(--text-muted); font-size: 12px; }
.tdd-foot button:hover { background: var(--bg-hover); color: var(--text); }
.tdd-foot .tdd-del:hover { color: #E5484D; }
.tds-h { margin: 14px 2px 6px; font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--text-faint); }
.tds-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 4px; background: var(--bg); border-radius: 10px; }
.tds-item > div { flex: 1; min-width: 0; }
.tds-item small { color: var(--text-muted); }
.tds-item button { color: var(--brand); padding: 5px; border-radius: 50%; display: grid; background: color-mix(in srgb, var(--brand) 12%, transparent); }

/* ================= 아이디어 (할 일과 같은 나이디어 스타일) ================= */
.idv-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow-y: auto; background: var(--bg); }
.idv-main > .td-head { position: sticky; top: 0; z-index: 2; background: var(--bg); }
.id-ed-root { display: contents; }
.idv-nocat { padding: 6px 10px; font-size: 12px; color: var(--text-faint); }
.idv-capture { margin: 0 36px 10px; border-radius: 18px; background: var(--bg-secondary); border: 1.5px solid transparent; transition: border-color .15s, box-shadow .15s; }
.idv-capture:focus-within { border-color: var(--lc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--lc) 18%, transparent); }
.id-cap { display: block; width: 100%; resize: none; border: 0; outline: 0; background: none; color: var(--text); font: 14.5px/1.6 var(--font-ui); padding: 12px 18px; }
.id-cap::placeholder { color: var(--text-faint); }
.id-cap-bar { display: none; align-items: center; gap: 8px; padding: 0 10px 10px 16px; }
.idv-capture:focus-within .id-cap-bar, .idv-capture:has(.id-cap:not(:placeholder-shown)) .id-cap-bar { display: flex; }
.id-cap-hint { flex: 1; font-size: 11.5px; color: var(--text-faint); text-align: right; }
.id-cap-bar .mod-cta { background: var(--lc); border-radius: 14px; padding: 5px 16px; color: #fff; }
.id-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 36px 6px; }
.id-chip { padding: 3px 12px; border-radius: 14px; background: var(--bg-secondary); color: var(--text-muted); font-size: 12px; }
.id-chip:hover { color: var(--text); }
.id-chip.on { background: var(--lc); color: #fff; }
.id-body { padding: 0 36px 40px; }
.id-body > .td-group { margin-left: 2px; }
.id-grid { columns: 240px; column-gap: 14px; margin-bottom: 8px; }
.id-card { break-inside: avoid; margin-bottom: 14px; position: relative; padding: 14px 16px 10px; border-radius: 16px; background: var(--bg-secondary); cursor: pointer; transition: box-shadow .15s, transform .15s; border: 1.5px solid transparent; }
.id-card.tinted { background: color-mix(in srgb, var(--ic) 15%, var(--bg-secondary)); border-color: color-mix(in srgb, var(--ic) 35%, transparent); }
.id-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.22); transform: translateY(-2px); }
.id-pin { position: absolute; top: 12px; right: 12px; color: var(--lc); }
.id-card-title { font-weight: 700; font-size: 15px; margin-bottom: 6px; padding-right: 18px; word-break: break-word; letter-spacing: -.01em; }
.id-card-body { font-size: 13.5px; max-height: 240px; overflow: hidden; color: var(--text-muted); -webkit-mask-image: linear-gradient(#000 75%, transparent); }
.id-card-body > :first-child { margin-top: 0; }
.id-card-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; font-size: 11.5px; color: var(--text-faint); }
.id-tag { color: var(--tag-text); background: var(--tag-bg); border-radius: 10px; padding: 0 6px; }
.id-card-actions { display: flex; gap: 2px; margin-top: 6px; opacity: 0; transition: opacity .15s; }
.id-card:hover .id-card-actions { opacity: 1; }
.id-card-actions button { padding: 5px; border-radius: 8px; color: var(--text-muted); display: grid; }
.id-card-actions button:hover { background: var(--bg-hover); color: var(--lc); }
.id-card.td-drop, [data-id-dropcat].td-drop { box-shadow: inset 0 0 0 2px var(--lc); }
.id-ed-bg { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.5); display: grid; place-items: center; padding: 20px; }
.id-ed { width: min(680px, 100%); max-height: 86vh; display: flex; flex-direction: column; border-radius: 18px; background: var(--bg-secondary); box-shadow: var(--shadow); overflow: hidden; }
.id-ed.tinted { background: color-mix(in srgb, var(--ic) 13%, var(--bg-secondary)); }
.id-ed-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 0; font-size: 12px; color: var(--text-faint); }
.id-ed-top .td-chip { cursor: pointer; padding-right: 9px; }
.id-ed-title { border: 0; outline: 0; background: none; color: var(--text); font: 800 21px/1.4 var(--font-ui); padding: 8px 20px 4px; letter-spacing: -.01em; }
.id-ed-body { flex: 1; min-height: 260px; resize: none; border: 0; outline: 0; background: none; color: var(--text); font: 15px/1.7 var(--font-text); padding: 6px 20px 16px; }
.id-ed-bar { display: flex; align-items: center; gap: 4px; padding: 8px 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.id-ed-bar button { display: flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 14px; color: var(--text-muted); font-size: 13px; }
.id-ed-bar button:hover { background: var(--bg-hover); color: var(--text); }
.id-ed-bar .mod-cta { background: var(--lc); color: #fff; }
.id-ed-gap { flex: 1; }

/* ================= 좁은 화면 (핸드폰 대비) ================= */
@media (max-width: 860px) {
  .td, .td.detail-open { grid-template-columns: minmax(0, 1fr); }
  .td-side { position: absolute; inset: 0 auto 0 0; width: 270px; z-index: 15; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .td.side-open .td-side { transform: none; }
  .td-burger { display: grid; }
  .td-detail { position: absolute; inset: 0; z-index: 16; }
  .td-head { padding: 18px 16px 10px; }
  .td-list { padding: 4px 8px 20px; }
  .td-add { margin: 0 12px 6px; }
  .td-add-chips:not(:empty) { margin: 2px 12px 8px 30px; }
  .td-tools span, .td-ring { display: none; }
  .td-star { opacity: 1; }
  .idv-capture, .id-tags { margin-left: 12px; margin-right: 12px; }
  .id-body { padding: 0 12px 30px; }
  .id-card-actions { opacity: 1; }
}
/* 창 끌기는 맨 위 화면 바꾸기 줄에서만 (숨겼다 보인 화면에서 버튼이 안 눌리는 일 방지) */
.ribbon, .side-tabs, .tabbar { -webkit-app-region: no-drag; }

/* ================= 메모 (세컨드 브레인과 따로) ================= */
.mmv { grid-template-columns: 240px 300px 1fr; }
.mm-listcol { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); background: var(--bg); }
.mm-listhead { display: flex; align-items: center; gap: 8px; padding: 26px 16px 12px 22px; }
.mm-listhead h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-new, .mm-iconbtn { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--lc); }
.mm-new { background: color-mix(in srgb, var(--lc) 16%, transparent); }
.mm-new:hover, .mm-iconbtn:hover { background: color-mix(in srgb, var(--lc) 26%, transparent); }
.mm-list { flex: 1; overflow-y: auto; padding: 0 10px 20px; }
.mm-item { position: relative; padding: 10px 12px; border-radius: 12px; cursor: pointer; margin-bottom: 2px; }
.mm-item:hover { background: var(--bg-secondary); }
.mm-item.is-open { background: color-mix(in srgb, var(--lc) 16%, var(--bg-secondary)); }
.mm-item-title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 18px; }
.mm-item-sub { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.mm-item-sub b { font-weight: 600; color: var(--text); margin-right: 8px; }
.mm-item-sub i { color: var(--text-faint); font-style: normal; }
.mm-item-cat { display: flex; align-items: center; gap: 3px; font-size: 11px; margin-top: 3px; }
.mm-has-img { position: absolute; right: 10px; top: 11px; color: var(--text-faint); }
.mm-editcol { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.mm-tools { display: flex; align-items: center; gap: 2px; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.mm-tools button:not(.td-chip) { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--text-muted); font-size: 14px; }
.mm-tools button:not(.td-chip):hover { background: var(--bg-secondary); color: var(--lc); }
.mm-tools .td-chip { cursor: pointer; padding-right: 9px; }
.mm-back { display: none !important; }
.mm-gap { flex: 1; }
.mm-date { text-align: center; font-size: 12px; color: var(--text-faint); padding: 14px 0 0; }
.mm-editor { flex: 1; overflow-y: auto; outline: 0; padding: 14px max(28px, calc((100% - 760px) / 2)) 40vh; font: 15.5px/1.75 var(--font-text); color: var(--text); }
.mm-editor:empty::before { content: attr(data-ph); color: var(--text-faint); }
.mm-editor::first-line { font-size: 1.45em; font-weight: 800; letter-spacing: -.01em; }
.mm-editor h2 { font-size: 1.25em; margin: .8em 0 .3em; }
.mm-editor img { max-width: 100%; border-radius: 10px; margin: 6px 0; display: block; }
.mm-editor ul, .mm-editor ol { padding-left: 1.6em; margin: .2em 0; }
.mm-editor ol ol { list-style-type: lower-alpha; }
.mm-editor ol ol ol { list-style-type: lower-roman; }
.mm-editor li::marker { color: var(--lc); font-weight: 700; }
.mm-editor .mm-checklist { list-style: none; padding-left: 0; }
.mm-editor .mm-checklist .mm-checklist { padding-left: 1.6em; }
/* 동그라미 크기 = 글자 크기 (제목 줄에 있으면 같이 커짐) */
.mm-editor .mm-checklist > li { position: relative; padding-left: 1.6em; }
.mm-editor .mm-checklist > li::before { content: ''; position: absolute; left: .05em; top: .375em; width: 1em; height: 1em; box-sizing: border-box; border-radius: 50%; border: .12em solid var(--lc); cursor: pointer; }
.mm-editor .mm-checklist > li[data-done] { color: var(--text-faint); text-decoration: line-through; }
.mm-editor .mm-checklist > li[data-done]::before { background: var(--lc); box-shadow: inset 0 0 0 .16em var(--bg); }
@media (max-width: 860px) {
  .mmv { grid-template-columns: minmax(0, 1fr); }
  .mm-listcol { min-width: 0; }
  .mm-listhead { padding: 18px 12px 10px; }
  .mm-editcol { position: absolute; inset: 0; z-index: 14; display: none; }
  .mmv.editing .mm-editcol { display: flex; }
  .mm-back { display: grid !important; }
  .mm-editor { padding: 14px 18px 40vh; }
}

/* 낮/밤 버튼 (화면 바꾸기 줄 오른쪽) */
.theme-btn { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--text-muted); -webkit-app-region: no-drag; }
.theme-btn:hover { background: var(--bg-hover); color: var(--text); }
/* 목록·카테고리 그림 */
.pick-img { display: block; object-fit: cover; border-radius: 8px; flex: none; }
.td-ic:has(.pick-img) { background: none; }
.td-ic .pick-img { width: 26px; height: 26px; }
.td-head h1 .pick-img { width: 40px; height: 40px; border-radius: 11px; }
.id-cat-card .pick-img, .td-head .pick-img { box-shadow: 0 1px 4px rgba(0,0,0,.15); }

#ctxmenu { max-height: calc(100vh - 16px); overflow-y: auto; }

/* ---------- 낙서장 ---------- */
.sc { display: flex; flex-direction: column; height: 100%; --sc: #EC4899; }
.sc-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-bottom: 1px solid var(--border); font-size: 12.5px; color: var(--text-faint); }
.sc-hint { flex: 1; display: flex; align-items: center; gap: 6px; }
.sc-clear { display: flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 8px; color: var(--text-muted); }
.sc-clear:hover { background: var(--bg-secondary); color: #e5484d; }
.sc-board { flex: 1; overflow: auto; position: relative; cursor: text;
  background: radial-gradient(circle, var(--border) 1.2px, transparent 1.3px) 0 0 / 24px 24px, var(--bg); background-attachment: local; }
.sc-space { position: relative; }
.sc-note { position: absolute; max-width: 380px; padding: 2px 6px; border-radius: 6px; }
.sc-note:hover, .sc-note:focus-within { box-shadow: 0 0 0 1px var(--border); background: var(--bg); }
.sc-note.is-drag { box-shadow: var(--shadow); opacity: .9; }
.sc-text { min-width: 1ch; outline: 0; white-space: pre-wrap; word-break: break-word; font: 15px/1.6 var(--font-text); color: var(--text); cursor: text; }
.sc-grip, .sc-x { position: absolute; top: 3px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; color: var(--text-faint); opacity: 0; }
.sc-grip { left: -20px; cursor: grab; touch-action: none; }
.sc-x { right: -20px; }
.sc-note:hover .sc-grip, .sc-note:hover .sc-x, .sc-note:focus-within .sc-grip { opacity: 1; }
.sc-grip:hover { color: var(--sc); } .sc-x:hover { color: #e5484d; background: var(--bg-secondary); }

/* ---------- 할 일: 줄 지우기 단추 · 간트 차트 ---------- */
.td-del { flex: none; color: var(--text-faint); padding: 4px; border-radius: 8px; opacity: 0; transition: opacity .12s; margin-left: -8px; }
.td-row:hover .td-del { opacity: 1; }
.td-del:hover { color: #e5484d; background: color-mix(in srgb, #e5484d 12%, transparent); }
.tg { --lab: 200px; }
.tg-scroll { overflow-x: auto; padding-bottom: 8px; }
.tg-row { display: flex; width: calc(var(--lab) + var(--n) * var(--dw)); min-height: 38px; }
.tg-lab { position: sticky; left: 0; z-index: 2; flex: none; width: var(--lab); display: flex; align-items: center; gap: 8px; padding: 0 10px 0 4px; background: var(--bg); border-right: 1px solid var(--border); cursor: pointer; font-size: 13.5px; }
.tg-lab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-row.is-open .tg-lab, .tg-lab:hover { color: var(--lc); }
.tg-headrow { position: sticky; top: 0; z-index: 3; min-height: 60px; border-bottom: 1px solid var(--border); background: var(--bg); }
.tg-days { display: flex; }
.tg-day { position: relative; width: var(--dw); flex: none; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 4px; font-size: 11px; color: var(--text-muted); }
.tg-day b { font-size: 12.5px; font-weight: 600; color: var(--text); }
.tg-day small { font-size: 10px; }
.tg-day em { position: absolute; top: 4px; left: 3px; font-size: 11.5px; font-style: normal; font-weight: 700; color: var(--lc); white-space: nowrap; }
.tg-day.we b, .tg-day.we small { color: var(--text-faint); }
.tg-day.today b { color: #fff; background: var(--lc); border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; }
.tg-track { position: relative; flex: 1; border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
  background: repeating-linear-gradient(90deg, transparent 0 calc(var(--dw) - 1px), color-mix(in srgb, var(--border) 45%, transparent) calc(var(--dw) - 1px) var(--dw)); }
.tg-track::after { content: ''; position: absolute; top: 0; bottom: 0; left: calc(var(--today) + var(--dw) / 2); width: 2px; background: var(--lc); opacity: .5; pointer-events: none; }
.tg-bar { position: absolute; top: 7px; height: 24px; border-radius: 7px; background: color-mix(in srgb, var(--lc) 80%, transparent); color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center; padding: 0 10px; cursor: grab; touch-action: none; user-select: none; overflow: hidden; z-index: 1; }
.tg-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.tg-bar.late { background: #E5484D; }
.tg-bar.done { background: var(--bg-hover); color: var(--text-faint); text-decoration: line-through; }
.tg-bar.drag { cursor: grabbing; box-shadow: var(--shadow); opacity: .92; }
.tg-h { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.tg-h.l { left: 0; } .tg-h.r { right: 0; }
.tg-bar:hover .tg-h { background: rgba(255,255,255,.25); }
.tg-none { padding: 12px 6px; font-size: 12.5px; color: var(--text-faint); }
@media (max-width: 860px) { .tg { --lab: 120px; } }

/* ---------- 영업 ---------- */
.sl { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; height: 100%; --lc: #3AA6C9; }
.sl-listcol { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); }
.sl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 24px 18px 10px 22px; }
.sl-titlewrap { flex: 1; min-width: 8em; }
.sl-head h1 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 24px; font-weight: 800; color: var(--text); white-space: nowrap; }
.sl-head h1 .svg-icon { color: var(--lc); }
.sl .sl-primary { background: var(--lc) !important; color: #fff !important; }
.sl-tabs { display: flex; gap: 4px; padding: 0 16px 8px; overflow-x: auto; }
.sl-tab { flex: none; padding: 4px 10px; border-radius: 14px; font-size: 12.5px; color: var(--text-muted); background: var(--bg-secondary); }
.sl-tab b { font-weight: 700; margin-left: 2px; }
.sl-tab.on { background: var(--lc); color: #fff; }
.sl-list { flex: 1; overflow-y: auto; padding: 4px 10px 20px; }
.sl-item { padding: 10px 12px; border-radius: 12px; cursor: pointer; margin-bottom: 2px; }
.sl-item:hover { background: var(--bg-secondary); }
.sl-item.is-open { background: color-mix(in srgb, var(--lc) 16%, var(--bg-secondary)); }
.sl-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sl-item-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.sl-item-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-item-next { display: flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }
.sl-item-next.due { color: #E5484D; font-weight: 600; }
.sl-pill { flex: none; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 10px; color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); }
.sl-row { display: flex; gap: 6px; align-items: center; }
.sl-row input { flex: 1; min-width: 0; }
.sl input, .sl textarea, .sl select { background: var(--bg-secondary); color: var(--text); border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; font: 13.5px/1.5 var(--font-text); outline: 0; }
.sl input:focus, .sl textarea:focus { border-color: var(--lc); }
.sl textarea { width: 100%; box-sizing: border-box; resize: vertical; }
.sl .sl-row button, .sl-send button, .sl-hit button, .sl-ai, .sl-more { display: inline-flex; align-items: center; gap: 5px; flex: none; padding: 7px 12px; border-radius: 9px; background: var(--bg-secondary); color: var(--text); font-size: 13px; border: 1px solid var(--border); }
.sl button:disabled { opacity: .45; cursor: default; }
.sl-back { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--text-muted); flex: none; }
.sl-search { display: flex; flex-direction: column; gap: 6px; padding: 2px 4px; }
.sl-hit { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-bottom: 1px solid var(--border); }
.sl-hit > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sl-hit small { color: var(--text-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-in { display: flex; align-items: center; gap: 3px; color: #3FB27F; font-size: 12.5px; flex: none; }
.sl-busy, .sl-err { padding: 16px 8px; color: var(--text-muted); font-size: 13px; text-align: center; }
.sl-err { color: #E5484D; }
.sl-more { align-self: center; margin-top: 6px; }
.sl-key { display: flex; gap: 10px; padding: 14px; margin-top: 6px; border-radius: 12px; background: color-mix(in srgb, var(--lc) 10%, var(--bg-secondary)); font-size: 13px; }
.sl-key > .svg-icon { color: var(--lc); margin-top: 2px; }
.sl-key p { margin: 4px 0 8px; color: var(--text-muted); line-height: 1.6; }
.sl-key small { display: block; margin-top: 6px; color: var(--text-faint); }
.sl-detail { min-width: 0; min-height: 0; overflow-y: auto; }
.sl-d { max-width: 720px; margin: 0 auto; padding: 18px 26px 60px; display: flex; flex-direction: column; gap: 6px; }
.sl-d-top { display: flex; align-items: center; gap: 8px; }
.sl-d-top h2 { flex: 1; margin: 0; font-size: 21px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-d-top .sl-back { display: none; }
.sl-x { color: var(--text-faint); padding: 6px; border-radius: 8px; } .sl-x:hover { color: #E5484D; }
.sl-info { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text-muted); }
.sl-info span, .sl-info a { display: inline-flex; align-items: center; gap: 4px; }
.sl-info a { color: var(--link); }
.sl-sec { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; font-size: 12px; font-weight: 700; color: var(--text-muted); }
.sl-ai { color: var(--lc) !important; font-weight: 600; }
.sl-look { padding: 10px 12px; border-radius: 10px; background: var(--bg-secondary); font-size: 13px; }
.sl-look p { margin: 4px 0; color: var(--text-muted); }
.sl-look small { color: var(--text-faint); }
.sl-warn { display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; color: #E5484D; font-size: 12.5px; line-height: 1.5; }
.sl-emails { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; color: var(--text-muted); }
.sl-emails button { padding: 2px 9px; border-radius: 10px; background: color-mix(in srgb, var(--lc) 14%, transparent); color: var(--lc); font-size: 12.5px; }
.sl-body { min-height: 220px; }
.sl-send { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.sl-hint { color: var(--text-faint); font-size: 12px; line-height: 1.6; margin: 2px 0; }
.sl-log { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-muted); }
.sl-log b { font-weight: 600; color: var(--text); margin-right: 8px; }
.sl-pf { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
@media (max-width: 760px) {
  .sl { grid-template-columns: minmax(0, 1fr); position: relative; }
  .sl-detail { position: absolute; inset: 0; z-index: 5; background: var(--bg); display: none; }
  .sl.detail-open .sl-detail { display: block; }
  .sl-d-top .sl-back { display: grid; }
  .sl-d { padding: 14px 16px 60px; }
}

/* ---------- 폰 앱 ---------- */
.is-mobile .modebar { padding-left: 8px; justify-content: flex-start; -webkit-app-region: none; }
.is-mobile .mode-seg { overflow-x: auto; max-width: calc(100vw - 56px); }
.mb-setup { position: fixed; inset: 0; z-index: 100; overflow-y: auto; background: var(--bg); padding: 24px 18px; display: flex; flex-direction: column; }
.mb-setup > .mb-card { margin: auto; width: 100%; } /* 가운데 정렬 (길면 위에서부터 스크롤) */
.mb-card { max-width: 480px; margin: 0 auto; overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 10px; color: var(--text); font-size: 14.5px; line-height: 1.6; }
.mb-card h1 { font-size: 22px; margin: 0; }
.mb-card p, .mb-card small { color: var(--text-muted); margin: 0; }
.mb-card ol { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 6px; }
.mb-card label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; color: var(--text-muted); }
.mb-card input { background: var(--bg-secondary); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; font-size: 15px; }
.mb-card button { padding: 13px; border-radius: 12px; background: var(--brand, #FF7A45); color: #fff; font-weight: 700; font-size: 15px; }
.mb-err { color: #E5484D; font-size: 13px; min-height: 1em; }
.mb-card input, .mb-card button { box-sizing: border-box; width: 100%; }
.mb-btn { display: block; text-align: center; padding: 13px; border-radius: 12px; background: var(--brand, #FF7A45); color: #fff !important; font-weight: 700; font-size: 15px; text-decoration: none; }
.mb-card .mb-sub { background: var(--bg-secondary); color: var(--text); }
.pair-btn { position: absolute; right: 52px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--text-muted); -webkit-app-region: no-drag; }
.pair-btn:hover { background: var(--bg-hover); color: var(--text); }
.is-mobile .pair-btn { display: none; }
.pair-qr { background: #fff; border-radius: 12px; padding: 6px; width: 240px; margin: 6px auto 10px; }
.pair-qr svg { display: block; width: 100%; height: auto; }
.pair-devs { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 4px; font-size: 13px; }
.pair-dev { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--bg-secondary); }
.pair-dev span { flex: 1; display: flex; flex-direction: column; }
.pair-dev small, .pair-devs > small { color: var(--text-faint); font-size: 11.5px; }
.pair-dev button { padding: 4px 10px; border-radius: 8px; color: #E5484D; background: color-mix(in srgb, #E5484D 12%, transparent); }

/* 세컨드 브레인을 폰·좁은 창에서: 왼쪽(파일 목록)·오른쪽(링크) 칸은 본문을 밀지 않고 위에 덮개로 */
@media (max-width: 860px) {
  .app { grid-template-columns: var(--ribbon) minmax(0, 1fr) !important; position: relative; }
  .app > .side { position: absolute; top: 0; bottom: 0; width: min(300px, 82vw); z-index: 20; box-shadow: var(--shadow); }
  .app > .side.left { left: var(--ribbon); }
  .app > .side.right { right: 0; }
  body.left-closed .app > .side.left, body.right-closed .app > .side.right { display: none; }
  .app > .main { min-width: 0; }
  .tab { min-width: 70px; }
}

@media (max-width: 860px) { .td-side { box-shadow: none; } .td.side-open .td-side { box-shadow: var(--shadow); } } /* 닫힌 목록 그림자가 왼쪽 끝에 비치지 않게 */

/* ---------- 폰: 아래쪽 입력칸 · 메뉴 위치 · 설정 ---------- */
@media (max-width: 860px) {
  /* 할 일 적기: 목록 아래, 엄지 닿는 곳에 */
  .td-main > .td-list { order: 2; flex: 1; min-height: 0; }
  .td-main > .td-add { order: 3; margin: 6px 12px 10px; }
  .td-main > .td-add-chips { order: 4; }
  /* 아이디어 적기: 맨 아래에 붙어 있게 */
  .idv-main > .id-body { order: 2; flex: 1 0 auto; }
  .idv-main > .idv-capture { order: 9; position: sticky; bottom: 8px; margin: 8px 12px 8px; z-index: 3; box-shadow: var(--shadow); }
}
.bar-bottom #modebar { position: fixed; left: 0; right: 0; bottom: 0; border-bottom: 0; border-top: 1px solid var(--border); }
.bar-bottom .mode-host, .bar-bottom .app { margin-top: 0; }
.m-set-btn { position: absolute; right: 52px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; color: var(--text-muted); }
.m-sheet { position: fixed; inset: 0; z-index: 120; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; }
.m-sheet-card { width: 100%; box-sizing: border-box; background: var(--bg); color: var(--text); border-radius: 18px 18px 0 0; padding: 16px 18px 24px; display: flex; flex-direction: column; gap: 14px; font-size: 14.5px; }
.m-sheet-card small { color: var(--text-faint); font-size: 12px; }
.m-sheet-title { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 18px; }
.m-sheet-title button { color: var(--text-muted); padding: 4px; }
.m-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.m-row > span { flex: none; font-weight: 600; color: var(--text-muted); font-size: 13.5px; }
.m-seg { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.m-seg button { padding: 7px 12px; border-radius: 10px; background: var(--bg-secondary); color: var(--text-muted); font-size: 13.5px; }
.m-seg button.on { background: var(--brand, #FF7A45); color: #fff; font-weight: 700; }
.m-logout { padding: 7px 14px; border-radius: 10px; background: color-mix(in srgb, #E5484D 14%, transparent); color: #E5484D; font-weight: 600; }
.m-logout.sure { background: #E5484D; color: #fff; }

.mb-sync { position: fixed; z-index: 50; pointer-events: none; top: calc(var(--modebar) / 2 - 14px); right: 54px; width: 9px; height: 9px; border-radius: 50%; background: var(--text-faint); box-shadow: 0 0 0 2px var(--bg-secondary); }
.mb-sync[data-s="live"] { background: #3FB27F; }
.mb-sync[data-s="busy"], .mb-sync[data-s="wait"] { background: var(--brand, #FF7A45); }
.mb-sync[data-s="err"] { background: #E5484D; }
.bar-bottom .mb-sync { top: auto; bottom: calc(var(--modebar) / 2 + 5px); }
.m-row > .m-sync-line { flex: 1; font-weight: 400; color: var(--text); font-size: 12.5px; }
.m-syncnow { flex: none; padding: 6px 10px; border-radius: 10px; background: var(--bg-secondary); color: var(--text-muted); font-size: 12.5px; }
/* 폰 메뉴줄: 글자 없이 아이콘만 (지금 화면은 주황으로) — 글자 크기를 키워도 단추끼리 안 겹치게 */
.is-mobile .mode-btn span, .is-mobile .mode-btn.is-active span { display: none; }
.is-mobile .mode-btn { padding: 6px 10px; }

/* 폰: 새 메모 단추를 오른쪽 아래 둥근 단추로 (메모를 열면 편집 화면이 덮어서 가려짐) */
.is-mobile .mm-new { position: fixed; right: 18px; bottom: 22px; width: 56px; height: 56px; background: var(--lc); color: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.22); }
.is-mobile .mm-new svg { width: 24px; height: 24px; }
.bar-bottom .mm-new { bottom: calc(var(--modebar) + 22px); }
.is-mobile .mm-list { padding-bottom: 96px; }
.mmv.editing .mm-new { display: none; }

/* 화면마다 다른 색 (선택된 메뉴 단추) */
.mode-btn[data-modebtn="todo"] { --mc: #FF7A45; }
.mode-btn[data-modebtn="memo"] { --mc: #22B8A6; }
.mode-btn[data-modebtn="ideas"] { --mc: #F5A524; }
.mode-btn[data-modebtn="brain"] { --mc: #8B5CF6; }
.mode-btn[data-modebtn="scribble"] { --mc: #EC4899; }
.mode-btn[data-modebtn="sales"] { --mc: #3AA6C9; }
.mode-btn.is-active { background: var(--mc, var(--brand)); }
/* 폰: 메뉴 단추 조금 크게 */
:root.is-mobile { --modebar: 52px; }
.is-mobile .mode-btn { padding: 8px 12px; }
.is-mobile .mode-btn svg { width: 20px; height: 20px; }
.is-mobile .m-set-btn svg, .is-mobile .theme-btn svg { width: 21px; height: 21px; }
.is-mobile .theme-btn { width: 38px; height: 38px; }
/* 낙서: 손가락으로 글 끌어 옮기기, 쓰는 중엔 지우기 단추 보이기 */
.is-mobile .sc-note { touch-action: none; }
.is-mobile .sc-note:focus-within { touch-action: auto; }
.is-mobile .sc-note:focus-within .sc-x { opacity: 1; }
/* 폰: 메뉴 단추들이 톱니·테마 단추 앞까지 칸을 나눠 씀 (글자 크기를 키워도 안 겹침) */
.is-mobile .mode-seg { flex: 1; min-width: 0; max-width: 420px; margin-right: 96px; overflow: hidden; }
.is-mobile .mode-btn { flex: 1; min-width: 0; justify-content: center; padding: 8px 0; }
.is-mobile .m-set-btn { right: 50px; width: 38px; height: 38px; }
/* 설정: 메뉴 순서·색 */
.m-sheet-card { max-height: 88vh; overflow-y: auto; }
.m-col { flex-direction: column; align-items: stretch; }
.m-col > span i { font-style: normal; font-weight: 500; color: var(--text-faint); font-size: 12px; }
.m-modes { display: flex; flex-direction: column; gap: 6px; }
.m-mode { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; align-items: center; padding: 8px 10px; border-radius: 12px; background: var(--bg-secondary); }
.m-mode-name { display: flex; align-items: center; gap: 7px; font-weight: 700; color: var(--mc); }
.m-mode { --mc0: var(--text); }
.m-move { display: flex; gap: 4px; }
.m-move button { display: grid; place-items: center; width: 34px; height: 30px; border-radius: 8px; background: var(--bg); color: var(--text-muted); }
.m-move button:first-child svg { transform: rotate(180deg); }
.m-move button:disabled { opacity: .3; }
.m-dots { grid-column: 1 / -1; display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.m-dots button { width: 24px; height: 24px; border-radius: 50%; }
.m-dots button.on { box-shadow: 0 0 0 2px var(--bg-secondary), 0 0 0 4px var(--text); }
.m-dots .m-dot-reset { width: auto; padding: 0 9px; border-radius: 12px; font-size: 12px; background: var(--bg); color: var(--text-muted); }
.m-move { grid-row: 1; grid-column: 2; }
.mb-legal a { color: var(--text-faint); text-decoration: underline; }
