/* === Themes === */

/* Catppuccin Latte (Light) */
[data-theme="catppuccin-latte"] {
  --bg: #eff1f5; --bg-alt: #e6e9ef; --bg-elevated: #ccd0da; --bg-hover: #bcc0cc;
  --border: #ccd0da; --border-focus: #7287fd;
  --text: #4c4f69; --text-muted: #6c6f85; --text-faint: #9ca0b0;
  --accent: #8839ef; --accent-hover: #ea76cb;
  --danger: #d20f39; --danger-hover: #e64553;
  --success: #40a02b; --warning: #df8e1d; --info: #04a5e5;
}

/* Catppuccin Frappé */
[data-theme="catppuccin-frappe"] {
  --bg: #303446; --bg-alt: #292c3c; --bg-elevated: #414559; --bg-hover: #51576d;
  --border: #414559; --border-focus: #babbf1;
  --text: #c6d0f5; --text-muted: #b5bfe2; --text-faint: #737994;
  --accent: #ca9ee6; --accent-hover: #f4b8e4;
  --danger: #e78284; --danger-hover: #ea999c;
  --success: #a6d189; --warning: #e5c890; --info: #99d1db;
}

/* Catppuccin Macchiato */
[data-theme="catppuccin-macchiato"] {
  --bg: #24273a; --bg-alt: #1e2030; --bg-elevated: #363a4f; --bg-hover: #494d64;
  --border: #363a4f; --border-focus: #b7bdf8;
  --text: #cad3f5; --text-muted: #b8c0e0; --text-faint: #6e738d;
  --accent: #c6a0f6; --accent-hover: #f5bde6;
  --danger: #ed8796; --danger-hover: #ee99a0;
  --success: #a6da95; --warning: #eed49f; --info: #8bd5ca;
}

/* Catppuccin Mocha */
[data-theme="catppuccin-mocha"] {
  --bg: #1e1e2e; --bg-alt: #181825; --bg-elevated: #313244; --bg-hover: #45475a;
  --border: #313244; --border-focus: #b4befe;
  --text: #cdd6f4; --text-muted: #a6adc8; --text-faint: #6c7086;
  --accent: #cba6f7; --accent-hover: #f5c2e7;
  --danger: #f38ba8; --danger-hover: #eba0ac;
  --success: #a6e3a1; --warning: #f9e2af; --info: #89dceb;
}

/* Nord Dark */
[data-theme="nord-dark"] {
  --bg: #2e3440; --bg-alt: #3b4252; --bg-elevated: #434c5e; --bg-hover: #4c566a;
  --border: #434c5e; --border-focus: #88c0d0;
  --text: #eceff4; --text-muted: #d8dee9; --text-faint: #81a1c1;
  --accent: #88c0d0; --accent-hover: #8fbcbb;
  --danger: #bf616a; --danger-hover: #d08770;
  --success: #a3be8c; --warning: #ebcb8b; --info: #81a1c1;
}

/* One Dark */
[data-theme="one-dark"] {
  --bg: #282c34; --bg-alt: #21252b; --bg-elevated: #333842; --bg-hover: #3a3f4b;
  --border: #333842; --border-focus: #528bff;
  --text: #abb2bf; --text-muted: #828997; --text-faint: #5c6370;
  --accent: #61afef; --accent-hover: #56b6c2;
  --danger: #e06c75; --danger-hover: #be5046;
  --success: #98c379; --warning: #e5c07b; --info: #56b6c2;
}

/* One Light */
[data-theme="one-light"] {
  --bg: #fafafa; --bg-alt: #f0f0f1; --bg-elevated: #e5e5e6; --bg-hover: #dbdbdc;
  --border: #e5e5e6; --border-focus: #526fff;
  --text: #383a42; --text-muted: #696c77; --text-faint: #a0a1a7;
  --accent: #4078f2; --accent-hover: #0184bc;
  --danger: #e45649; --danger-hover: #ca1243;
  --success: #50a14f; --warning: #c18401; --info: #0184bc;
}

/* Nord Light */
[data-theme="nord-light"] {
  --bg: #eceff4; --bg-alt: #e5e9f0; --bg-elevated: #d8dee9; --bg-hover: #c8d0e0;
  --border: #d8dee9; --border-focus: #5e81ac;
  --text: #2e3440; --text-muted: #4c566a; --text-faint: #81a1c1;
  --accent: #5e81ac; --accent-hover: #81a1c1;
  --danger: #bf616a; --danger-hover: #d08770;
  --success: #a3be8c; --warning: #d08770; --info: #88c0d0;
}

/* Tokyo Night Dark */
[data-theme="tokyo-night-dark"] {
  --bg: #1a1b26; --bg-alt: #16161e; --bg-elevated: #24283b; --bg-hover: #292e42;
  --border: #24283b; --border-focus: #7aa2f7;
  --text: #c0caf5; --text-muted: #a9b1d6; --text-faint: #565f89;
  --accent: #7aa2f7; --accent-hover: #89ddff;
  --danger: #f7768e; --danger-hover: #ff9e64;
  --success: #9ece6a; --warning: #e0af68; --info: #7dcfff;
}

/* Tokyo Night Light */
[data-theme="tokyo-night-light"] {
  --bg: #e1e2e7; --bg-alt: #d5d6db; --bg-elevated: #c9cbd3; --bg-hover: #bdbfc7;
  --border: #c9cbd3; --border-focus: #2e7de9;
  --text: #3760bf; --text-muted: #4c5087; --text-faint: #848cb5;
  --accent: #2e7de9; --accent-hover: #188092;
  --danger: #f52a65; --danger-hover: #c64343;
  --success: #587539; --warning: #8f5e15; --info: #07879d;
}

/* Dracula Dark */
[data-theme="dracula-dark"] {
  --bg: #282a36; --bg-alt: #1e1f29; --bg-elevated: #343746; --bg-hover: #44475a;
  --border: #343746; --border-focus: #bd93f9;
  --text: #f8f8f2; --text-muted: #cfcfc2; --text-faint: #6272a4;
  --accent: #bd93f9; --accent-hover: #ff79c6;
  --danger: #ff5555; --danger-hover: #ff6e6e;
  --success: #50fa7b; --warning: #ffb86c; --info: #8be9fd;
}

/* Dracula Light */
[data-theme="dracula-light"] {
  --bg: #f8f8f2; --bg-alt: #f0f0ea; --bg-elevated: #e8e6df; --bg-hover: #ddd9cf;
  --border: #e8e6df; --border-focus: #bd93f9;
  --text: #282a36; --text-muted: #4d4f68; --text-faint: #6272a4;
  --accent: #9b6ad9; --accent-hover: #d0559e;
  --danger: #e04444; --danger-hover: #c03030;
  --success: #3a8c4e; --warning: #c07020; --info: #5ea0b0;
}

/* GitHub Dark */
[data-theme="github-dark"] {
  --bg: #0d1117; --bg-alt: #161b22; --bg-elevated: #21262d; --bg-hover: #30363d;
  --border: #30363d; --border-focus: #58a6ff;
  --text: #c9d1d9; --text-muted: #8b949e; --text-faint: #484f58;
  --accent: #58a6ff; --accent-hover: #79c0ff;
  --danger: #f85149; --danger-hover: #ff7b72;
  --success: #3fb950; --warning: #d29922; --info: #58a6ff;
}

/* GitHub Light */
[data-theme="github-light"] {
  --bg: #ffffff; --bg-alt: #f6f8fa; --bg-elevated: #eaeef2; --bg-hover: #d0d7de;
  --border: #d0d7de; --border-focus: #0969da;
  --text: #1f2328; --text-muted: #656d76; --text-faint: #8c959f;
  --accent: #0969da; --accent-hover: #0550ae;
  --danger: #cf222e; --danger-hover: #a40e26;
  --success: #1a7f37; --warning: #9a6700; --info: #0969da;
}

:root {
  --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
  --radius: 8px; --radius-sm: 6px; --radius-lg: 12px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --transition: 150ms ease;
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--text); min-height: 100vh; min-height: 100dvh; overflow: hidden; }
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* === Header === */
.app-header { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--bg-alt); border-bottom: 1px solid var(--border); z-index: 100; min-height: 52px; }
.app-title { font-size: 1.15rem; font-weight: 700; color: var(--accent); flex: 1; letter-spacing: -0.02em; margin: 0; }
.header-actions { display: flex; gap: 4px; }

/* === Buttons === */
.btn-icon { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: none; background: transparent; color: var(--text-muted); border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition); }
.btn-icon i { display: flex; }
.btn-icon:hover { background: var(--bg-hover); color: var(--text); }
.btn-icon:active { transform: scale(0.95); }
.btn-danger:hover { background: var(--danger); color: var(--bg); }
.btn-primary { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; background: var(--accent); color: var(--bg); border: none; border-radius: var(--radius); font-family: var(--font-sans); font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all var(--transition); white-space: nowrap; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); font-family: var(--font-sans); font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: all var(--transition); }
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-focus); }
.btn-text { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; background: transparent; color: var(--text-muted); border: none; border-radius: var(--radius-sm); font-family: var(--font-sans); font-size: 0.8rem; font-weight: 500; cursor: pointer; transition: all var(--transition); }
.btn-text:hover { background: var(--bg-hover); color: var(--text); }

/* === App Body === */
.app-body { display: flex; flex: 1; overflow: hidden; }

/* === Sidebar === */
.sidebar { display: flex; flex-direction: column; width: 300px; min-width: 300px; background: var(--bg-alt); border-right: 1px solid var(--border); transition: transform var(--transition), opacity var(--transition); }
.sidebar-header { padding: 16px; border-bottom: 1px solid var(--border); }
.btn-new-note { width: 100%; justify-content: center; }
.search-box { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.search-input { flex: 1; background: transparent; border: none; color: var(--text); font-family: var(--font-sans); font-size: 0.85rem; outline: none; padding: 4px 0; }
.search-input::placeholder { color: var(--text-faint); }
.notes-list { flex: 1; overflow-y: auto; overflow-x: hidden; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; color: var(--text-faint); text-align: center; gap: 8px; }
.empty-state p { font-weight: 600; font-size: 0.95rem; color: var(--text-muted); }
.empty-state span { font-size: 0.8rem; }
.note-item { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background var(--transition); position: relative; }
.note-item:hover { background: var(--bg-hover); }
.note-item.active { background: var(--bg-elevated); border-left: 3px solid var(--accent); }
.note-item-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.note-item-title { font-weight: 600; font-size: 0.9rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.note-item-pin { color: var(--warning); flex-shrink: 0; opacity: 0.7; }
.note-item-preview { font-size: 0.78rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-item-date { font-size: 0.7rem; color: var(--text-faint); }
.note-item-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.note-item-tag { font-size: 0.65rem; padding: 1px 6px; background: var(--accent); color: var(--bg); border-radius: 999px; font-weight: 500; }
.sidebar-footer { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--border); gap: 8px; }
.note-count { font-size: 0.75rem; color: var(--text-faint); white-space: nowrap; }

/* === Editor === */
.editor-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
.editor-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; color: var(--text-faint); gap: 16px; }
.editor-empty h2 { font-weight: 500; font-size: 1rem; color: var(--text-muted); }
.editor-content { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.editor-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--border); min-height: 48px; }
.editor-actions { display: flex; gap: 4px; align-items: center; position: relative; }
.note-title-input { width: 100%; border: none; background: transparent; color: var(--text); font-family: var(--font-sans); font-size: 1.5rem; font-weight: 700; padding: 20px 24px 8px; outline: none; }
.note-title-input::placeholder {
  color: var(--text-faint);
}

/* === Formatting Toolbar === */
.formatting-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 24px 10px;
  position: relative;
}

.btn-fmt {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 26px;
  padding: 0 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-fmt:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border);
}

.btn-fmt:active {
  background: var(--bg-elevated);
}

.btn-fmt u,
.btn-fmt s {
  text-decoration: inherit;
}

.fmt-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 4px;
}

/* === View Toggle === */
.view-toggle { display: flex; background: var(--bg-elevated); border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); }
.view-btn { display: inline-flex !important; align-items: center; gap: 5px; padding: 5px 10px !important; font-size: 0.78rem !important; border-radius: 0 !important; color: var(--text-muted) !important; }
.view-btn.active { background: var(--accent); color: var(--bg) !important; }
.view-btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important; }
.view-btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important; }

/* === Tags === */
.tags-area { padding: 8px 24px 12px; }
.tags-input-wrap { display: flex; align-items: center; gap: 6px; color: var(--text-faint); }
.tags-input-autocomplete { flex: 1; position: relative; }
.tags-input { width: 100%; border: none; background: transparent; color: var(--text); font-family: var(--font-sans); font-size: 0.82rem; outline: none; padding: 4px 0; }
.tags-input::placeholder { color: var(--text-faint); }
.tag-suggestions { position: absolute; top: 100%; left: 0; right: 0; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); z-index: 50; max-height: 160px; overflow-y: auto; }
.tag-suggestion-item { padding: 6px 10px; font-size: 0.78rem; color: var(--text); cursor: pointer; transition: background var(--transition); }
.tag-suggestion-item:hover, .tag-suggestion-item.active { background: var(--bg-hover); color: var(--accent); }
.tags-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 0; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; background: var(--accent); border-radius: 999px; font-size: 0.72rem; color: var(--bg); font-weight: 500; }
.tag-chip .tag-remove { display: flex; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 50%; border: none; background: transparent; color: rgba(0,0,0,0.3); cursor: pointer; padding: 0; font-size: 0.7rem; line-height: 1; }
.tag-chip .tag-remove:hover { color: var(--danger); background: var(--bg-hover); }

/* === Icon Picker === */
.icon-picker {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: 60; width: 280px; max-height: 320px; display: flex; flex-direction: column; overflow: hidden; }
.icon-picker-search { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.icon-search-input { flex: 1; border: none; background: transparent; color: var(--text); font-family: var(--font-sans); font-size: 0.8rem; outline: none; }
.icon-search-input::placeholder { color: var(--text-faint); }
.icon-picker-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 8px; overflow-y: auto; flex: 1; }
.icon-picker-item { display: flex; align-items: center; justify-content: center; padding: 8px 4px; border-radius: var(--radius-sm); color: var(--text-muted); cursor: pointer; transition: all var(--transition); }
.icon-picker-item:hover { background: var(--bg-hover); color: var(--accent); }
.icon-picker-item svg { width: 20px; height: 20px; }

/* === Editor Body === */
.editor-body { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.note-content-input { flex: 1; width: 100%; border: none; background: transparent; color: var(--text); font-family: var(--font-sans); font-size: 0.95rem; line-height: 1.7; padding: 8px 24px 24px; outline: none; resize: none; }
.note-content-input::placeholder { color: var(--text-faint); }
.editor-footer { padding: 6px 24px 12px; border-top: 1px solid var(--border); }
.last-modified { font-size: 0.75rem; color: var(--text-faint); }

/* === Markdown Preview === */
.note-preview { flex: 1; overflow-y: auto; padding: 8px 24px 24px; font-size: 0.95rem; line-height: 1.7; color: var(--text); }
.note-preview h1,.note-preview h2,.note-preview h3,.note-preview h4,.note-preview h5,.note-preview h6 { margin-top: 1.2em; margin-bottom: 0.5em; font-weight: 600; line-height: 1.3; color: var(--text); }
.note-preview h1 { font-size: 1.6rem; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.note-preview h2 { font-size: 1.35rem; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.note-preview h3 { font-size: 1.15rem; }
.note-preview h4 { font-size: 1rem; }
.note-preview p { margin-bottom: 0.8em; }
.note-preview a { color: var(--accent); text-decoration: none; }
.note-preview a:hover { text-decoration: underline; }
.note-preview code { font-family: var(--font-mono); font-size: 0.85em; background: var(--bg-elevated); padding: 2px 6px; border-radius: 4px; color: var(--accent); }
.note-preview pre { background: var(--bg-elevated); padding: 14px 16px; border-radius: var(--radius); overflow-x: auto; margin: 12px 0; border: 1px solid var(--border); position: relative; }
.note-preview pre code { background: none; padding: 0; font-size: 0.85rem; color: var(--text); }

/* Copy button */
.code-copy-btn { position: absolute; top: 8px; right: 8px; display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-muted); cursor: pointer; opacity: 0; transition: opacity 0.15s, color 0.15s, background 0.15s; }
.note-preview pre:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover { background: var(--bg-elevated); color: var(--text); }
.code-copy-btn svg { pointer-events: none; }

/* Line numbers */
.note-preview pre.has-line-numbers { display: flex; align-items: flex-start; overflow-x: auto; padding: 14px 0; }
.note-preview pre.has-line-numbers .ln-gutter { flex-shrink: 0; min-width: 2.5em; padding: 0 12px 0 16px; text-align: right; color: var(--text-faint); font-family: var(--font-mono); font-size: 0.85rem; line-height: 1.6; border-right: 1px solid var(--border); user-select: none; white-space: pre; }
.note-preview pre.has-line-numbers code { flex: 1; padding: 0 16px; overflow-x: visible; white-space: pre; line-height: 1.6; }
.note-preview blockquote { border-left: 3px solid var(--accent); padding-left: 14px; margin: 12px 0; color: var(--text-muted); font-style: italic; }
.note-preview ul,.note-preview ol { padding-left: 20px; margin: 8px 0; }
.note-preview li { margin-bottom: 4px; }
.note-preview img { max-width: 100%; border-radius: var(--radius-sm); }
.note-preview hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.note-preview table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.note-preview th,.note-preview td { padding: 8px 12px; border: 1px solid var(--border); text-align: left; }
.note-preview th { background: var(--bg-elevated); font-weight: 600; }
.note-preview input[type="checkbox"] { margin-right: 6px; }
.note-preview strong { font-weight: 600; color: var(--text); }

.note-preview pre code.hljs { color: var(--text); }
.note-preview .hljs-keyword { color: var(--accent); }
.note-preview .hljs-string { color: var(--success); }
.note-preview .hljs-comment { color: var(--text-faint); font-style: italic; }
.note-preview .hljs-number { color: var(--warning); }
.note-preview .hljs-function { color: var(--info); }
.note-preview .hljs-title { color: var(--accent); }
.note-preview .hljs-built_in { color: var(--info); }
.note-preview .hljs-attr { color: var(--accent); }
.note-preview .hljs-literal { color: var(--warning); }
.note-preview .hljs-type { color: var(--accent); }
.note-preview .hljs-params { color: var(--text); }

/* === Modal === */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 16px; }
.modal { position: relative; z-index: 1; background: var(--bg); border-radius: var(--radius-lg); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 20px; }
.setting-group { display: flex; flex-direction: column; gap: 8px; }
.setting-label { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.setting-input, .setting-select { padding: 10px 14px; background: var(--bg-elevated); border: 1px solid var(--text-faint); border-radius: var(--radius-sm); color: var(--text); font-family: var(--font-sans); font-size: 0.85rem; outline: none; transition: border-color var(--transition); }
.setting-input:focus, .setting-select:focus { border-color: var(--accent); }
.setting-input:disabled, .setting-select:disabled { opacity: 0.5; cursor: not-allowed; }
.setting-input::placeholder { color: var(--text-faint); }
.setting-select { cursor: pointer; width: 100%; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236c7086' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.setting-hint { font-size: 0.75rem; color: var(--text-faint); line-height: 1.4; }
.setting-hint a { color: var(--accent); text-decoration: none; }
.setting-hint a:hover { text-decoration: underline; }

.server-field-hint { font-size: 0.7rem; color: var(--warning); }
.data-actions { display: flex; gap: 8px; }
.data-actions .btn-secondary { flex: 1; justify-content: center; }

/* === GitHub Settings Card === */
.github-settings {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.github-validate-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.github-status {
  font-size: 0.78rem;
  color: var(--text-faint);
}

.github-status.success { color: var(--success); }
.github-status.error   { color: var(--danger); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* === Settings Footer === */
.settings-footer { padding-top: 12px; padding-bottom: 4px; border-top: 1px solid var(--border); text-align: center; }
.settings-credit { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; }
.settings-credit strong { color: var(--accent); }
.settings-links { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.72rem; margin-bottom: 8px; }
.settings-links a { color: var(--text-faint); text-decoration: none; transition: color var(--transition); }
.settings-links a:hover { color: var(--accent); }
.settings-sep { color: var(--border); }

.settings-version {
  font-size: 0.65rem;
  color: var(--text-faint);
  opacity: 0.6;
}

.danger-zone {
  margin-top: 8px;
  padding: 16px;
  border: 2px solid var(--danger);
  border-radius: var(--radius);
}

.danger-zone-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--danger);
  margin-bottom: 8px;
  margin-top: 0;
}

.btn-danger-outline { border-color: var(--danger); color: var(--danger); margin-top: 6px; }
.btn-danger-outline:hover { background: var(--danger); color: var(--bg); }

.danger-confirm {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-danger-filled { background: var(--danger); color: var(--bg); }
.btn-danger-filled:hover { background: var(--danger-hover); }
.btn-danger-filled:disabled { opacity: 0.5; cursor: not-allowed; }

/* === Toast === */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column-reverse; gap: 8px; }
.toast { padding: 12px 18px; border-radius: var(--radius); font-size: 0.85rem; font-weight: 500; box-shadow: var(--shadow-lg); animation: toastIn 0.25s ease; max-width: 360px; display: flex; align-items: flex-start; gap: 10px; }
.toast.success { background: var(--success); color: var(--bg); }
.toast.error { background: var(--danger); color: var(--bg); }
.toast.info { background: var(--info); color: var(--bg); }
.toast span { flex: 1; }
.toast-copy-btn { flex-shrink: 0; background: none; border: none; cursor: pointer; color: inherit; opacity: 0.75; padding: 1px; display: flex; align-items: center; justify-content: center; border-radius: 3px; transition: opacity 0.15s; }
.toast-copy-btn:hover { opacity: 1; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Night Owl Dark */
[data-theme="night-owl-dark"] {
  --bg: #011627; --bg-alt: #01111d; --bg-elevated: #0b2942; --bg-hover: #122d42;
  --border: #1d3b53; --border-focus: #82aaff;
  --text: #d6deeb; --text-muted: #7fdbca; --text-faint: #4d6a7a;
  --accent: #82aaff; --accent-hover: #5ca7e4;
  --danger: #ef5350; --danger-hover: #c62828;
  --success: #addb67; --warning: #ecc48d; --info: #7fdbca;
}

/* Night Owl Light */
[data-theme="night-owl-light"] {
  --bg: #fbfbfb; --bg-alt: #f0f4f8; --bg-elevated: #e4eaf0; --bg-hover: #d6dfe8;
  --border: #d3dce6; --border-focus: #4876d6;
  --text: #403f53; --text-muted: #566370; --text-faint: #93a1a1;
  --accent: #4876d6; --accent-hover: #3a67c8;
  --danger: #de3d3b; --danger-hover: #b52b2a;
  --success: #2aa298; --warning: #d97e00; --info: #2aa298;
}

/* Cyberpunk Dark */
[data-theme="cyberpunk-dark"] {
  --bg: #0d0d1a; --bg-alt: #080810; --bg-elevated: #151528; --bg-hover: #1c1c35;
  --border: #2a2a50; --border-focus: #fcee0a;
  --text: #e0e0ff; --text-muted: #00fff7; --text-faint: #4a4a80;
  --accent: #fcee0a; --accent-hover: #e0d400;
  --danger: #ff003c; --danger-hover: #cc002f;
  --success: #00ff99; --warning: #ff9900; --info: #00fff7;
}

/* Cyberpunk Light */
[data-theme="cyberpunk-light"] {
  --bg: #f0edff; --bg-alt: #e5e0ff; --bg-elevated: #d8d0f5; --bg-hover: #ccc0ee;
  --border: #b8a8e8; --border-focus: #7700cc;
  --text: #1a0a3d; --text-muted: #4a2a7a; --text-faint: #8060a0;
  --accent: #7700cc; --accent-hover: #5500aa;
  --danger: #cc0044; --danger-hover: #aa0033;
  --success: #006633; --warning: #cc7700; --info: #005599;
}

/* Gruvbox Material Dark */
[data-theme="gruvbox-dark"] {
  --bg: #282828; --bg-alt: #1d2021; --bg-elevated: #32302f; --bg-hover: #3c3836;
  --border: #3c3836; --border-focus: #a9b665;
  --text: #d4be98; --text-muted: #a89984; --text-faint: #7c6f64;
  --accent: #a9b665; --accent-hover: #89966a;
  --danger: #ea6962; --danger-hover: #c04f4a;
  --success: #a9b665; --warning: #e78a4e; --info: #7daea3;
}

/* Gruvbox Material Light */
[data-theme="gruvbox-light"] {
  --bg: #fbf1c7; --bg-alt: #f2e5bc; --bg-elevated: #ebdbb2; --bg-hover: #d5c4a1;
  --border: #d5c4a1; --border-focus: #6f8352;
  --text: #3c3836; --text-muted: #654735; --text-faint: #a89984;
  --accent: #6f8352; --accent-hover: #576840;
  --danger: #9d0006; --danger-hover: #7a0005;
  --success: #6f8352; --warning: #af3a03; --info: #076678;
}

/* Ayu Dark */
[data-theme="ayu-dark"] {
  --bg: #0d1017; --bg-alt: #080c12; --bg-elevated: #131a24; --bg-hover: #1a2332;
  --border: #1e2b38; --border-focus: #e6b450;
  --text: #bfbdb6; --text-muted: #8a9199; --text-faint: #3d4f61;
  --accent: #e6b450; --accent-hover: #c99a3e;
  --danger: #f07178; --danger-hover: #c7575e;
  --success: #aad94c; --warning: #ff8f40; --info: #39bae6;
}

/* Ayu Light */
[data-theme="ayu-light"] {
  --bg: #f8f9fa; --bg-alt: #f0f0f0; --bg-elevated: #e5e6e8; --bg-hover: #d8d9dc;
  --border: #d0d1d5; --border-focus: #ff9940;
  --text: #575f66; --text-muted: #8a9199; --text-faint: #adb1b8;
  --accent: #ff9940; --accent-hover: #e6872e;
  --danger: #f07178; --danger-hover: #c7575e;
  --success: #86b300; --warning: #f29718; --info: #55b4d4;
}

/* === Utils === */
.hidden { display: none !important; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-faint); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
* { scrollbar-width: thin; scrollbar-color: var(--text-faint) transparent; }

/* === Mobile === */
@media (max-width: 768px) {
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 100%; max-width: 100%; z-index: 150; transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 140; }
  #backBtn { display: inline-flex; }
  .note-title-input { font-size: 1.25rem; padding: 16px 16px 8px; }
  .formatting-toolbar { padding: 4px 16px 8px; }
  .tags-area { padding: 6px 16px 10px; }
  .note-content-input { padding: 8px 16px 16px; font-size: 0.9rem; }
  .note-preview { padding: 8px 16px 16px; }
  .editor-footer { padding: 6px 16px 10px; }
  .sidebar-toggle { display: flex; }
  .view-btn span { display: none; }
}
@media (min-width: 769px) {
  .sidebar-toggle { display: none; }
  #backBtn { display: none; }
}
.sidebar-backdrop { display: none; }
@media (max-width: 768px) { .sidebar-backdrop.visible { display: block; } }
