:root {
  color-scheme: light;
  --bg: #f4f4f6;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-solid: #ffffff;
  --sidebar: #f1f1f3;
  --editor: #ffffff;
  --text: #1d1d1f;
  --muted: #7b7b80;
  --faint: #a8a8ae;
  --line: #e5e5e9;
  --line-strong: #d7d7dc;
  --accent: #f2b600;
  --accent-soft: #fff5c9;
  --accent-ink: #7b5800;
  --blue: #3478f6;
  --danger: #d94a4a;
  --shadow: 0 18px 42px rgba(40, 40, 48, 0.09);
  --control-bg: rgba(255, 255, 255, .62);
  --hover-bg: rgba(255, 255, 255, .75);
  --match-bg: #ffe68a;
  --match-ink: #614600;
  --toolbar-opacity: .78;
  --backdrop: rgba(24, 24, 30, .28);
  --selection-bg: #ffe9a0;
  --tag-red-ink: #a82323; --tag-orange-ink: #8c4200; --tag-green-ink: #1f653e; --tag-teal-ink: #12666c; --tag-blue-ink: #245cb6; --tag-purple-ink: #7138aa; --tag-pink-ink: #9d3672; --tag-gray-ink: #54545f;
  --radius: 18px;
  --serif: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #171719;
    --panel: rgba(34, 34, 36, .98);
    --panel-solid: #2c2c2e;
    --sidebar: #242426;
    --editor: #1c1c1e;
    --text: #f2f2f7;
    --muted: #b3b3bc;
    --faint: #9b9ba5;
    --line: #38383c;
    --line-strong: #5b5b63;
    --accent: #f7c52f;
    --accent-soft: #493d18;
    --accent-ink: #ffe892;
    --blue: #8ab4ff;
    --danger: #ff8d87;
    --shadow: 0 18px 42px rgba(0, 0, 0, 0.24);
    --control-bg: #303034;
    --hover-bg: #37373c;
    --match-bg: #665016;
    --match-ink: #fff2ad;
    --toolbar-opacity: 1;
    --backdrop: rgba(0, 0, 0, .62);
    --selection-bg: #6a551c;
    --tag-red-ink: #ffb1aa; --tag-orange-ink: #ffc38a; --tag-green-ink: #a0dfb2; --tag-teal-ink: #96dfe1; --tag-blue-ink: #aacbff; --tag-purple-ink: #d3b2ff; --tag-pink-ink: #f1b2d8; --tag-gray-ink: #c9c9d3;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171719;
  --panel: rgba(34, 34, 36, .98);
  --panel-solid: #2c2c2e;
  --sidebar: #242426;
  --editor: #1c1c1e;
  --text: #f2f2f7;
  --muted: #b3b3bc;
  --faint: #9b9ba5;
  --line: #38383c;
  --line-strong: #5b5b63;
  --accent: #f7c52f;
  --accent-soft: #493d18;
  --accent-ink: #ffe892;
  --blue: #8ab4ff;
  --danger: #ff8d87;
  --shadow: 0 18px 42px rgba(0, 0, 0, .24);
  --control-bg: #303034;
  --hover-bg: #37373c;
  --match-bg: #665016;
  --match-ink: #fff2ad;
  --toolbar-opacity: 1;
  --backdrop: rgba(0, 0, 0, .62);
  --selection-bg: #6a551c;
  --tag-red-ink: #ffb1aa; --tag-orange-ink: #ffc38a; --tag-green-ink: #a0dfb2; --tag-teal-ink: #96dfe1; --tag-blue-ink: #aacbff; --tag-purple-ink: #d3b2ff; --tag-pink-ink: #f1b2d8; --tag-gray-ink: #c9c9d3;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.auth-gate { position:fixed; inset:0; z-index:100; display:flex; flex-direction:column; align-items:center; padding:24px; background:var(--bg); overflow:auto; }
.auth-card { width:min(100%,380px); flex-shrink:0; margin-block:auto; display:grid; gap:12px; padding:32px; background:var(--panel-solid); border:1px solid var(--line); border-radius:22px; box-shadow:var(--shadow); }
.auth-card h1 { margin:0; font-size:29px; letter-spacing:-.04em; }
.auth-card p { margin:0; line-height:1.5; font-size:13px; color:var(--muted); }
.auth-card label { display:grid; gap:7px; font-size:12px; font-weight:600; }
.auth-card input { width:100%; min-height:44px; border:1px solid var(--line-strong); background:var(--bg); color:var(--text); border-radius:10px; padding:10px; font-size:16px; }
.auth-card input:focus { outline:2px solid var(--accent); outline-offset:2px; }
.auth-card small { color:var(--muted); font-size:11px; line-height:1.6; }
.auth-card .auth-error { color:var(--danger); }
.auth-card .primary-button { min-height:44px; }
.logout-button { margin:0 20px 20px; border:0; border-radius:10px; padding:10px 14px; cursor:pointer; color:var(--danger); background:var(--bg); }

html, body { height: 100%; overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--selection-bg); color: var(--text); }
button, [contenteditable="true"] { -webkit-tap-highlight-color: transparent; }

.app {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(285px, 360px) 1fr;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  background: var(--bg);
}

.panel { min-width: 0; min-height: 0; position: relative; }

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px 16px 16px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.sidebar > * { flex-shrink: 0; }

.sidebar-topbar, .column-header, .editor-topbar, .modal-header, .sidebar-section-title, .note-meta-row, .editor-footer, .column-bottom-bar {
  display: flex;
  align-items: center;
}

.sidebar-topbar { gap: 11px; min-height: 38px; }
.brand-mark { width: 31px; height: 31px; display: grid; align-content: center; gap: 3px; padding: 7px 6px; border-radius: 10px; background: var(--accent); box-shadow: 0 5px 13px rgba(242, 182, 0, .22); }
.brand-mark span { display: block; height: 2px; border-radius: 3px; background: #fffaf0; }
.brand-mark span:nth-child(2) { width: 80%; }
.brand-mark span:nth-child(3) { width: 58%; }
.sidebar-topbar h1 { margin: 2px 0 0; font-size: 15px; letter-spacing: -.02em; }
.eyebrow { margin: 0; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.sidebar-topbar .icon-button { margin-left: auto; }

.icon-button, .tiny-button, .pin-toggle, .status-button { border: 0; background: transparent; cursor: pointer; }
.icon-button { width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center; color: var(--muted); transition: background .18s ease, color .18s ease, transform .18s ease; }
.icon-button:hover { background: var(--panel-solid); color: var(--text); }
.icon-button:active { transform: scale(.95); }
.ghost { opacity: .8; }
.icon-button::before, .icon-button::after { content: ""; display: block; }
#sidebarSettings::before { width: 16px; height: 16px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='m19.43 12.98 1.34 1.04-1.7 2.94-1.59-.64a7.2 7.2 0 0 1-1.53.89L15.7 18.9h-3.4l-.25-1.69a7.3 7.3 0 0 1-1.54-.89l-1.58.64-1.7-2.94 1.33-1.04a6.6 6.6 0 0 1 0-1.96L7.23 9.98l1.7-2.94 1.58.64a7.3 7.3 0 0 1 1.54-.89L12.3 5.1h3.4l.25 1.69c.55.23 1.07.53 1.53.89l1.59-.64 1.7 2.94-1.34 1.04a6.6 6.6 0 0 1 0 1.96ZM14 15.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='m19.43 12.98 1.34 1.04-1.7 2.94-1.59-.64a7.2 7.2 0 0 1-1.53.89L15.7 18.9h-3.4l-.25-1.69a7.3 7.3 0 0 1-1.54-.89l-1.58.64-1.7-2.94 1.33-1.04a6.6 6.6 0 0 1 0-1.96L7.23 9.98l1.7-2.94 1.58.64a7.3 7.3 0 0 1 1.54-.89L12.3 5.1h3.4l.25 1.69c.55.23 1.07.53 1.53.89l1.59-.64 1.7 2.94-1.34 1.04a6.6 6.6 0 0 1 0 1.96ZM14 15.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Z'/%3E%3C/svg%3E") center/contain no-repeat; }
#backToFolders::before, #backToNotes::before { width: 17px; height: 17px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='m15.4 5.4-1.4-1.4L6 12l8 8 1.4-1.4L8.83 12z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='m15.4 5.4-1.4-1.4L6 12l8 8 1.4-1.4L8.83 12z'/%3E%3C/svg%3E") center/contain no-repeat; }
#backToNotes::before { transform: rotate(180deg); }
#historyButton::before { width: 17px; height: 17px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M13 3a9 9 0 0 0-8.65 6.5H2L5 12.5l3-3H6.4A7 7 0 1 1 5 14H3.1A9 9 0 1 0 13 3Zm-1 4v5l4 2.4.9-1.5-3.1-1.8V7H12Z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M13 3a9 9 0 0 0-8.65 6.5H2L5 12.5l3-3H6.4A7 7 0 1 1 5 14H3.1A9 9 0 1 0 13 3Zm-1 4v5l4 2.4.9-1.5-3.1-1.8V7H12Z'/%3E%3C/svg%3E") center/contain no-repeat; }
#moreButton::before { width: 17px; height: 17px; background: currentColor; -webkit-mask: radial-gradient(circle, currentColor 2px, transparent 2.5px) 0 0/6px 6px; mask: radial-gradient(circle, currentColor 2px, transparent 2.5px) 0 0/6px 6px; }
#viewModeButton::before { width: 17px; height: 17px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 4h7v7H4V4Zm9 0h7v7h-7V4ZM4 13h7v7H4v-7Zm9 0h7v7h-7v-7Z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 4h7v7H4V4Zm9 0h7v7h-7V4ZM4 13h7v7H4v-7Zm9 0h7v7h-7v-7Z'/%3E%3C/svg%3E") center/contain no-repeat; }
#sortButton::before { width: 17px; height: 17px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M7 4h2v13.2l2.1-2.1 1.4 1.4L8 21l-4.5-4.5 1.4-1.4L7 17.2V4Zm8 3h2v13h-2V7Zm5 0h-2V4h2v3Z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M7 4h2v13.2l2.1-2.1 1.4 1.4L8 21l-4.5-4.5 1.4-1.4L7 17.2V4Zm8 3h2v13h-2V7Zm5 0h-2V4h2v3Z'/%3E%3C/svg%3E") center/contain no-repeat; }
.tiny-button { width: 22px; height: 22px; color: var(--muted); border-radius: 7px; }
.tiny-button:hover { background: var(--panel-solid); color: var(--text); }

.profile-card { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--control-bg); }
.avatar { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: #28282a; color: #fff; font-size: 10px; font-weight: 700; }
.profile-copy { display: grid; gap: 2px; min-width: 0; }
.profile-copy strong { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-copy span { color: var(--muted); font-size: 10px; }
.online-dot, .footer-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #4dbb70; box-shadow: 0 0 0 3px rgba(77,187,112,.12); }
.online-dot { margin-left: auto; }

.search-box { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 9px; color: var(--muted); border-radius: 10px; background: var(--control-bg); border: 1px solid transparent; }
.search-box:focus-within { border-color: var(--line-strong); background: var(--panel-solid); }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 13px; }
.search-box input::placeholder { color: var(--faint); }
.search-icon { width: 15px; height: 15px; border: 1.6px solid currentColor; border-radius: 50%; position: relative; flex: 0 0 auto; }
.search-icon::after { content: ""; position: absolute; width: 6px; height: 1.6px; background: currentColor; right: -4px; bottom: -2px; transform: rotate(45deg); border-radius: 2px; }
kbd { color: var(--faint); font-size: 10px; white-space: nowrap; }

.folder-nav { display: grid; gap: 3px; }
.folder-section-title { margin-bottom: -14px; }
.folder-row { position: relative; min-width: 0; }
.folder-item.editable-folder { padding-right: 44px; }
.folder-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-count { flex-shrink: 0; }
.folder-options { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 21px; cursor: pointer; }
.folder-options:hover { background: var(--accent-soft); color: var(--accent-ink); }
.folder-item { width: 100%; display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 0; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; font-size: 13px; transition: background .18s ease, color .18s ease; }
.folder-item:hover { background: var(--hover-bg); }
.folder-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.folder-item .folder-count { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 500; }
.folder-icon { width: 16px; height: 16px; display: inline-grid; place-items: center; color: currentColor; flex: 0 0 auto; }
.folder-icon::before { content: ""; width: 15px; height: 13px; border: 1.5px solid currentColor; border-radius: 3px; display: block; clip-path: polygon(0 20%, 38% 20%, 47% 0, 83% 0, 100% 20%, 100% 100%, 0 100%); }
.folder-icon.star::before { border: 0; content: "★"; font-size: 16px; }
.folder-icon.trash::before { border: 0; content: "⌫"; font-size: 17px; }
.folder-icon.inbox::before { border: 0; content: "▤"; font-size: 17px; }
.folder-icon.smart::before { border: 0; content: "✦"; font-size: 17px; }

.sidebar-section-title { justify-content: space-between; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 4px 10px 0; }
.tag-list { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 7px; }
.tag-color-amber { --tag-dot: #e3ac0c; --tag-ink: var(--accent-ink); }
.tag-color-red { --tag-dot: #e65b5b; --tag-ink: var(--tag-red-ink); }
.tag-color-orange { --tag-dot: #e8883b; --tag-ink: var(--tag-orange-ink); }
.tag-color-green { --tag-dot: #45a776; --tag-ink: var(--tag-green-ink); }
.tag-color-teal { --tag-dot: #41a8ac; --tag-ink: var(--tag-teal-ink); }
.tag-color-blue { --tag-dot: #4d84ea; --tag-ink: var(--tag-blue-ink); }
.tag-color-purple { --tag-dot: #9b72d8; --tag-ink: var(--tag-purple-ink); }
.tag-color-pink { --tag-dot: #d76baf; --tag-ink: var(--tag-pink-ink); }
.tag-color-gray { --tag-dot: #92929c; --tag-ink: var(--tag-gray-ink); }
.tag-dot { display: inline-block; flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--tag-dot); }
.tag-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-chip-wrap, .note-tag-chip { display: inline-flex; align-items: center; min-width: 0; max-width: 100%; border: 1px solid color-mix(in srgb,var(--tag-dot) 25%,transparent); border-radius: 8px; background: color-mix(in srgb,var(--tag-dot) 12%,var(--panel-solid)); color: var(--tag-ink); }
.tag-chip { display: inline-flex; align-items: center; gap: 5px; min-width: 0; overflow: hidden; border: 0; padding: 6px 7px; border-radius: 7px; background: transparent; color: var(--tag-ink); cursor: pointer; font-size: 11px; white-space: nowrap; }
.tag-chip:hover, .tag-chip.active { background: color-mix(in srgb,var(--tag-dot) 18%,transparent); color: var(--tag-ink); }
.tag-chip.active { box-shadow: inset 0 0 0 1px var(--tag-dot); }
.tag-options { display: inline-grid; place-items: center; flex: 0 0 auto; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--tag-ink,var(--muted)); font-size: 18px; cursor: pointer; }
.tag-options:hover { background: var(--hover-bg); }
.tag-badge { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; min-width: 0; overflow: hidden; white-space: nowrap; padding: 3px 6px; border-radius: 6px; font-size: 11px; line-height: 1.4; color: var(--tag-ink); background: color-mix(in srgb,var(--tag-dot) 12%,var(--panel-solid)); }
.note-tag-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: -3px 0 15px; }
.note-tag-chip > button { min-width: 0; overflow: hidden; border: 0; padding: 0; min-height: 28px; background: transparent; color: inherit; cursor: pointer; }
.note-tag-chip > button[data-remove-note-tag] { flex: 0 0 auto; min-width: 26px; font-size: 17px; }
.note-tag-chip .tag-badge { background: transparent; }
.note-tags-add { min-height: 28px; padding: 3px 8px; border: 1px dashed var(--line-strong); border-radius: 8px; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.note-tags-add:hover { background: var(--hover-bg); color: var(--text); }
.tag-picker-content { display: grid; gap: 14px; padding: 20px; }
#noteTagsDialog .modal-header > div { min-width: 0; }
#noteTagsNoteTitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-picker-list { max-height: min(340px,45dvh); overflow: auto; overscroll-behavior: contain; }
.tag-picker-row { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.tag-picker-row:last-child { border-bottom: 0; }
.tag-picker-row label { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; min-height: 48px; padding: 9px 0; cursor: pointer; }
.tag-picker-row input, .tag-apply-label input { flex: 0 0 auto; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.tag-picker-empty { padding: 10px 0; }
.tag-colors-field { min-width: 0; border: 0; padding: 0; margin: 0; }
.tag-colors-field legend { margin-bottom: 10px; font-size: 13px; font-weight: 600; }
.tag-color-palette { display: flex; flex-wrap: wrap; gap: 7px; padding: 2px; }
.tag-color-choice { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 2px solid transparent; border-radius: 50%; background: var(--bg); cursor: pointer; }
.tag-color-choice .tag-dot { width: 24px; height: 24px; }
.tag-color-choice[aria-pressed="true"] { border-color: var(--text); }
.tag-color-choice[aria-pressed="true"]::after { content: '✓'; position: absolute; color: #151517; font-size: 15px; font-weight: 800; }
.folder-form .tag-apply-label { display: flex; align-items: flex-start; gap: 9px; line-height: 1.5; font-size: 12px; font-weight: 400; }
.folder-form .tag-apply-label input { width: 18px; height: 18px; min-height: 18px; padding: 0; margin-top: 1px; }
#tagNameInput[readonly] { color: var(--muted); }
.sidebar-footer { display: grid; gap: 4px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.sidebar-footer-button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; padding: 8px 10px; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; text-align: left; }
.sidebar-footer-button:hover { background: var(--hover-bg); color: var(--text); }
.sidebar-footer-button .footer-status-dot { margin-left: auto; }
.theme-icon { width: 14px; height: 14px; border-radius: 50%; background: linear-gradient(135deg, currentColor 50%, transparent 50%); border: 1px solid currentColor; }
.cloud-icon, .mini-cloud { width: 15px; height: 9px; border: 1.5px solid currentColor; border-radius: 8px; position: relative; display: inline-block; }
.cloud-icon::before, .mini-cloud::before { content: ""; position: absolute; width: 7px; height: 7px; border: 1.5px solid currentColor; border-bottom: 0; border-radius: 50% 50% 0 0; left: 3px; top: -5px; background: var(--sidebar); }
.mini-cloud::before { background: var(--editor); }

.notes-column { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.column-header { flex-shrink: 0; min-height: 85px; padding: 22px 18px 14px; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.notes-title-wrap { min-width: 0; }
.notes-title-wrap h2 { margin: 3px 0 0; font-family: var(--serif); letter-spacing: -.04em; font-size: 25px; line-height: 1.1; }
.header-actions { display: flex; align-items: center; gap: 3px; }
.new-note-button, .primary-button { border: 0; cursor: pointer; border-radius: 11px; background: var(--accent); color: #312500; font-weight: 700; transition: transform .18s ease, box-shadow .18s ease; }
.new-note-button { height: 34px; padding: 0 10px; display: inline-flex; flex-shrink: 0; gap: 6px; align-items: center; white-space: nowrap; font-size: 12px; }
.new-note-button:hover, .primary-button:hover { transform: translateY(-1px); box-shadow: 0 7px 18px rgba(242,182,0,.2); }
.plus-icon { width: 14px; height: 14px; position: relative; }
.plus-icon::before, .plus-icon::after { content: ""; position: absolute; background: currentColor; border-radius: 2px; }
.plus-icon::before { width: 12px; height: 2px; left: 1px; top: 6px; }
.plus-icon::after { height: 12px; width: 2px; left: 6px; top: 1px; }
.active-filter-row { padding: 10px 18px 0; }
.active-filter { display: inline-flex; gap: 7px; align-items: center; padding: 5px 8px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); font-size: 11px; }
.active-filter button { border: 0; background: transparent; cursor: pointer; color: inherit; padding: 0; }
.notes-list { flex: 1; min-height: 0; overflow: auto; padding: 10px 10px 60px; overscroll-behavior: contain; }
.notes-list.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 9px; }
.list-group-label { padding: 11px 9px 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.gallery .list-group-label { grid-column: 1 / -1; }
.note-row { position: relative; display: grid; gap: 4px; min-height: 72px; padding: 12px 12px 11px; border: 1px solid transparent; border-radius: 12px; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.notes-list:not(.gallery) .note-row { min-height: 54px; padding: 8px 12px; gap: 3px; align-content: start; }
.note-row:hover { background: var(--hover-bg); }
.note-row.active { background: var(--panel-solid); border-color: var(--line); box-shadow: 0 5px 13px rgba(50,50,55,.05); }
.note-row.dragging { opacity: .5; transform: scale(.98); }
.note-row-head { display: flex; align-items: center; gap: 6px; }
.note-row-title { min-width: 0; flex: 1; font-size: 13px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-row-time { color: var(--muted); font-size: 10px; white-space: nowrap; }
.note-row-preview { min-width: 0; color: var(--muted); font-size: 11px; line-height: 1.42; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notes-list:not(.gallery) .note-row-preview { display: block; white-space: nowrap; text-overflow: ellipsis; }
.note-row-meta { display: flex; gap: 5px; align-items: center; min-height: 13px; }
.notes-list:not(.gallery) .note-row-meta:empty { display: none; }
.row-tag { color: var(--accent-ink); font-size: 10px; }
.row-pin { color: var(--accent); font-size: 11px; }
.note-row mark { color: var(--match-ink); background: var(--match-bg); border-radius: 2px; padding: 0 1px; }
.gallery .note-row { min-height: 135px; padding: 12px; background: var(--panel-solid); border-color: var(--line); }
.gallery .note-row:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.gallery .note-row-title { white-space: normal; }
.gallery .note-row-preview { -webkit-line-clamp: 5; }
.gallery .note-row-time { font-size: 10px; }
.list-check { width: 12px; height: 12px; border-radius: 4px; accent-color: var(--accent); }
.column-bottom-bar { position: absolute; bottom: 0; left: 0; right: 0; justify-content: space-between; padding: 10px 18px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--panel-solid) 88%, transparent); backdrop-filter: blur(15px); color: var(--muted); font-size: 10px; }
.sync-label { display: inline-flex; align-items: center; gap: 6px; }

.editor-column { display: flex; flex-direction: column; background: var(--editor); min-width: 0; }
.editor-topbar { flex-shrink: 0; min-height: 58px; padding: 12px 24px; border-bottom: 1px solid var(--line); justify-content: space-between; }
.breadcrumb { max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.editor-actions { display: flex; gap: 4px; align-items: center; }
.status-button { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 11px; cursor: default; }
.status-icon { width: 10px; height: 10px; border-radius: 50%; background: #58b875; box-shadow: 0 0 0 3px rgba(88,184,117,.12); }
.status-button.saving .status-icon { background: var(--accent); animation: pulse 1s infinite; }
.status-button.offline .status-icon { background: var(--muted); }
@keyframes pulse { 50% { opacity: .45; } }
.editor-scroll { min-height: 0; overflow-x: hidden; overflow-y: auto; flex: 1; overscroll-behavior: contain; touch-action: pan-y pinch-zoom; -webkit-overflow-scrolling: touch; }
.editor-content { max-width: 800px; margin: 0 auto; padding: 34px clamp(24px, 6vw, 84px) 80px; }
.note-meta-row { gap: 9px; margin-bottom: 14px; }
.note-date { color: var(--muted); font-size: 11px; }
.note-folder-chip { padding: 4px 8px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-ink); font-size: 10px; }
.pin-toggle { margin-left: auto; width: 29px; height: 29px; color: var(--faint); border-radius: 8px; }
.pin-toggle:hover { background: var(--accent-soft); color: var(--accent-ink); }
.pin-toggle::before { content: "☆"; font-size: 22px; line-height: 1; }
.pin-toggle.pinned { color: var(--accent); }
.pin-toggle.pinned::before { content: "★"; }
.note-title-input { width: 100%; border: 0; outline: 0; padding: 0; margin: 0 0 15px; color: var(--text); background: transparent; font-family: var(--serif); font-size: clamp(28px, 4vw, 42px); font-weight: 750; letter-spacing: -.05em; line-height: 1.1; }
.note-title-input::placeholder { color: var(--faint); }
.editor-toolbar { position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: nowrap; align-items: center; gap: 0; min-width: 0; margin: 0 -9px 12px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--editor) 88%, transparent); backdrop-filter: blur(16px); opacity: var(--toolbar-opacity); transition: opacity .2s ease, box-shadow .2s ease; }
.editor-toolbar > button, .editor-toolbar > .toolbar-divider { flex-shrink: 0; }
.toolbar-row-break { display: none; }
.editor-toolbar:focus-within, .editor-toolbar:hover { opacity: 1; box-shadow: 0 4px 16px rgba(40,40,45,.06); }
.editor-toolbar button { min-width: 25px; height: 26px; padding: 0 3px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.editor-toolbar button:hover, .editor-toolbar button.active { color: var(--text); background: var(--accent-soft); }
.editor-toolbar button[aria-expanded="true"] { color: var(--accent-ink); background: var(--accent-soft); }
.editor-toolbar .undo-note-button { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; }
.undo-note-button svg { display: block; pointer-events: none; }
.editor-toolbar button:disabled { opacity: .35; cursor: default; }
.editor-toolbar button:disabled:hover { color: var(--muted); background: transparent; }
#findNoteButton { display: inline-flex; align-items: center; justify-content: center; }
#findNoteButton svg { pointer-events: none; }
.note-search-bar { position: fixed; z-index: 22; display: flex; align-items: center; gap: 4px; padding: 5px 6px 5px 12px; min-height: 40px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--panel-solid); color: var(--muted); box-shadow: 0 4px 18px rgba(0,0,0,.12); }
.note-search-bar .search-icon { width: 12px; height: 12px; margin-right: 5px; }
.note-search-bar input { flex: 1; width: 0; min-width: 0; padding: 5px 2px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 14px; }
.note-search-bar input::placeholder { color: var(--muted); }
.note-search-bar input::-webkit-search-cancel-button { display: none; }
.note-search-bar button { flex: 0 0 32px; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--text); font-size: 19px; cursor: pointer; touch-action: manipulation; }
.note-search-bar button:hover { background: var(--accent-soft); }
.note-search-bar button:disabled { opacity: .3; cursor: default; }
.note-search-count { flex: 0 0 auto; min-width: 27px; text-align: center; font-size: 11px; font-variant-numeric: tabular-nums; }
.note-search-bar.no-results .note-search-count { color: var(--danger); }
::highlight(note-find) { background-color: var(--match-bg); color: var(--match-ink); }
::highlight(note-find-current) { background-color: #e9a820; color: #201800; }
.note-search-overlay { pointer-events: none; position: fixed; inset: 0; z-index: 2; }
.note-search-overlay span { position: fixed; border-radius: 2px; background: rgba(242,182,0,.28); }
.note-search-overlay span.current { background: rgba(242,160,0,.5); outline: 1px solid var(--accent); }
@media (max-width: 1000px) and (min-width: 701px) {
  .editor-toolbar button, .editor-toolbar .undo-note-button, .editor-toolbar .emoji-button, .editor-toolbar .copy-note-button { min-width: 22px; padding: 0 1px; }
  .editor-toolbar .font-family-control { flex-basis: 64px; width: 64px; min-width: 56px; }
  .editor-toolbar .font-size-control { min-width: 28px; gap: 1px; }
  .editor-toolbar .toolbar-divider { display: none; }
}
.text-format-menu { position: fixed; z-index: 45; width: min(292px, calc(100vw - 20px)); margin: 0; padding: 7px; overflow: auto; overscroll-behavior: contain; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--panel-solid); color: var(--text); box-shadow: 0 12px 40px rgba(0,0,0,.18); }
.text-format-menu button { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 7px 12px 7px 31px; border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left; font: inherit; font-size: 14px; cursor: pointer; }
.text-format-menu button:hover, .text-format-menu button:focus-visible { background: var(--accent-soft); }
.text-format-menu button[aria-pressed="true"]::before { content: "✓"; position: absolute; left: 10px; color: var(--accent-ink); font-size: 15px; font-weight: 600; }
.format-inline { display: grid; grid-template-columns: repeat(4,1fr); gap: 4px; padding: 2px 5px 7px; }
.format-inline button { justify-content: center; min-height: 42px; padding: 3px; font-size: 23px; }
.format-inline button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); }
.format-inline button[aria-pressed="true"]::before { content: none; }
.format-group { padding: 5px 0; border-top: 1px solid var(--line); }
.format-group:last-child { padding-bottom: 0; }
.format-caption { margin: 5px 12px 3px 31px; color: var(--muted); font-size: 10px; }
.text-format-menu .format-title { font-size: 25px; font-weight: 750; letter-spacing: -.03em; }
.text-format-menu .format-heading { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.text-format-menu .format-subheading { font-size: 16px; font-weight: 650; }
.text-format-menu .format-monospace { font-family: Menlo, Consolas, monospace; }
.format-symbol { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 18px; }
.text-format-menu .format-reset { color: var(--muted); font-size: 12px; }
.editor-toolbar .font-control { display: inline-flex; align-items: center; gap: 3px; justify-content: space-between; min-height: 26px; border: 1px solid var(--line); }
.editor-toolbar .font-family-control { flex: 0 1 104px; width: 104px; min-width: 70px; }
.editor-toolbar .font-size-control { min-width: 36px; }
.font-control-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.font-control-arrow { flex: 0 0 auto; font-size: 11px; }
.typography-menu { width: min(288px,calc(100vw - 20px)); }
.typography-caption { margin: 6px 12px 8px; color: var(--muted); font-size: 12px; }
.font-family-menu button { justify-content: space-between; min-height: 42px; font-size: 16px; }
.font-family-menu button[aria-pressed="true"] { color: var(--accent-ink); background: color-mix(in srgb,var(--accent-soft) 65%,var(--panel-solid)); }
.font-sample { margin-left: 10px; color: var(--muted); }
.font-size-menu { width: min(222px,calc(100vw - 20px)); }
.font-size-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 4px; }
.font-size-grid button { justify-content: center; min-height: 44px; padding: 8px 13px; font-size: 16px; font-variant-numeric: tabular-nums; }
.font-size-grid button[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent-soft); }
.font-size-grid button[aria-pressed="true"]::before { content: none; }
.editor-toolbar .emoji-button { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; }
.emoji-button svg { display: block; pointer-events: none; }
.emoji-menu { width: min(300px, calc(100vw - 20px)); }
.emoji-menu-title { margin: 5px 8px 8px; color: var(--muted); font-size: 12px; }
.emoji-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; }
.emoji-menu button { gap: 9px; min-height: 47px; padding: 7px 9px; }
.emoji-symbol { flex: 0 0 27px; font-family: 'Apple Color Emoji','Segoe UI Emoji','Noto Color Emoji',sans-serif; font-size: 23px; line-height: 1.3; text-align: center; }
.emoji-label { font-size: 12px; white-space: nowrap; }
.editor-toolbar .copy-note-button { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; }
.copy-note-button svg { display: block; flex-shrink: 0; pointer-events: none; }
.toolbar-divider { width: 1px; height: 17px; background: var(--line-strong); margin: 0 2px; }
.highlight-glyph { text-decoration: underline; text-decoration-thickness: 5px; text-decoration-color: #ffe27b; }
.toolbar-check { display: inline-grid; place-items: center; width: 14px; height: 14px; border: 1.5px solid currentColor; border-radius: 4px; font-size: 9px; }
.table-glyph { font-size: 18px; line-height: 1; }
.divider-glyph { display: inline-block; width: 15px; height: 1px; background: currentColor; vertical-align: middle; }
.link-glyph { font-size: 18px; line-height: 1; }
.paperclip-glyph { display: inline-block; width: 10px; height: 15px; border: 1.5px solid currentColor; border-radius: 6px; transform: rotate(38deg); border-top-color: transparent; }
.note-body { min-height: 310px; outline: 0; font-size: 10pt; line-height: 1.35; color: var(--text); caret-color: var(--accent); white-space: pre-wrap; overflow-wrap: anywhere; }
.note-body:empty::before { content: attr(data-placeholder); color: var(--faint); pointer-events: none; }
.note-body h1, .note-body h2, .note-body h3 { margin: 22px 0 8px; font-family: var(--serif); letter-spacing: -.03em; line-height: 1.25; }
.note-body h1 { font-size: 30px; font-weight: 750; }
.note-body h2 { font-size: 23px; font-weight: 700; }
.note-body h3 { font-size: 19px; font-weight: 650; }
.note-body pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 1em/1.35 Menlo, Consolas, monospace; }
.note-body blockquote { margin: 8px 0; padding: 1px 0 1px 16px; border-left: 3px solid var(--line-strong); color: var(--muted); }
.note-body ul.dash-list { list-style-type: '—  '; }
.note-body p { margin: 0; }
.note-body ul, .note-body ol { margin: 4px 0; padding-left: 27px; }
.note-body li { padding-left: 4px; margin: 0; }
.note-body a { color: var(--blue); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--blue) 36%, transparent); }
.note-body mark, .note-body [style*="background-color: rgb(255, 240, 168)"], .note-body [style*="background-color: #fff0a8"] { color: var(--match-ink); background-color: var(--match-bg) !important; }
.note-body hr { border: 0; border-top: 1px solid var(--line-strong); margin: 24px 0; }
.note-body table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: inherit; }
.note-body td, .note-body th { border: 1px solid var(--line-strong); padding: 8px 10px; text-align: left; }
.note-body th { background: var(--accent-soft); font-weight: 700; }
.task-line { display: flex; align-items: flex-start; gap: 9px; margin: 3px 0; line-height: 1.35; }
.task-line input { flex: 0 0 auto; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); }
.task-line > span { flex: 1; min-width: 0; min-height: 1.35em; overflow-wrap: anywhere; }
.task-line.is-done span { color: var(--muted); text-decoration: line-through; }
.attachments { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 24px; }
.attachment-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 260px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: color-mix(in srgb, var(--panel-solid) 80%, transparent); font-size: 11px; }
.attachment-chip .file-icon { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; color: var(--accent-ink); background: var(--accent-soft); font-size: 10px; font-weight: 700; }
.attachment-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip .file-icon, .attachment-chip small { flex-shrink: 0; }
.attachment-name { min-width: 0; }
.remove-attachment { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 23px; cursor: pointer; touch-action: manipulation; }
.remove-attachment:hover, .remove-attachment:focus-visible { color: var(--text); background: var(--accent-soft); }
@media (pointer: coarse) { .remove-attachment { flex-basis: 44px; width: 44px; height: 44px; } }
.editor-footer { justify-content: space-between; gap: 12px; margin-top: 26px; color: var(--muted); font-size: 10px; }
.editor-empty { height: 100%; min-height: 480px; display: grid; place-content: center; justify-items: center; gap: 7px; color: var(--muted); text-align: center; }
.editor-empty h2 { margin: 11px 0 0; color: var(--text); font-family: var(--serif); font-size: 22px; letter-spacing: -.04em; }
.editor-empty p { margin: 0 0 10px; font-size: 13px; }
.empty-note-icon { width: 66px; height: 82px; border: 2px solid var(--line-strong); border-radius: 9px; transform: rotate(-4deg); position: relative; }
.empty-note-icon::before, .empty-note-icon::after { content: ""; position: absolute; left: 13px; right: 13px; height: 2px; border-radius: 2px; background: var(--line-strong); }
.empty-note-icon::before { top: 28px; box-shadow: 0 10px 0 var(--line-strong), 0 20px 0 var(--line-strong); }
.primary-button { padding: 10px 15px; font-size: 12px; }

.toast { position: fixed; left: 50%; bottom: 25px; z-index: 30; padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-solid); box-shadow: var(--shadow); color: var(--text); font-size: 12px; opacity: 0; transform: translate(-50%, 14px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.context-menu { position: fixed; z-index: 40; width: 210px; min-width: 170px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow: auto; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-solid); box-shadow: var(--shadow); }
.context-menu button { width: 100%; border: 0; padding: 8px 9px; border-radius: 7px; background: transparent; text-align: left; cursor: pointer; color: var(--text); font-size: 12px; }
.context-menu button:hover { background: var(--accent-soft); }
.context-menu button.danger { color: var(--danger); }
.context-menu[data-mode="quick"] button { min-height: 46px; padding: 11px 12px; font-size: 14px; }
.sort-menu button { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; }
.sort-menu button::before { content: ''; width: 16px; flex-shrink: 0; }
.sort-menu button[aria-checked="true"] { background: var(--accent-soft); color: var(--accent-ink); }
.sort-menu button[aria-checked="true"]::before { content: '✓'; }

.modal { width: min(520px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--panel-solid); color: var(--text); box-shadow: var(--shadow); }
.modal::backdrop { background: var(--backdrop); backdrop-filter: blur(3px); }
.modal-header { justify-content: space-between; gap: 12px; padding: 18px 20px 15px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 3px 0 0; font-family: var(--serif); font-size: 23px; letter-spacing: -.04em; }
.modal-header .icon-button { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 50%; background: var(--control-bg); font-size: 24px; line-height: 1; }
.modal-header .icon-button::before, .modal-header .icon-button::after { display: none; }
.folder-form { display: grid; gap: 12px; padding: 20px; }
.folder-form label { font-size: 13px; font-weight: 600; }
.folder-form input, .folder-form select { min-width: 0; width: 100%; min-height: 44px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px; background: var(--bg); color: var(--text); font: inherit; font-size: 16px; }
.folder-form input:focus, .folder-form select:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-hint { margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.form-error { margin: 0; font-size: 12px; color: var(--danger); }
.form-error:empty { display: none; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.dialog-actions button { min-height: 44px; }
.dialog-actions .cancel-button { background: var(--bg); color: var(--text); }
.danger-button { margin-right: auto; border: 0; background: transparent; color: var(--danger); border-radius: 9px; padding: 10px 0; font-size: 13px; cursor: pointer; }
.history-list { max-height: 460px; overflow: auto; padding: 10px; }
.history-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 10px; border-bottom: 1px solid var(--line); }
.history-item:last-child { border-bottom: 0; }
.history-item strong { display: block; font-size: 12px; }
.history-item span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.history-item button { flex: 0 0 auto; padding: 7px 9px; border: 0; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); cursor: pointer; font-size: 11px; }
.settings-list { padding: 7px 20px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.setting-row > span:first-child { display: grid; gap: 4px; }
.setting-row strong { font-size: 12px; }
.setting-row small { color: var(--muted); font-size: 11px; }
.setting-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 35px; height: 21px; flex: 0 0 auto; border-radius: 999px; background: var(--line-strong); transition: background .2s ease; }
.switch::after { content: ""; position: absolute; width: 17px; height: 17px; top: 2px; left: 2px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.16); transition: transform .2s ease; }
.setting-row input:checked + .switch { background: var(--accent); }
.setting-row input:checked + .switch::after { transform: translateX(14px); }
.settings-storage { display: flex; gap: 10px; margin: 12px 20px 20px; padding: 12px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); }
.settings-storage strong { display: block; font-size: 12px; }
.settings-install { margin: 12px 20px 20px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.settings-install strong { font-size: 12px; }
.settings-install p { margin: 7px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.settings-install .primary-button { margin: 4px 0; min-height: 44px; }
.settings-storage p { margin: 5px 0 0; color: color-mix(in srgb, var(--accent-ink) 80%, var(--text)); font-size: 11px; line-height: 1.45; }
.storage-icon { width: 20px; height: 20px; flex: 0 0 auto; border: 2px solid currentColor; border-radius: 5px; margin-top: 1px; }

.mobile-only, .mobile-tabbar { display: none; }

@media (max-width: 1200px) and (min-width: 701px) {
  .app { grid-template-columns: clamp(150px,18vw,220px) clamp(190px,24vw,285px) minmax(0,1fr); }
  .editor-content { padding-left: 18px; padding-right: 18px; }
}

@media (max-width: 900px) and (min-width: 701px) {
  .button-label { display: none; }
  .new-note-button { padding: 0 9px; }
  .editor-content { padding-left: 12px; padding-right: 12px; }
}

@media (max-width: 760px) and (min-width: 701px) {
  .editor-toolbar { padding: 3px; }
  .editor-toolbar button, .editor-toolbar .undo-note-button, .editor-toolbar .emoji-button, .editor-toolbar .copy-note-button { min-width: 19px; padding: 0 1px; font-size: 11px; }
  .editor-toolbar .font-family-control { flex-basis: 64px; width: 64px; min-width: 56px; }
  .editor-toolbar .font-size-control { min-width: 26px; gap: 1px; }
  .editor-toolbar .toolbar-divider { display: none; }
}

@media (max-width: 700px) {
  .app { display: block; position: relative; }
  .sidebar, .notes-column, .editor-column { display: none; width: 100%; height: 100%; border: 0; }
  .app[data-mobile-panel="folders"] .sidebar, .app[data-mobile-panel="notes"] .notes-column, .app[data-mobile-panel="editor"] .editor-column { display: flex; }
  .app[data-mobile-panel="editor"] .editor-column { display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
  .sidebar { padding: max(17px, env(safe-area-inset-top)) 16px calc(80px + env(safe-area-inset-bottom)); gap: 16px; }
  .sidebar-topbar { min-height: 40px; }
  .sidebar-topbar h1 { font-size: 16px; }
  .profile-card { padding: 11px; }
  .folder-nav { gap: 4px; }
  .folder-item { padding: 12px 11px; font-size: 14px; }
  .folder-item.editable-folder { padding-right: 52px; }
  .folder-options { width: 44px; height: 44px; }
  #newFolderButton { width: 44px; height: 44px; font-size: 23px; color: var(--accent-ink); }
  .tag-list { gap: 8px; }
  .tag-chip { padding: 7px 10px; font-size: 12px; }
  .tag-options { width: 40px; height: 40px; }
  .note-tag-chip > button { min-height: 34px; }
  .note-tag-chip > button[data-remove-note-tag] { min-width: 34px; }
  .sidebar-footer { margin-top: auto; }
  .sidebar-footer-button { padding: 11px; font-size: 12px; }
  .column-header { min-height: 78px; padding: max(14px, env(safe-area-inset-top)) 15px 12px; align-items: center; }
  .notes-header { gap: 4px; }
  .mobile-header-actions { width: 34px; }
  .mobile-only { display: inline-grid; }
  .notes-title-wrap h2 { font-size: 24px; }
  .notes-list { padding: 10px 10px 100px; }
  .note-row { min-height: 81px; padding: 13px 12px; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: pan-y pinch-zoom; }
  .notes-list.gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .gallery .note-row { min-height: 154px; }
  .sort-button { display: none; }
  .editor-topbar { min-height: 57px; padding: max(10px, env(safe-area-inset-top)) 13px 9px; }
  .editor-topbar .breadcrumb { flex: 1; margin-left: 5px; }
  .editor-actions { gap: 1px; }
  .editor-actions .status-button span:last-child { display: none; }
  .editor-content { padding: 18px 14px calc(160px + var(--notes-visual-inset,0px) + env(safe-area-inset-bottom)); }
  .note-title-input { font-size: 32px; }
  .editor-toolbar { display: none; position: relative; top: auto; bottom: auto; margin: 0 -8px 10px; padding: 3px 4px; flex-wrap: wrap; justify-content: space-between; gap: 0 1px; opacity: 1; background: color-mix(in srgb,var(--editor) 76%,transparent); border-radius: 10px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 2px 12px rgba(40,40,45,.09); }
  .editor-toolbar[data-mobile-open] { display: flex; position: fixed; z-index: 20; max-width: 520px; margin: 0; }
  .editor-toolbar > button, .editor-toolbar .undo-note-button, .editor-toolbar .emoji-button, .editor-toolbar .copy-note-button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 32px; width: 32px; min-width: 0; height: 32px; min-height: 32px; padding: 0 3px; }
  .editor-toolbar .font-control { justify-content: space-between; min-height: 32px; }
  .editor-toolbar .font-family-control { flex-basis: 92px; width: 92px; }
  .editor-toolbar .font-size-control { flex-basis: 36px; width: 36px; }
  .editor-toolbar .toolbar-divider { display: none; }
  .editor-toolbar .toolbar-row-break { display: block; flex: 0 0 100%; height: 0; }
  .text-format-menu button { min-height: 44px; }
  .note-body { min-height: 420px; }
  .editor-footer { display: none; }
  .column-bottom-bar { bottom: 60px; padding-bottom: 9px; }
  .mobile-tabbar { position: fixed; z-index: 10; left: 0; right: 0; bottom: 0; height: calc(60px + env(safe-area-inset-bottom)); padding: 6px 12px env(safe-area-inset-bottom); display: grid; grid-template-columns: 1fr 1fr 1fr; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--panel-solid) 90%, transparent); backdrop-filter: blur(20px); }
  .mobile-tabbar.with-format { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .mobile-tabbar button { border: 0; background: transparent; color: var(--muted); display: grid; place-content: center; gap: 4px; font-size: 10px; cursor: pointer; }
  .mobile-tabbar button.active, .mobile-tabbar button[aria-expanded="true"] { color: var(--accent-ink); }
  .tab-format-icon { display: grid; place-items: center; width: 31px; height: 31px; margin: 0 auto; border-radius: 9px; font-size: 25px; font-weight: 600; line-height: 1; }
  .mobile-tabbar button[aria-expanded="true"] .tab-format-icon { background: var(--accent-soft); }
  .mobile-tabbar button[data-mobile-target="editor"] { color: var(--accent-ink); }
  .tab-compose-icon { width: 31px; height: 31px; display: grid; place-items: center; margin: 0 auto; border-radius: 11px; background: var(--accent); color: #322700; font-size: 22px; line-height: 1; box-shadow: 0 5px 12px rgba(242,182,0,.22); }
  .tab-folder-icon, .tab-note-icon { width: 18px; height: 18px; margin: 0 auto; position: relative; }
  .tab-folder-icon::before { content: ""; position: absolute; inset: 3px 1px 2px; border: 1.5px solid currentColor; border-radius: 4px; clip-path: polygon(0 23%, 36% 23%, 47% 0, 85% 0, 100% 23%, 100% 100%, 0 100%); }
  .tab-note-icon::before { content: ""; position: absolute; inset: 1px 3px; border: 1.5px solid currentColor; border-radius: 4px; box-shadow: inset 0 4px 0 transparent; }
  .tab-note-icon::after { content: ""; position: absolute; width: 7px; height: 1.5px; background: currentColor; left: 6px; top: 7px; box-shadow: 0 4px 0 currentColor; }
  .editor-empty { min-height: calc(100svh - 120px); }
  .empty-note-icon { width: 56px; height: 70px; }
  .context-menu { max-width: calc(100vw - 32px); }
  .modal-header .icon-button { width: 44px; height: 44px; }
}

@media (max-width: 380px) {
  .status-button { display: none; }
}


@media (max-width: 700px) {
  .note-search-bar { gap: 2px; padding: 3px 4px 3px 9px; }
  .note-search-bar input { font-size: 16px; }
  .note-search-bar button { flex-basis: 38px; width: 38px; height: 38px; }
}

@media (min-width: 701px) { .editor-toolbar[data-find-open] { visibility: hidden; } }
