/* ====================================================
   MEMO NOTEPAD - STYLESHEET
   Supports: Light, Dark, Midnight, & Classic Memo themes
   Fonts: Monospace, Standard Sans, Typeset Serif, Handwriting
   ==================================================== */

:root {
    /* 1. Monospace & Code Fonts */
    --font-mono: 'JetBrains Mono', Consolas, 'Fira Code', Monaco, monospace;
    --font-fira: 'Fira Code', Consolas, Monaco, monospace;
    --font-source-code: 'Source Code Pro', Consolas, Monaco, monospace;
    --font-space-mono: 'Space Mono', monospace;

    /* 2. Modern Sans-Serif Fonts */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-outfit: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-poppins: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-jakarta: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

    /* 3. Serif & Editorial Fonts */
    --font-serif: 'Merriweather', Georgia, 'Times New Roman', serif;
    --font-playfair: 'Playfair Display', Georgia, serif;
    --font-lora: 'Lora', Georgia, serif;
    --font-crimson: 'Crimson Pro', Georgia, serif;

    /* 4. Handwriting & Creative Fonts */
    --font-handwriting: 'Caveat', 'Comic Sans MS', cursive;
    --font-kalam: 'Kalam', cursive;
    --font-dancing: 'Dancing Script', cursive;
    --font-typewriter: 'Special Elite', 'Courier New', monospace;

    --editor-font-weight: 400;
    --editor-font-size: 16px;
    --editor-line-height: 2.05;
    --footer-height: 48px;

    /* Transition speeds */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;

    /* Theme defaults: Dark Dev Mode */
    --bg-app: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-editor: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --bg-card-active: #2563eb;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: #f59e0b;
    --accent-color: #f59e0b;
    --accent-hover: #fbbf24;
    --accent-glow: rgba(245, 158, 11, 0.25);
    --code-bg: #1e293b;
    --code-border: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(255, 255, 255, 0.22);
    --scrollbar-thumb-hover: rgba(255, 255, 255, 0.45);
    --tree-line-color: rgba(255, 255, 255, 0.2);
}

/* 1. THEME: Classic Memo Notepad (Yellow Legal Pad) */
body.theme-classic {
    --bg-app: #fbf7ee;
    --bg-sidebar: #f2ebd9;
    --bg-editor: #fbf7ee;
    --bg-card: #ffffff;
    --bg-card-hover: #faeed2;
    --bg-card-active: #edd8a6;
    --text-primary: #2d261e;
    --text-secondary: #6e6456;
    --text-muted: #968c7e;
    --border-color: rgba(140, 115, 75, 0.18);
    --border-focus: #c28833;
    --accent-color: #d97706;
    --accent-hover: #b45309;
    --accent-glow: rgba(217, 119, 6, 0.2);
    --code-bg: #f4ecdc;
    --code-border: #e0d1b8;
    --memo-lines: linear-gradient(rgba(180, 150, 100, 0.15) 1px, transparent 1px);
    --scrollbar-thumb-color: rgba(140, 115, 75, 0.35);
    --scrollbar-thumb-hover: rgba(140, 115, 75, 0.65);
    --tree-line-color: rgba(140, 115, 75, 0.28);
}

/* 2. THEME: Clean Light Paper */
body.theme-light {
    --bg-app: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-editor: #ffffff;
    --bg-card: #f1f5f9;
    --bg-card-hover: #e2e8f0;
    --bg-card-active: #e0e7ff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-focus: #3b82f6;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-glow: rgba(37, 99, 235, 0.2);
    --code-bg: #f1f5f9;
    --code-border: #cbd5e1;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(0, 0, 0, 0.2);
    --scrollbar-thumb-hover: rgba(0, 0, 0, 0.45);
    --tree-line-color: rgba(0, 0, 0, 0.18);
}

/* 3. THEME: Midnight (Deep Black) */
body.theme-midnight {
    --bg-app: #090a0f;
    --bg-sidebar: #12131a;
    --bg-editor: #090a0f;
    --bg-card: #181922;
    --bg-card-hover: #222430;
    --bg-card-active: #2e3040;
    --text-primary: #ededed;
    --text-secondary: #a0a0a8;
    --text-muted: #5e606e;
    --border-color: rgba(255, 255, 255, 0.06);
    --border-focus: #f59e0b;
    --accent-color: #f59e0b;
    --accent-hover: #fbbf24;
    --accent-glow: rgba(245, 158, 11, 0.3);
    --code-bg: #14151c;
    --code-border: #282a36;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(255, 255, 255, 0.18);
    --scrollbar-thumb-hover: rgba(255, 255, 255, 0.4);
}

/* 4. THEME: Dracula (Developer Cult Classic) */
body.theme-dracula {
    --bg-app: #282a36;
    --bg-sidebar: #21222c;
    --bg-editor: #282a36;
    --bg-card: #343746;
    --bg-card-hover: #44475a;
    --bg-card-active: #6272a4;
    --text-primary: #f8f8f2;
    --text-secondary: #bd93f9;
    --text-muted: #6272a4;
    --border-color: rgba(98, 114, 164, 0.3);
    --border-focus: #bd93f9;
    --accent-color: #bd93f9;
    --accent-hover: #ff79c6;
    --accent-glow: rgba(189, 147, 249, 0.35);
    --code-bg: #1e1f29;
    --code-border: #44475a;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(189, 147, 249, 0.3);
    --scrollbar-thumb-hover: rgba(189, 147, 249, 0.65);
}

/* 5. THEME: Nord Arctic (Icy Clean Blue) */
body.theme-nord {
    --bg-app: #2e3440;
    --bg-sidebar: #242933;
    --bg-editor: #2e3440;
    --bg-card: #3b4252;
    --bg-card-hover: #434c5e;
    --bg-card-active: #4c566a;
    --text-primary: #eceff4;
    --text-secondary: #d8dee9;
    --text-muted: #7b88a1;
    --border-color: rgba(216, 222, 233, 0.14);
    --border-focus: #88c0d0;
    --accent-color: #88c0d0;
    --accent-hover: #81a1c1;
    --accent-glow: rgba(136, 192, 208, 0.35);
    --code-bg: #242933;
    --code-border: #434c5e;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(136, 192, 208, 0.28);
    --scrollbar-thumb-hover: rgba(136, 192, 208, 0.6);
}

/* 6. THEME: Monokai Pro (Sublime Classic) */
body.theme-monokai {
    --bg-app: #272822;
    --bg-sidebar: #1e1f1c;
    --bg-editor: #272822;
    --bg-card: #38372e;
    --bg-card-hover: #49483e;
    --bg-card-active: #75715e;
    --text-primary: #f8f8f2;
    --text-secondary: #e6db74;
    --text-muted: #75715e;
    --border-color: rgba(255, 255, 255, 0.12);
    --border-focus: #a6e22e;
    --accent-color: #a6e22e;
    --accent-hover: #fd971f;
    --accent-glow: rgba(166, 226, 46, 0.35);
    --code-bg: #1e1f1c;
    --code-border: #49483e;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(166, 226, 46, 0.28);
    --scrollbar-thumb-hover: rgba(166, 226, 46, 0.6);
}

/* 7. THEME: Forest Sage (Soothing Deep Emerald) */
body.theme-forest {
    --bg-app: #0f231c;
    --bg-sidebar: #091712;
    --bg-editor: #0f231c;
    --bg-card: #163329;
    --bg-card-hover: #1e4537;
    --bg-card-active: #285a48;
    --text-primary: #e6f4ef;
    --text-secondary: #a7d9c6;
    --text-muted: #649682;
    --border-color: rgba(167, 217, 198, 0.15);
    --border-focus: #10b981;
    --accent-color: #10b981;
    --accent-hover: #34d399;
    --accent-glow: rgba(16, 185, 129, 0.35);
    --code-bg: #091712;
    --code-border: #1e4537;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(16, 185, 129, 0.28);
    --scrollbar-thumb-hover: rgba(16, 185, 129, 0.6);
}

/* 8. THEME: Warm Coffee (Cozy Sepia Espresso) */
body.theme-coffee {
    --bg-app: #231b15;
    --bg-sidebar: #19130f;
    --bg-editor: #231b15;
    --bg-card: #33271f;
    --bg-card-hover: #44342a;
    --bg-card-active: #594537;
    --text-primary: #f5ede6;
    --text-secondary: #d6beaa;
    --text-muted: #8c7361;
    --border-color: rgba(214, 190, 170, 0.15);
    --border-focus: #d97706;
    --accent-color: #d97706;
    --accent-hover: #f59e0b;
    --accent-glow: rgba(217, 119, 6, 0.35);
    --code-bg: #19130f;
    --code-border: #44342a;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(217, 119, 6, 0.28);
    --scrollbar-thumb-hover: rgba(217, 119, 6, 0.6);
}

/* 9. THEME: Cyberpunk Synthwave (Neon Future) */
body.theme-synthwave {
    --bg-app: #131127;
    --bg-sidebar: #0d0b1a;
    --bg-editor: #131127;
    --bg-card: #1f1b3d;
    --bg-card-hover: #2b2554;
    --bg-card-active: #3e3578;
    --text-primary: #fdf4ff;
    --text-secondary: #f0abfc;
    --text-muted: #8172ab;
    --border-color: rgba(240, 171, 252, 0.16);
    --border-focus: #ec4899;
    --accent-color: #ec4899;
    --accent-hover: #f472b6;
    --accent-glow: rgba(236, 72, 153, 0.4);
    --code-bg: #0d0b1a;
    --code-border: #2b2554;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(236, 72, 153, 0.3);
    --scrollbar-thumb-hover: rgba(236, 72, 153, 0.65);
}

/* 10. THEME: Tokyo Night (Modern Japanese Neon Cyber) */
body.theme-tokyo-night {
    --bg-app: #1a1b26;
    --bg-sidebar: #16161e;
    --bg-editor: #1a1b26;
    --bg-card: #24283b;
    --bg-card-hover: #2f354f;
    --bg-card-active: #3b4261;
    --text-primary: #c0caf5;
    --text-secondary: #7aa2f7;
    --text-muted: #565f89;
    --border-color: rgba(122, 162, 247, 0.16);
    --border-focus: #7aa2f7;
    --accent-color: #7aa2f7;
    --accent-hover: #bb9af7;
    --accent-glow: rgba(122, 162, 247, 0.35);
    --code-bg: #16161e;
    --code-border: #2f354f;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(122, 162, 247, 0.28);
    --scrollbar-thumb-hover: rgba(122, 162, 247, 0.6);
}

/* 11. THEME: Catppuccin Mocha (Soothing Warm Pastel) */
body.theme-catppuccin {
    --bg-app: #1e1e2e;
    --bg-sidebar: #181825;
    --bg-editor: #1e1e2e;
    --bg-card: #313244;
    --bg-card-hover: #45475a;
    --bg-card-active: #585b70;
    --text-primary: #cdd6f4;
    --text-secondary: #cba6f7;
    --text-muted: #6c7086;
    --border-color: rgba(203, 166, 247, 0.18);
    --border-focus: #cba6f7;
    --accent-color: #cba6f7;
    --accent-hover: #f5c2e7;
    --accent-glow: rgba(203, 166, 247, 0.35);
    --code-bg: #181825;
    --code-border: #45475a;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(203, 166, 247, 0.28);
    --scrollbar-thumb-hover: rgba(203, 166, 247, 0.6);
}

/* 12. THEME: Rosé Pine (Natural Pine & Bloom) */
body.theme-rose-pine {
    --bg-app: #191724;
    --bg-sidebar: #1f1d2e;
    --bg-editor: #191724;
    --bg-card: #26233a;
    --bg-card-hover: #312f44;
    --bg-card-active: #3e3a54;
    --text-primary: #e0def4;
    --text-secondary: #ebbcba;
    --text-muted: #6e6a86;
    --border-color: rgba(235, 188, 186, 0.16);
    --border-focus: #ebbcba;
    --accent-color: #ebbcba;
    --accent-hover: #f6c177;
    --accent-glow: rgba(235, 188, 186, 0.35);
    --code-bg: #1f1d2e;
    --code-border: #312f44;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(235, 188, 186, 0.28);
    --scrollbar-thumb-hover: rgba(235, 188, 186, 0.6);
}

/* 13. THEME: Solarized Dark (Ethan Schoonover Classic) */
body.theme-solarized-dark {
    --bg-app: #002b36;
    --bg-sidebar: #073642;
    --bg-editor: #002b36;
    --bg-card: #0a3d4a;
    --bg-card-hover: #0e4c5b;
    --bg-card-active: #104e5d;
    --text-primary: #93a1a1;
    --text-secondary: #2aa198;
    --text-muted: #586e75;
    --border-color: rgba(42, 161, 152, 0.28);
    --border-focus: #2aa198;
    --accent-color: #b58900;
    --accent-hover: #2aa198;
    --accent-glow: rgba(42, 161, 152, 0.35);
    --code-bg: #073642;
    --code-border: #0e4c5b;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(42, 161, 152, 0.25);
    --scrollbar-thumb-hover: rgba(42, 161, 152, 0.55);
}

/* 14. THEME: Solarized Light (Warm Elegant Parchment) */
body.theme-solarized-light {
    --bg-app: #fdf6e3;
    --bg-sidebar: #eee8d5;
    --bg-editor: #fdf6e3;
    --bg-card: #ffffff;
    --bg-card-hover: #f5eedb;
    --bg-card-active: #e6dfc7;
    --text-primary: #586e75;
    --text-secondary: #073642;
    --text-muted: #93a1a1;
    --border-color: rgba(88, 110, 117, 0.18);
    --border-focus: #b58900;
    --accent-color: #b58900;
    --accent-hover: #268bd2;
    --accent-glow: rgba(181, 137, 0, 0.25);
    --code-bg: #eee8d5;
    --code-border: #dcd4be;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(88, 110, 117, 0.25);
    --scrollbar-thumb-hover: rgba(88, 110, 117, 0.55);
}

/* 15. THEME: GitHub Dark (Official Dim Developer) */
body.theme-github-dark {
    --bg-app: #0d1117;
    --bg-sidebar: #010409;
    --bg-editor: #0d1117;
    --bg-card: #161b22;
    --bg-card-hover: #21262d;
    --bg-card-active: #30363d;
    --text-primary: #c9d1d9;
    --text-secondary: #58a6ff;
    --text-muted: #8b949e;
    --border-color: #30363d;
    --border-focus: #58a6ff;
    --accent-color: #238636;
    --accent-hover: #2ea043;
    --accent-glow: rgba(35, 134, 54, 0.35);
    --code-bg: #161b22;
    --code-border: #30363d;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(139, 148, 158, 0.3);
    --scrollbar-thumb-hover: rgba(139, 148, 158, 0.6);
}

/* 16. THEME: One Dark Pro (Atom / VS Code Classic) */
body.theme-one-dark {
    --bg-app: #282c34;
    --bg-sidebar: #21252b;
    --bg-editor: #282c34;
    --bg-card: #2c313c;
    --bg-card-hover: #353b45;
    --bg-card-active: #3e4451;
    --text-primary: #abb2bf;
    --text-secondary: #61afef;
    --text-muted: #5c6370;
    --border-color: rgba(97, 175, 239, 0.16);
    --border-focus: #61afef;
    --accent-color: #61afef;
    --accent-hover: #98c379;
    --accent-glow: rgba(97, 175, 239, 0.35);
    --code-bg: #21252b;
    --code-border: #3e4451;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(97, 175, 239, 0.25);
    --scrollbar-thumb-hover: rgba(97, 175, 239, 0.55);
}

/* 17. THEME: Gruvbox Dark (Warm Retro Terminal) */
body.theme-gruvbox-dark {
    --bg-app: #282828;
    --bg-sidebar: #1d2021;
    --bg-editor: #282828;
    --bg-card: #32302f;
    --bg-card-hover: #3c3836;
    --bg-card-active: #504945;
    --text-primary: #ebdbb2;
    --text-secondary: #fabd2f;
    --text-muted: #928374;
    --border-color: rgba(250, 189, 47, 0.18);
    --border-focus: #fabd2f;
    --accent-color: #fe8019;
    --accent-hover: #fabd2f;
    --accent-glow: rgba(254, 128, 25, 0.35);
    --code-bg: #1d2021;
    --code-border: #3c3836;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(250, 189, 47, 0.28);
    --scrollbar-thumb-hover: rgba(250, 189, 47, 0.6);
}

/* 18. THEME: Gruvbox Light (Vintage Soft Cream) */
body.theme-gruvbox-light {
    --bg-app: #fbf1c7;
    --bg-sidebar: #f2e5bc;
    --bg-editor: #fbf1c7;
    --bg-card: #ffffff;
    --bg-card-hover: #e8dbb4;
    --bg-card-active: #d5c4a1;
    --text-primary: #3c3836;
    --text-secondary: #b57614;
    --text-muted: #7c6f64;
    --border-color: rgba(181, 118, 20, 0.2);
    --border-focus: #d65d0e;
    --accent-color: #d65d0e;
    --accent-hover: #af3a03;
    --accent-glow: rgba(214, 93, 14, 0.25);
    --code-bg: #f2e5bc;
    --code-border: #d5c4a1;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(181, 118, 20, 0.28);
    --scrollbar-thumb-hover: rgba(181, 118, 20, 0.6);
}

/* 19. THEME: Everforest Dark (Japanese Forest Calm) */
body.theme-everforest {
    --bg-app: #2d353b;
    --bg-sidebar: #232a2e;
    --bg-editor: #2d353b;
    --bg-card: #343f44;
    --bg-card-hover: #3d484d;
    --bg-card-active: #475258;
    --text-primary: #d3c6aa;
    --text-secondary: #a7c080;
    --text-muted: #7a8478;
    --border-color: rgba(167, 192, 128, 0.16);
    --border-focus: #a7c080;
    --accent-color: #a7c080;
    --accent-hover: #83c092;
    --accent-glow: rgba(167, 192, 128, 0.35);
    --code-bg: #232a2e;
    --code-border: #3d484d;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(167, 192, 128, 0.28);
    --scrollbar-thumb-hover: rgba(167, 192, 128, 0.6);
}

/* 20. THEME: Palenight (Sleek Material Deep) */
body.theme-palenight {
    --bg-app: #292d3e;
    --bg-sidebar: #202330;
    --bg-editor: #292d3e;
    --bg-card: #30354a;
    --bg-card-hover: #383e56;
    --bg-card-active: #434a67;
    --text-primary: #a6accd;
    --text-secondary: #82aaff;
    --text-muted: #676e95;
    --border-color: rgba(130, 170, 255, 0.16);
    --border-focus: #82aaff;
    --accent-color: #c792ea;
    --accent-hover: #ff5370;
    --accent-glow: rgba(199, 146, 234, 0.35);
    --code-bg: #202330;
    --code-border: #383e56;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(130, 170, 255, 0.28);
    --scrollbar-thumb-hover: rgba(130, 170, 255, 0.6);
}

/* 21. THEME: Cyberpunk 2077 (Neon High-Tech Yellow) */
body.theme-cyberpunk {
    --bg-app: #121217;
    --bg-sidebar: #09090c;
    --bg-editor: #121217;
    --bg-card: #1a1a23;
    --bg-card-hover: #252533;
    --bg-card-active: #333346;
    --text-primary: #f0f0ff;
    --text-secondary: #fcee0a;
    --text-muted: #717188;
    --border-color: rgba(252, 238, 10, 0.22);
    --border-focus: #fcee0a;
    --accent-color: #fcee0a;
    --accent-hover: #00f0ff;
    --accent-glow: rgba(252, 238, 10, 0.4);
    --code-bg: #09090c;
    --code-border: #252533;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(252, 238, 10, 0.3);
    --scrollbar-thumb-hover: rgba(252, 238, 10, 0.7);
}

/* 22. THEME: Cobalt2 (Wes Bos High-Contrast Navy) */
body.theme-cobalt2 {
    --bg-app: #193549;
    --bg-sidebar: #122738;
    --bg-editor: #193549;
    --bg-card: #1f4058;
    --bg-card-hover: #264d6a;
    --bg-card-active: #315d7e;
    --text-primary: #ffffff;
    --text-secondary: #ffc600;
    --text-muted: #708b9e;
    --border-color: rgba(0, 136, 255, 0.2);
    --border-focus: #ffc600;
    --accent-color: #ffc600;
    --accent-hover: #0088ff;
    --accent-glow: rgba(255, 198, 0, 0.35);
    --code-bg: #122738;
    --code-border: #264d6a;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(255, 198, 0, 0.3);
    --scrollbar-thumb-hover: rgba(255, 198, 0, 0.65);
}

/* 23. THEME: Matrix Terminal (Phosphor Green Hacker) */
body.theme-matrix {
    --bg-app: #090f09;
    --bg-sidebar: #040704;
    --bg-editor: #090f09;
    --bg-card: #0f180f;
    --bg-card-hover: #172617;
    --bg-card-active: #213621;
    --text-primary: #a3e635;
    --text-secondary: #22c55e;
    --text-muted: #4d7c0f;
    --border-color: rgba(34, 197, 94, 0.2);
    --border-focus: #22c55e;
    --accent-color: #22c55e;
    --accent-hover: #4ade80;
    --accent-glow: rgba(34, 197, 94, 0.4);
    --code-bg: #040704;
    --code-border: #172617;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(34, 197, 94, 0.3);
    --scrollbar-thumb-hover: rgba(34, 197, 94, 0.65);
}

/* 24. THEME: Sunset Coral (Moody Dusk Purple & Rose) */
body.theme-sunset {
    --bg-app: #1e1726;
    --bg-sidebar: #150f1c;
    --bg-editor: #1e1726;
    --bg-card: #2a2136;
    --bg-card-hover: #372b47;
    --bg-card-active: #47365c;
    --text-primary: #f5ecf8;
    --text-secondary: #fb7185;
    --text-muted: #8a7599;
    --border-color: rgba(251, 113, 133, 0.18);
    --border-focus: #f43f5e;
    --accent-color: #f43f5e;
    --accent-hover: #fb923c;
    --accent-glow: rgba(244, 63, 94, 0.35);
    --code-bg: #150f1c;
    --code-border: #372b47;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(244, 63, 94, 0.28);
    --scrollbar-thumb-hover: rgba(244, 63, 94, 0.6);
}

/* 25. THEME: Lavender Mist (Sweet Lilac Pastel Light) */
body.theme-lavender {
    --bg-app: #f7f6fc;
    --bg-sidebar: #eeeaf7;
    --bg-editor: #f7f6fc;
    --bg-card: #ffffff;
    --bg-card-hover: #e6e0f3;
    --bg-card-active: #d8cfec;
    --text-primary: #2e2540;
    --text-secondary: #7c3aed;
    --text-muted: #7d7296;
    --border-color: rgba(124, 58, 237, 0.16);
    --border-focus: #7c3aed;
    --accent-color: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-glow: rgba(124, 58, 237, 0.25);
    --code-bg: #eeeaf7;
    --code-border: #d8cfec;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(124, 58, 237, 0.25);
    --scrollbar-thumb-hover: rgba(124, 58, 237, 0.55);
}

/* 26. THEME: Matcha Latte (Organic Calming Green Light) */
body.theme-matcha {
    --bg-app: #f4f7f4;
    --bg-sidebar: #e7ece6;
    --bg-editor: #f4f7f4;
    --bg-card: #ffffff;
    --bg-card-hover: #dde5dc;
    --bg-card-active: #cdd9cb;
    --text-primary: #263328;
    --text-secondary: #4d7c0f;
    --text-muted: #6b7e6d;
    --border-color: rgba(77, 124, 15, 0.16);
    --border-focus: #4d7c0f;
    --accent-color: #4d7c0f;
    --accent-hover: #3f6212;
    --accent-glow: rgba(77, 124, 15, 0.25);
    --code-bg: #e7ece6;
    --code-border: #cdd9cb;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(77, 124, 15, 0.25);
    --scrollbar-thumb-hover: rgba(77, 124, 15, 0.55);
}

/* 27. THEME: Aura Dark (Deep Violet & Neon Mint) */
body.theme-aura {
    --bg-app: #15141b;
    --bg-sidebar: #111015;
    --bg-editor: #15141b;
    --bg-card: #1f1d28;
    --bg-card-hover: #2a2737;
    --bg-card-active: #39354b;
    --text-primary: #edecee;
    --text-secondary: #a277ff;
    --text-muted: #6d6a7d;
    --border-color: rgba(162, 119, 255, 0.18);
    --border-focus: #a277ff;
    --accent-color: #a277ff;
    --accent-hover: #61ffca;
    --accent-glow: rgba(162, 119, 255, 0.35);
    --code-bg: #111015;
    --code-border: #2a2737;
    --memo-lines: transparent;
    --scrollbar-thumb-color: rgba(162, 119, 255, 0.28);
    --scrollbar-thumb-hover: rgba(162, 119, 255, 0.6);
}

/* Base Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html:not(.public-page),
body:not(.public-reader-body) {
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ====================================================
   APP LAYOUT
   ==================================================== */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    position: relative;
}

/* ====================================================
   SIDEBAR
   ==================================================== */
.sidebar {
    width: 320px;
    min-width: 320px;
    max-width: 320px;
    height: 100%;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                min-width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                max-width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s ease,
                visibility 0.2s ease;
    z-index: 50;
    user-select: none;
    overflow: hidden; /* Critical: prevent any inner element leakage */
    position: relative;
    flex-shrink: 0;
}

/* Desktop Collapsed */
.sidebar.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border-right: none !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-100%);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

/* Sidebar Header - Exactly 56px to match .toolbar for 100% symmetrical horizontal line */
.sidebar-header {
    height: 56px;
    min-height: 56px;
    max-height: 56px;
    box-sizing: border-box;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    text-decoration: none;
}

.brand-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--accent-color), #d97706);
    color: #fff;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px var(--accent-glow);
}

.brand-icon svg {
    width: 20px;
    height: 20px;
}

/* Sidebar Actions */
.sidebar-actions {
    padding: 0.85rem 1.25rem 0.55rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.btn-new-note {
    width: 100%;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, var(--accent-color), #d97706);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.925rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: 0 3px 8px var(--accent-glow);
}

.btn-new-note:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px var(--accent-glow);
}

.btn-new-note:active {
    transform: translateY(0);
}

.search-box {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.65rem 0.85rem 0.65rem 2.4rem;
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Sidebar Group & Folder Tree */
.group-bar {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.65rem 1.25rem 0.35rem 1.25rem;
    flex-shrink: 0;
}

.group-bar.tree-collapsed {
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border-color);
}

.group-bar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    user-select: none;
}

.group-bar-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.group-bar-label:hover {
    color: var(--text-primary);
}

.group-tree-arrow-icon {
    transition: transform 0.2s ease;
}

.group-bar.tree-collapsed .group-tree-arrow-icon {
    transform: rotate(-90deg);
}

.group-bar.tree-collapsed .group-tree {
    display: none;
}

.group-bar.tree-collapsed + .sidebar-split-resizer {
    display: none;
}

/* Sidebar Vertical Split Resizer */
.sidebar-split-resizer {
    height: 10px;
    min-height: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: row-resize;
    user-select: none;
    touch-action: none;
    position: relative;
    border-top: 1px solid var(--border-color);
    background: transparent;
    transition: background-color var(--transition-fast);
    flex-shrink: 0;
    z-index: 10;
}

.sidebar-split-resizer:hover {
    background-color: rgba(245, 158, 11, 0.08);
}

.sidebar-split-resizer .resizer-handle {
    width: 36px;
    height: 3.5px;
    background-color: var(--border-color);
    border-radius: 999px;
    transition: width 0.2s ease, height 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    pointer-events: none;
}

.sidebar-split-resizer:hover .resizer-handle,
.sidebar-split-resizer.is-active .resizer-handle {
    width: 52px;
    height: 4.5px;
    background-color: var(--accent-color);
    box-shadow: 0 0 8px var(--accent-glow);
}

body.is-resizing-split {
    cursor: row-resize !important;
    user-select: none !important;
}

body.is-resizing-split * {
    user-select: none !important;
}

.btn-add-group-small,
.btn-manage-group-small {
    background: transparent;
    border: 1px dashed var(--border-color);
    color: var(--accent-color);
    border-radius: 4px;
    padding: 0.15rem 0.45rem;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-add-group-small:hover,
.btn-manage-group-small:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-color);
    color: var(--accent-hover);
}

.group-tree {
    display: flex;
    flex-direction: column;
    gap: 1px;
    height: var(--group-tree-height, 160px);
    min-height: 40px;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    overflow-y: overlay;
    padding-right: 0;
}

.tree-node {
    display: flex;
    flex-direction: column;
}

.tree-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 3px 6px;
    min-height: 26px;
    box-sizing: border-box;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.76rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    user-select: none;
    position: relative;
    border: 1px solid transparent;
}

.tree-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.tree-item.active {
    background: var(--accent-color);
    color: #ffffff;
    font-weight: 600;
    border-color: var(--accent-color);
    box-shadow: 0 2px 6px var(--accent-glow);
}

.tree-item.active .tree-item-icon {
    color: #ffffff;
}

.tree-item.active .tree-item-count {
    background: rgba(0, 0, 0, 0.25);
    color: #ffffff;
}

.tree-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    padding: 0;
    transition: color var(--transition-fast);
    flex-shrink: 0;
}

.tree-toggle-btn svg {
    transition: transform 0.2s ease;
}

.tree-toggle-btn:hover {
    color: var(--accent-color);
    background: rgba(255, 255, 255, 0.08);
}

.tree-item.active .tree-toggle-btn {
    color: rgba(255, 255, 255, 0.85);
}

.tree-node.expanded > .tree-item .tree-toggle-btn svg {
    transform: rotate(90deg);
}

.tree-spacer {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: inline-block;
}

.tree-item-content {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 1;
    min-width: 0;
}

.tree-item-icon {
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 16px;
}

.tree-item-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-item-count {
    font-size: 0.65rem;
    background: var(--bg-card);
    color: var(--text-muted);
    padding: 0.05rem 0.35rem;
    border-radius: 10px;
    flex-shrink: 0;
}

/* ====================================================
   PRECISION TREE HIERARCHY GUIDES & CONNECTORS
   - Garis vertikal persis di bawah titik tengah chevron panah (14px)
   - Garis cabang horizontal (├── dan └──) terhubung presisi ke setiap anak
   - Anak terakhir berhenti rapi membentuk sudut L (└──), tanpa garis menggantung
   ==================================================== */
.tree-children {
    display: none;
    flex-direction: column;
    gap: 1px;
    position: relative;
    margin-left: 14px;
    padding-left: 10px;
}

.tree-node.expanded > .tree-children {
    display: flex;
}

.tree-children > .tree-node {
    position: relative;
}

/* Garis cabang horizontal ke anak item */
.tree-children > .tree-node::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 13px;
    width: 8px;
    height: 0;
    border-top: 1px dashed var(--tree-line-color, rgba(255, 255, 255, 0.2));
    pointer-events: none;
}

/* Garis panduan vertikal dari chevron panah induk */
.tree-children > .tree-node::after {
    content: '';
    position: absolute;
    left: -10px;
    top: 0;
    bottom: 0;
    width: 0;
    border-left: 1px dashed var(--tree-line-color, rgba(255, 255, 255, 0.2));
    pointer-events: none;
}

/* Anak terakhir: garis vertikal berhenti di tinggi cabang (13px) membentuk sudut L */
.tree-children > .tree-node:last-child::after {
    bottom: auto;
    height: 13px;
}

/* Notes List */
.notes-list-container {
    flex: 1;
    overflow-y: auto;
    overflow-y: overlay;
    padding: 0.5rem 0.75rem;
}

/* ====================================================
   SEAMLESS FLOATING OVERLAY SCROLLBAR
   - Tidak memakan space tata letak (0 reserved width / overlay)
   - Bebas dari tombol panah maupun track background kaku
   - Mengambang mulus di atas konten (floating)
   ==================================================== */

/* Global Seamless Floating Scrollbar for WebKit / Blink (Chrome, Edge, Opera, Safari) */
::-webkit-scrollbar,
*::-webkit-scrollbar {
    width: 4px;
    height: 4px;
    background: transparent !important;
}

::-webkit-scrollbar-track,
*::-webkit-scrollbar-track,
::-webkit-scrollbar-track-piece,
*::-webkit-scrollbar-track-piece,
::-webkit-scrollbar-corner,
*::-webkit-scrollbar-corner {
    background: transparent !important;
    border: none !important;
}

::-webkit-scrollbar-button,
*::-webkit-scrollbar-button,
::-webkit-scrollbar-button:single-button,
*::-webkit-scrollbar-button:single-button,
::-webkit-scrollbar-button:vertical:decrement,
*::-webkit-scrollbar-button:vertical:decrement,
::-webkit-scrollbar-button:vertical:increment,
*::-webkit-scrollbar-button:vertical:increment,
::-webkit-scrollbar-button:horizontal:decrement,
*::-webkit-scrollbar-button:horizontal:decrement,
::-webkit-scrollbar-button:horizontal:increment,
*::-webkit-scrollbar-button:horizontal:increment,
::-webkit-scrollbar-button:start,
*::-webkit-scrollbar-button:start,
::-webkit-scrollbar-button:end,
*::-webkit-scrollbar-button:end {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
    border: none !important;
    pointer-events: none !important;
}

/* Default state: Transparan / Tersembunyi saat diam (tidak memakan space) */
::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-thumb {
    background-color: transparent;
    border-radius: 999px;
    transition: background-color 0.25s ease;
}

/* Hover container atau sedang scroll aktif: Munculkan thumb mengambang tipis */
.notes-list-container:hover::-webkit-scrollbar-thumb,
.note-editor-textarea:hover::-webkit-scrollbar-thumb,
.markdown-preview:hover::-webkit-scrollbar-thumb,
.group-tree:hover::-webkit-scrollbar-thumb,
.group-manage-list:hover::-webkit-scrollbar-thumb,
.sidebar:hover::-webkit-scrollbar-thumb,
.notes-list-container.is-scrolling::-webkit-scrollbar-thumb,
.note-editor-textarea.is-scrolling::-webkit-scrollbar-thumb,
.markdown-preview.is-scrolling::-webkit-scrollbar-thumb,
.group-tree.is-scrolling::-webkit-scrollbar-thumb,
.group-manage-list.is-scrolling::-webkit-scrollbar-thumb,
*:hover::-webkit-scrollbar-thumb,
*.is-scrolling::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb-color, rgba(255, 255, 255, 0.22));
}

/* Hover langsung di atas scrollbar thumb */
::-webkit-scrollbar-thumb:hover,
*::-webkit-scrollbar-thumb:hover {
    background-color: var(--scrollbar-thumb-hover, rgba(255, 255, 255, 0.55)) !important;
}

/* Firefox Khusus: Diisolasi agar Chromium tidak fallback ke native OS scrollbar dengan panah & track lebar */
@supports (-moz-appearance: none) {
    .notes-list-container,
    .note-editor-textarea,
    .markdown-preview,
    .group-tree,
    .group-manage-list {
        scrollbar-width: thin;
        scrollbar-color: transparent transparent;
        transition: scrollbar-color 0.3s ease;
    }

    .notes-list-container:hover,
    .note-editor-textarea:hover,
    .markdown-preview:hover,
    .group-tree:hover,
    .group-manage-list:hover,
    .notes-list-container.is-scrolling,
    .note-editor-textarea.is-scrolling,
    .markdown-preview.is-scrolling,
    .group-tree.is-scrolling,
    .group-manage-list.is-scrolling {
        scrollbar-color: var(--scrollbar-thumb-color, rgba(255, 255, 255, 0.22)) transparent;
    }
}

.list-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0.6rem 0.6rem 0.35rem 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.note-item {
    padding: 0.85rem 0.95rem;
    border-radius: 9px;
    margin-bottom: 0.35rem;
    cursor: pointer;
    transition: background-color var(--transition-fast), transform var(--transition-fast);
    border: 1px solid transparent;
    position: relative;
    background-color: transparent;
}

.note-item:hover {
    background-color: var(--bg-card-hover);
}

.note-item.active {
    background-color: var(--bg-card);
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

body.theme-classic .note-item.active {
    background-color: var(--bg-card-active);
    border-color: #d1b880;
}

/* Solarized Dark Selected Note Highlight (High Contrast Cyan & Solarized Base3 Text) */
body.theme-solarized-dark .note-item.active {
    background-color: #104e5d !important;
    border-color: #2aa198 !important;
    box-shadow: 0 2px 10px rgba(0, 43, 54, 0.6), inset 3.5px 0 0 #2aa198 !important;
}

body.theme-solarized-dark .note-item.active .note-item-title {
    color: #fdf6e3 !important;
    font-weight: 700 !important;
}

body.theme-solarized-dark .note-item.active .note-item-preview {
    color: #93a1a1 !important;
}

body.theme-solarized-dark .note-item.active .note-item-date {
    color: #2aa198 !important;
}

/* Solarized Light Selected Note Highlight */
body.theme-solarized-light .note-item.active {
    background-color: #e6dec5 !important;
    border-color: #b58900 !important;
    box-shadow: 0 2px 6px rgba(88, 110, 117, 0.15), inset 3.5px 0 0 #b58900 !important;
}

body.theme-solarized-light .note-item.active .note-item-title {
    color: #073642 !important;
    font-weight: 700 !important;
}

.note-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.3rem;
}

.note-item-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.note-pin-badge {
    color: var(--accent-color);
    margin-left: 0.5rem;
    display: flex;
    align-items: center;
}

.note-item-preview {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.4rem;
}

.note-item-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    gap: 0.5rem;
}

.note-item-group-badge {
    font-size: 0.68rem;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 0.75rem;
    opacity: 0.6;
}

/* Sidebar Footer (User Info & Logout) - Exactly matches .status-bar for 100% symmetrical horizontal line */
.sidebar-footer {
    height: var(--footer-height, 48px);
    min-height: var(--footer-height, 48px);
    max-height: var(--footer-height, 48px);
    box-sizing: border-box;
    padding: 0 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(0, 0, 0, 0.05);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 0;
}

.user-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    font-size: 0.82rem;
    line-height: 1.2;
}

.user-role-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.1;
    color: var(--text-muted);
}

.user-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-footer .btn-icon {
    padding: 4px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

.sidebar-footer .btn-icon svg {
    width: 15px;
    height: 15px;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.45rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.btn-icon:hover {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}

/* ====================================================
   MAIN WORKSPACE & EDITOR
   ==================================================== */
.main-workspace {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg-editor);
    position: relative;
}

/* Main Top Navbar / Toolbar - Exactly 56px to match .sidebar-header */
.toolbar {
    height: 56px;
    min-height: 56px;
    max-height: 56px;
    box-sizing: border-box;
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background-color: var(--bg-editor);
    z-index: 10;
    flex-shrink: 0;
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Save Status Indicator */
.save-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 0.35rem 0.7rem;
    border-radius: 20px;
    background-color: var(--border-color);
    transition: all var(--transition-fast);
}

.save-status.saved {
    color: #10b981;
}

.save-status.saving {
    color: var(--accent-color);
}

.save-status.unsaved {
    color: #f59e0b;
}

.spin {
    animation: spinAnimation 1s linear infinite;
}

@keyframes spinAnimation {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Select Dropdown styling */
.custom-select {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    padding: 0.45rem 0.75rem;
    font-size: 0.825rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition-fast);
}

.custom-select:focus {
    border-color: var(--border-focus);
}

.custom-select optgroup {
    background-color: var(--bg-sidebar);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.8rem;
}

.custom-select option {
    background-color: var(--bg-sidebar);
    color: var(--text-primary);
    font-weight: 400;
}

/* View Mode Switcher Pills */
.mode-pill-group {
    display: flex;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    padding: 2px;
}

.mode-pill {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: all var(--transition-fast);
}

.mode-pill.active {
    background-color: var(--accent-color);
    color: #ffffff;
    box-shadow: var(--shadow-sm);
}

/* Note Content Container */
.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background-image: var(--memo-lines);
    background-size: 100% 28px;
}

/* Title Input & Group Selector */
.note-title-wrapper {
    padding: 1rem 2.5rem 0.5rem 2.5rem;
    border-bottom: 1px dashed var(--border-color);
}

.note-meta-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.note-meta-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.note-group-badge-box {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    padding: 0.3rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    height: 34px;
    box-sizing: border-box;
}

.note-actions-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 3px 6px;
    height: 34px;
    box-sizing: border-box;
}

.note-actions-group .btn-icon {
    padding: 0;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.note-actions-group .btn-icon:hover {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}

.note-actions-group .btn-icon:disabled,
.note-actions-group .btn-icon.disabled,
.note-actions-group .btn-icon[aria-disabled="true"] {
    opacity: 0.35;
    cursor: not-allowed;
}

.note-actions-group .btn-icon:disabled:hover,
.note-actions-group .btn-icon.disabled:hover,
.note-actions-group .btn-icon[aria-disabled="true"]:hover {
    background-color: transparent;
    color: var(--text-secondary);
}

.note-actions-group .btn-icon.has-shares {
    color: #60a5fa !important;
    background: rgba(59, 130, 246, 0.15);
}

.note-actions-group .btn-icon.has-shares:hover {
    background: rgba(59, 130, 246, 0.25);
}

.note-actions-group .btn-icon#btn-delete-note {
    color: #ef4444;
}

.note-actions-group .btn-icon#btn-delete-note:hover {
    background-color: rgba(239, 68, 68, 0.16);
    color: #f87171;
}

.note-meta-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.group-label-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.note-group-dropdown {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
}

.note-group-dropdown option {
    background-color: var(--bg-sidebar);
    color: var(--text-primary);
}

.btn-text-action {
    background: transparent;
    border: none;
    color: var(--accent-color);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: color var(--transition-fast);
}

.btn-text-action:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.note-title-input {
    width: 100%;
    font-size: 1.65rem;
    font-weight: 700;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    letter-spacing: -0.02em;
}

.note-title-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

/* Textarea Editor */
.editor-wrapper {
    flex: 1;
    overflow: hidden;
    padding: 0;
    display: flex;
    position: relative;
    width: 100%;
}

.note-editor-textarea {
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 100%;
    box-sizing: border-box;
    padding: 1.5rem 2.5rem;
    overflow-y: auto;
    overflow-y: overlay;
    overflow-x: hidden;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    font-size: var(--editor-font-size, 16px);
    font-weight: var(--editor-font-weight, 400);
    line-height: var(--editor-line-height, 2.05);
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    tab-size: 4;
    font-variant-ligatures: none !important;
    font-feature-settings: "liga" 0, "calt" 0 !important;
}

/* Font Variations (16 Curated Font Styles) */
/* 1. Monospace & Code */
.font-monospace { font-family: var(--font-mono) !important; }
.font-fira-code { font-family: var(--font-fira) !important; }
.font-source-code { font-family: var(--font-source-code) !important; }
.font-space-mono { font-family: var(--font-space-mono) !important; }

/* 2. Modern Sans-Serif */
.font-standard { font-family: var(--font-sans) !important; }
.font-outfit { font-family: var(--font-outfit) !important; }
.font-poppins { font-family: var(--font-poppins) !important; }
.font-plus-jakarta { font-family: var(--font-jakarta) !important; }

/* 3. Serif & Editorial */
.font-typeset { font-family: var(--font-serif) !important; }
.font-playfair { font-family: var(--font-playfair) !important; }
.font-lora { font-family: var(--font-lora) !important; }
.font-crimson { font-family: var(--font-crimson) !important; }

/* 4. Handwriting & Creative */
.font-handwriting { font-family: var(--font-handwriting) !important; }
.font-kalam { font-family: var(--font-kalam) !important; }
.font-dancing { font-family: var(--font-dancing) !important; }
.font-typewriter { font-family: var(--font-typewriter) !important; }

/* Markdown Preview Area */
.markdown-preview {
    flex: 1;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-y: overlay;
    overflow-x: hidden;
    padding: 1.5rem 2.5rem;
    color: var(--text-primary);
    font-weight: var(--editor-font-weight, 400);
    font-size: var(--editor-font-size, 16px);
    line-height: var(--editor-line-height, 2.05);
    display: none;
}

.markdown-preview.active {
    display: block;
}

.markdown-preview > *:first-child {
    margin-top: 0 !important;
}

.markdown-preview h1 {
    font-size: 1.75rem;
    line-height: 1.35;
    margin-top: 1.75rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.4rem;
}

.markdown-preview h2 {
    font-size: 1.4rem;
    line-height: 1.4;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.markdown-preview h3 {
    font-size: 1.15rem;
    line-height: 1.45;
    margin-top: 1.25rem;
    margin-bottom: 0.75rem;
}

.markdown-preview h4 {
    font-size: 1.05rem;
    line-height: 1.45;
    margin-top: 1.1rem;
    margin-bottom: 0.6rem;
    font-weight: 600;
}

.markdown-preview h5 {
    font-size: 0.95rem;
    line-height: 1.45;
    margin-top: 0.9rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.markdown-preview h6 {
    font-size: 0.88rem;
    line-height: 1.45;
    margin-top: 0.8rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.markdown-preview hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

.markdown-preview a {
    color: var(--accent-color);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity 0.15s ease;
}

.markdown-preview a:hover {
    opacity: 0.8;
}

.markdown-preview p {
    line-height: var(--editor-line-height, 2.05);
    margin-bottom: calc(var(--editor-font-size, 16px) * var(--editor-line-height, 2.05));
}

.markdown-preview ul, .markdown-preview ol {
    line-height: var(--editor-line-height, 2.05);
    margin-bottom: calc(var(--editor-font-size, 16px) * var(--editor-line-height, 2.05));
    padding-left: 1.5rem;
}

.markdown-preview li {
    line-height: var(--editor-line-height, 2.05);
    margin-bottom: 0.35rem;
    vertical-align: top;
}

.markdown-preview li.preview-editable-line {
    vertical-align: top;
}

/* Memastikan bullet list selalu sejajar di baris teratas (align to top) pada teks multiline */
.markdown-preview li .editable-line-text {
    display: block;
    width: 100%;
    min-height: 1.5em;
    vertical-align: top;
}

.markdown-preview hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
    opacity: 0.85;
}

.markdown-preview hr.hr-double {
    border: none;
    border-top: 3px double var(--border-color);
    margin: 1.5rem 0;
    opacity: 0.95;
}

.markdown-preview blockquote {
    border-left: 4px solid var(--accent-color);
    padding: 0.5rem 1rem;
    background-color: var(--code-bg);
    margin-bottom: calc(var(--editor-font-size, 16px) * var(--editor-line-height, 2.05));
    border-radius: 0 6px 6px 0;
    color: var(--text-secondary);
    line-height: var(--editor-line-height, 2.05);
}

.markdown-preview pre {
    background-color: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.25rem;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    line-height: 1.5;
}

.markdown-preview code {
    background-color: var(--code-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.9em;
    border: 1px solid var(--code-border);
}

.markdown-preview pre code {
    background-color: transparent;
    padding: 0;
    border: none;
}

/* ====================================================
   MODERN CODE BLOCK & SYNTAX HIGHLIGHTING (Prism / Highlight.js)
   ==================================================== */
.code-block-wrapper {
    position: relative;
    background-color: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 9px;
    margin: 1.15rem 0;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.code-block-wrapper:hover {
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
}

.code-block-wrapper.is-editing {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 2px var(--accent-glow), 0 8px 24px rgba(0, 0, 0, 0.28) !important;
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0.85rem;
    background: rgba(0, 0, 0, 0.28);
    border-bottom: 1px solid var(--code-border);
    font-size: 0.75rem;
    user-select: none;
}

.code-block-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-done-code {
    display: none;
    align-items: center;
    gap: 5px;
    background: #10b981;
    color: #ffffff;
    border: 1px solid #10b981;
    border-radius: 5px;
    padding: 2px 9px;
    font-size: 0.72rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35);
    transition: all var(--transition-fast);
}

.btn-done-code:hover {
    background: #059669;
    border-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.5);
}

.code-block-wrapper.is-editing .btn-done-code {
    display: inline-flex !important;
}

.code-edit-status-badge {
    font-size: 0.69rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.04);
    font-family: inherit;
    transition: all var(--transition-fast);
}

.code-block-wrapper.is-editing .code-edit-status-badge {
    display: none !important;
}

body.theme-light .code-edit-status-badge,
body.theme-classic .code-edit-status-badge,
body.theme-github-light .code-edit-status-badge {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
}

body.theme-light .code-block-header,
body.theme-classic .code-block-header,
body.theme-github-light .code-block-header {
    background: rgba(0, 0, 0, 0.05);
}

.code-lang-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--accent-color);
    text-transform: uppercase;
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

.code-lang-badge svg {
    opacity: 0.85;
}

.btn-copy-code {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    padding: 3px 8px;
    font-size: 0.72rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-copy-code:hover {
    background: var(--accent-color);
    color: #0f172a;
    border-color: var(--accent-color);
}

.btn-copy-code.copied {
    background: #10b981 !important;
    color: #ffffff !important;
    border-color: #10b981 !important;
}

.code-block-wrapper pre {
    margin: 0 !important;
    padding: 0.95rem 1.1rem !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    overflow-x: auto;
    font-family: var(--font-mono) !important;
    font-size: 0.88rem;
    line-height: 1.6;
}

.code-block-wrapper pre code.hljs {
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    font-family: var(--font-mono) !important;
    display: block;
    white-space: pre;
    color: var(--text-primary);
    outline: none !important;
    cursor: text;
    tab-size: 4;
    -moz-tab-size: 4;
    caret-color: var(--accent-color);
}

/* Syntax Highlighting Tokens (Tailored for Dark Themes) */
.hljs-keyword,
.hljs-selector-tag,
.hljs-subst {
    color: #ff7b72;
    font-weight: 600;
}

.hljs-string,
.hljs-attribute,
.hljs-symbol,
.hljs-bullet,
.hljs-addition {
    color: #7ee787;
}

.hljs-title,
.hljs-section,
.hljs-selector-id {
    color: #d2a8ff;
    font-weight: 600;
}

.hljs-title.class_,
.hljs-class .hljs-title {
    color: #ffa657;
}

.hljs-title.function_,
.hljs-function .hljs-title {
    color: #79c0ff;
}

.hljs-variable,
.hljs-template-variable {
    color: #ffa657;
}

.hljs-number,
.hljs-literal {
    color: #79c0ff;
}

.hljs-comment,
.hljs-quote {
    color: #8b949e;
    font-style: italic;
}

.hljs-meta {
    color: #79c0ff;
    font-weight: 600;
}

.hljs-meta .hljs-keyword {
    color: #ff7b72;
}

.hljs-params {
    color: #e6edf3;
}

.hljs-built_in {
    color: #ffa657;
}

.hljs-type {
    color: #ff7b72;
}

.hljs-tag,
.hljs-name {
    color: #7ee787;
}

.hljs-attr {
    color: #79c0ff;
}

.hljs-deletion {
    color: #ffa198;
    background-color: rgba(248, 81, 73, 0.15);
}

/* Syntax Highlighting Tokens (Tailored for Light Themes) */
body.theme-light .code-block-wrapper pre code.hljs,
body.theme-classic .code-block-wrapper pre code.hljs,
body.theme-github-light .code-block-wrapper pre code.hljs {
    color: #24292f;
}

body.theme-light .hljs-keyword,
body.theme-classic .hljs-keyword,
body.theme-github-light .hljs-keyword {
    color: #cf222e;
}

body.theme-light .hljs-string,
body.theme-classic .hljs-string,
body.theme-github-light .hljs-string {
    color: #0a3069;
}

body.theme-light .hljs-title.function_,
body.theme-classic .hljs-title.function_,
body.theme-github-light .hljs-title.function_ {
    color: #8250df;
}

body.theme-light .hljs-number,
body.theme-classic .hljs-number,
body.theme-github-light .hljs-number {
    color: #0550ae;
}

body.theme-light .hljs-comment,
body.theme-classic .hljs-comment,
body.theme-github-light .hljs-comment {
    color: #6e7781;
}

body.theme-light .hljs-variable,
body.theme-classic .hljs-variable,
body.theme-github-light .hljs-variable {
    color: #953800;
}

body.theme-light .hljs-built_in,
body.theme-classic .hljs-built_in,
body.theme-github-light .hljs-built_in {
    color: #0550ae;
}

body.theme-light .hljs-tag,
body.theme-classic .hljs-tag,
body.theme-github-light .hljs-tag {
    color: #116329;
}

body.theme-light .hljs-attr,
body.theme-classic .hljs-attr,
body.theme-github-light .hljs-attr {
    color: #0550ae;
}

body.theme-light .btn-copy-code,
body.theme-classic .btn-copy-code,
body.theme-github-light .btn-copy-code {
    background: rgba(0, 0, 0, 0.05);
    color: #475569;
    border-color: rgba(0, 0, 0, 0.12);
}


/* Task List / Checklist in Markdown Preview (Zero extra vertical space, perfectly matches Edit mode) */
.task-list-item {
    list-style: none !important;
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin: 0 !important;
    padding: 0 !important;
    line-height: var(--editor-line-height, 2.05) !important;
}

.task-list-item + br {
    display: none;
}

br:has(+ .task-list-item) {
    display: none;
}

.task-list-item input[type="checkbox"],
.task-list-item input.task-checkbox {
    margin: 0 !important;
    padding: 0 !important;
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--accent-color);
    flex-shrink: 0;
    margin-top: calc((var(--editor-font-size, 16px) * var(--editor-line-height, 2.05) - 15px) / 2) !important;
}

.task-list-item .task-text {
    flex: 1;
    min-width: 0;
    line-height: var(--editor-line-height, 2.05) !important;
    margin: 0 !important;
    padding: 0 !important;
    word-break: break-word;
}

.task-list-item.is-checked {
    color: var(--text-muted);
}

.task-list-item.is-checked .task-text {
    text-decoration: line-through;
}

/* Direct WYSIWYG Editing in Preview Mode (MS Word Style) */
.preview-editable-line {
    position: relative;
    border-radius: 4px;
    user-select: text;
    -webkit-user-select: text;
}

.editable-line-text {
    cursor: text;
    outline: none;
    display: inline-block;
    min-width: 1ch;
    box-sizing: border-box;
    user-select: text;
    -webkit-user-select: text;
}

.editable-line-text:focus {
    outline: none;
}

.editable-line-text:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    font-style: italic;
    pointer-events: none;
}

.task-list-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 4px 0;
    line-height: 1.6;
    user-select: text;
    -webkit-user-select: text;
}

.task-checkbox {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    margin-top: 4px;
    flex-shrink: 0;
}

.preview-line-paragraph {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin: 0.25em 0;
    min-height: 1.6em;
    padding: 1px 2px;
    flex-wrap: wrap;
    user-select: text;
    -webkit-user-select: text;
}

.preview-line-paragraph .editable-line-text {
    flex: 1 1 auto;
}

.btn-inline-edit,
.inline-edit-wrap,
.inline-edit-actions,
.inline-edit-kbd-hint,
.btn-inline-save,
.btn-inline-cancel {
    display: none !important;
}



/* Bottom Status Bar */
.status-bar {
    height: var(--footer-height, 48px);
    min-height: var(--footer-height, 48px);
    max-height: var(--footer-height, 48px);
    box-sizing: border-box;
    border-top: 1px solid var(--border-color);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-muted);
    background-color: var(--bg-editor);
    user-select: none;
}

.status-bar-left, .status-bar-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    pointer-events: auto;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Confirmation */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    padding: 1.75rem;
    box-shadow: var(--shadow-lg);
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.modal-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.btn-secondary {
    padding: 0.55rem 1rem;
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.btn-danger {
    padding: 0.55rem 1rem;
    background-color: #ef4444;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn-primary-action {
    padding: 0.55rem 1.15rem;
    background: linear-gradient(135deg, var(--accent-color), #d97706);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-primary-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.modal-box-wide {
    max-width: 520px;
}

.modal-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.72rem 0.95rem;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    color: #f8fafc;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.modal-input:focus {
    border-color: #f59e0b;
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.22);
}

.modal-input::placeholder {
    color: #64748b;
    font-size: 0.85rem;
}

.modal-group-input {
    flex: 1.4;
    min-width: 200px;
    box-sizing: border-box;
    padding: 0.72rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-app);
    color: var(--text-primary);
    font-size: 0.92rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.modal-group-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Modal Kelola Group Enhancements */
.modal-box-wide {
    max-width: 600px;
    width: 94%;
}

.group-create-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    margin-bottom: 0.25rem;
}

.modal-group-parent-select {
    flex: 1;
    min-width: 140px;
    max-width: 190px;
    box-sizing: border-box;
    padding: 0.72rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-app);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.modal-group-parent-select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.modal-group-parent-select option {
    background-color: var(--bg-sidebar);
    color: var(--text-primary);
}

@media (max-width: 560px) {
    .group-create-row {
        flex-direction: column;
        align-items: stretch;
    }

    .modal-group-parent-select {
        max-width: 100%;
    }
}

.group-manage-header-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.group-manage-list {
    max-height: 250px;
    overflow-y: auto;
    overflow-y: overlay;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding-right: 2px;
    margin-bottom: 0.75rem;
}

.group-manage-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 7px;
    gap: 0.5rem;
    min-height: 42px;
    box-sizing: border-box;
    transition: border-color var(--transition-fast);
}

.group-manage-item:hover {
    border-color: rgba(255, 255, 255, 0.18);
}

.group-manage-item.just-updated {
    border-color: var(--accent-color);
    background-color: var(--bg-card-hover);
    box-shadow: 0 0 0 1px var(--accent-glow);
    animation: groupHighlightPulse 2s ease-out;
}

@keyframes groupHighlightPulse {
    0% {
        border-color: var(--accent-color);
        box-shadow: 0 0 0 3px var(--accent-glow);
    }
    100% {
        border-color: var(--border-color);
        box-shadow: none;
    }
}

.group-manage-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.group-manage-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-manage-badge {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.22);
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    white-space: nowrap;
}

.group-manage-actions {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.btn-manage-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.3rem 0.4rem;
    border-radius: 5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    transition: all var(--transition-fast);
}

.btn-manage-icon:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.btn-manage-icon.btn-delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

.group-inline-edit-box {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
    width: 100%;
}

.group-inline-edit-input {
    flex: 1;
    min-width: 0;
    padding: 0.35rem 0.6rem;
    background: var(--bg-app);
    border: 1px solid var(--border-focus);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    font-family: inherit;
}

.btn-inline-save {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    background: var(--accent-color);
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background var(--transition-fast);
}

.btn-inline-save:hover {
    background: var(--accent-hover);
}

.btn-inline-cancel {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    cursor: pointer;
}

.btn-inline-cancel:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.group-create-container {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1.25rem;
}

.modal-group-parent-select {
    flex: 1;
    min-width: 140px;
    max-width: 190px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 0.72rem 0.75rem;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    box-sizing: border-box;
}

.modal-group-parent-select:focus {
    border-color: var(--border-focus);
}

@media (max-width: 560px) {
    .group-create-row {
        flex-direction: column;
        align-items: stretch;
    }
    .modal-group-parent-select {
        max-width: 100%;
        width: 100%;
    }
}

.group-create-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    padding-left: 0.25rem;
}

.group-manage-item.is-child {
    padding-left: 1.75rem;
    border-left: 3px solid var(--accent-color);
    background: rgba(255, 255, 255, 0.02);
}

.group-parent-badge {
    font-size: 0.65rem;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    white-space: nowrap;
}

.btn-manage-icon.btn-subgroup:hover {
    color: var(--accent-color);
    background: var(--bg-card-hover);
}

/* ====================================================
   SHARED NOTES & PERMISSIONS STYLES
   ==================================================== */
.shared-notice-banner {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 1rem;
    margin: 0.75rem 1.5rem 0.25rem 1.5rem;
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.4;
    transition: all var(--transition-fast);
}

.shared-notice-banner.notice-readonly {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.shared-notice-banner.notice-collab {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.shared-notice-banner.notice-owner-shared {
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.32);
    color: #a5b4fc;
}

.note-title-input.is-readonly,
.note-editor-textarea.is-readonly {
    cursor: default;
    user-select: text;
}

.note-title-input.is-readonly {
    color: var(--text-primary);
}

/* Sidebar Badges for Shared Notes */
.badge-shared {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.68rem;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
}

.badge-shared-recipient {
    background: rgba(59, 130, 246, 0.14);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.28);
}

.badge-shared-owner {
    background: rgba(99, 102, 241, 0.14);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.32);
    font-weight: 600;
}

.note-shared-icon-badge {
    color: #818cf8;
    display: inline-flex;
    align-items: center;
    margin-left: 5px;
    flex-shrink: 0;
}

.tree-item-shared {
    margin-bottom: 2px;
}

/* Share Modal Styles */
.share-form-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
}

.share-form-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.share-form-grid {
    display: flex;
    gap: 0.65rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.share-input-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.share-select {
    width: 100%;
    height: 38px;
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 0 0.65rem;
    font-size: 0.825rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.share-select:focus {
    border-color: var(--accent-color);
}

.share-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin: 1rem 0 0.5rem 0;
    letter-spacing: 0.03em;
}

.share-list-count {
    font-size: 0.7rem;
    background: var(--bg-card);
    color: var(--text-muted);
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
}

.share-users-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    overflow-y: overlay;
    padding-right: 2px;
}

.share-user-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all var(--transition-fast);
    gap: 0.75rem;
}

.share-user-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.share-user-info {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    flex: 1;
}

.share-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), #d97706);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.share-user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    line-height: 1.25;
}

.share-user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.share-user-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.share-user-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.share-perm-select {
    height: 30px;
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-primary);
    padding: 0 0.5rem;
    font-size: 0.76rem;
    outline: none;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.share-perm-select:focus {
    border-color: var(--accent-color);
}

.share-perm-owner-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-revoke-share {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    border-radius: 6px;
    padding: 0.28rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: all var(--transition-fast);
}

.btn-revoke-share:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #f87171;
}

.share-empty-state {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-style: italic;
    background: var(--bg-app);
    border-radius: 6px;
    border: 1px dashed var(--border-color);
}

/* Public Share Link Card */
.public-share-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(245, 158, 11, 0.04));
    border: 1px solid rgba(99, 102, 241, 0.28);
    border-radius: 9px;
    padding: 0.9rem 1.05rem;
    margin-bottom: 1.1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.public-share-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.18rem 0.55rem;
    border-radius: 9999px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.public-share-badge.active {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.public-share-badge.inactive {
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-muted);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.public-share-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.public-share-url-input {
    flex: 1;
    min-width: 180px;
    height: 38px;
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 0 0.75rem;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    outline: none;
    user-select: all;
    transition: border-color var(--transition-fast);
}

.public-share-url-input:focus {
    border-color: var(--accent-color);
}

.btn-public-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    height: 38px;
    padding: 0 0.85rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.btn-public-action:hover {
    transform: translateY(-1px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 310px;
        max-width: 85vw;
        min-width: 0;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        box-shadow: none;
        overflow: hidden;
        visibility: hidden;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s ease;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        visibility: visible;
        box-shadow: 10px 0 35px rgba(0, 0, 0, 0.6);
    }

    /* On mobile, override desktop .collapsed class */
    .sidebar.collapsed {
        transform: translateX(-100%) !important;
        width: 310px !important;
        max-width: 85vw !important;
        visibility: hidden !important;
        opacity: 1 !important;
    }

    .sidebar-backdrop {
        display: block;
    }

    .sidebar-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* Responsive Toolbar */
    .sidebar-header,
    .toolbar {
        height: 56px;
        min-height: 56px;
        max-height: 56px;
        box-sizing: border-box;
    }

    .toolbar {
        padding: 0 0.75rem;
        gap: 0.4rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .toolbar::-webkit-scrollbar {
        display: none;
    }

    .toolbar-left, .toolbar-right {
        gap: 0.35rem;
    }

    .save-status {
        padding: 0.25rem 0.5rem;
        font-size: 0.72rem;
    }

    .custom-select {
        padding: 0.35rem 0.45rem;
        font-size: 0.75rem;
        max-width: 105px;
    }

    .mode-pill {
        padding: 0.25rem 0.45rem;
        font-size: 0.75rem;
    }

    .note-title-wrapper {
        padding: 0.85rem 1.25rem 0.4rem 1.25rem;
    }

    .note-title-input {
        font-size: 1.35rem;
    }

    .editor-wrapper {
        padding: 0;
    }

    .note-editor-textarea, .markdown-preview {
        padding: 1rem 1.25rem;
    }

    .status-bar {
        padding: 0 0.85rem;
        font-size: 0.7rem;
    }

    .status-bar-right span:first-child {
        display: none; /* Hide tab indicator on mobile to save space */
    }
}

/* ====================================================
   GOOGLE GEMINI AI ASSISTANT STYLES
   ==================================================== */

.ai-dropdown-wrapper {
    position: relative;
    display: inline-flex;
}

.btn-ai-sparkle {
    position: relative;
    color: #a855f7 !important;
    background: rgba(168, 85, 247, 0.12) !important;
    border: 1px solid rgba(168, 85, 247, 0.35) !important;
    transition: all var(--transition-fast) !important;
}

.btn-ai-sparkle:hover,
.btn-ai-sparkle.active {
    color: #ffffff !important;
    background: linear-gradient(135deg, #a855f7, #6366f1) !important;
    border-color: transparent !important;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.5);
    transform: translateY(-1px);
}

.btn-ai-sparkle.is-loading {
    animation: ai-pulse-glow 1.2s infinite alternate;
    pointer-events: none;
}

@keyframes ai-pulse-glow {
    0% {
        box-shadow: 0 0 4px rgba(168, 85, 247, 0.3);
        opacity: 0.7;
    }
    100% {
        box-shadow: 0 0 16px rgba(168, 85, 247, 0.85);
        opacity: 1;
    }
}

.ai-sparkle-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ec4899;
    box-shadow: 0 0 6px #ec4899;
}

/* Dropdown Menu */
.ai-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 290px;
    background: var(--bg-card);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    display: none;
    flex-direction: column;
    z-index: 500;
    animation: fadeInDown 0.18s ease-out;
}

.ai-dropdown-menu.active {
    display: flex;
}

.ai-menu-header {
    padding: 8px 10px 6px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}

.ai-menu-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-primary);
}

.ai-badge-free {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 20px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    letter-spacing: 0.5px;
}

.ai-menu-sub {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.ai-selection-badge {
    margin: 4px 6px 6px;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px dashed rgba(59, 130, 246, 0.4);
    font-size: 0.72rem;
    color: #60a5fa;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-menu-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
    box-sizing: border-box;
}

.ai-menu-item:hover {
    background: rgba(168, 85, 247, 0.12);
}

.ai-menu-item-primary {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.16), rgba(99, 102, 241, 0.12));
    border: 1px solid rgba(168, 85, 247, 0.35);
    margin-bottom: 4px;
    position: relative;
}

.ai-menu-item-primary:hover {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.28), rgba(99, 102, 241, 0.22));
    border-color: rgba(168, 85, 247, 0.6);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.2);
}

.ai-menu-item-primary .ai-item-title {
    color: #c084fc;
    font-weight: 700;
}

.ai-item-icon {
    font-size: 1.15rem;
    line-height: 1.2;
    flex-shrink: 0;
}

.ai-item-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ai-item-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ai-item-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.ai-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.ai-menu-settings {
    opacity: 0.85;
}

.ai-menu-settings:hover {
    opacity: 1;
    background: var(--bg-card-hover);
}

/* Large Modal for AI Preview */
.modal-box-large {
    max-width: 860px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.modal-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.modal-header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ai-badge-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-badge-header .modal-title {
    margin-bottom: 0;
}

.ai-icon-pulse {
    font-size: 1.25rem;
    animation: rotateSparkle 3s linear infinite;
}

@keyframes rotateSparkle {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.15) rotate(15deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.ai-mode-tag {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(168, 85, 247, 0.18);
    color: #c084fc;
    display: inline-block;
    width: fit-content;
}

.ai-scope-banner {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.78rem;
    color: #93c5fd;
    margin-bottom: 0.75rem;
}

/* Tabs */
.ai-tabs-nav {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 0.85rem;
}

.ai-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.ai-tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.ai-tab-btn.active {
    color: #ffffff;
    background: rgba(168, 85, 247, 0.25);
    border-color: rgba(168, 85, 247, 0.45);
    font-weight: 600;
}

/* Tab Panes */
.ai-tab-panes {
    flex: 1;
    min-height: 280px;
    max-height: 52vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.6);
    position: relative;
}

.ai-tab-pane {
    display: none;
    height: 100%;
}

.ai-tab-pane.active {
    display: block;
}

.ai-preview-rendered {
    padding: 1.25rem;
    height: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    color: var(--text-primary);
    line-height: 1.7;
}

.ai-preview-rendered code {
    background-color: var(--code-bg);
    padding: 0.15rem 0.45rem;
    border-radius: 5px;
    font-family: var(--font-mono);
    font-size: 0.88em;
    border: 1px solid var(--code-border);
    color: #93c5fd;
    font-weight: 500;
}

.ai-raw-textarea {
    width: 100%;
    height: 100%;
    min-height: 280px;
    box-sizing: border-box;
    padding: 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.88rem;
    line-height: 1.6;
    resize: none;
    outline: none;
}

/* Compare Grid */
.ai-compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 100%;
    min-height: 280px;
}

.ai-compare-col {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    height: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.ai-compare-col:first-child {
    border-right: 1px solid var(--border-color);
}

.ai-compare-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.ai-compare-label-new {
    color: #a855f7;
}

.ai-compare-box {
    flex: 1;
    overflow-y: auto;
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.ai-compare-box-new {
    color: var(--text-primary);
    background: rgba(168, 85, 247, 0.08);
    border: 1px solid rgba(168, 85, 247, 0.2);
}

/* AI Modal Footer */
.ai-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

.ai-footer-left,
.ai-footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-glow-ai {
    background: linear-gradient(135deg, #a855f7, #6366f1) !important;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4) !important;
}

.btn-glow-ai:hover {
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.6) !important;
    transform: translateY(-1px);
}

/* Custom Prompt Modal */
.ai-custom-prompt-wrapper {
    margin-bottom: 1rem;
}

.ai-prompt-presets {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-presets-label {
    font-size: 0.74rem;
    color: var(--text-muted);
    font-weight: 600;
}

.ai-preset-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ai-preset-chip {
    padding: 4px 10px;
    border-radius: 16px;
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.ai-preset-chip:hover {
    color: var(--text-primary);
    background: rgba(168, 85, 247, 0.2);
    border-color: rgba(168, 85, 247, 0.4);
}

/* Settings Modal */
.ai-settings-banner {
    display: flex;
    gap: 10px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(6, 182, 212, 0.12));
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 0.85rem;
}

.ai-settings-banner-icon {
    font-size: 1.35rem;
    line-height: 1;
}

.ai-settings-banner-text {
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-primary);
}

.ai-settings-banner-text p {
    margin: 3px 0 0;
    color: var(--text-secondary);
}

.ai-link {
    color: #34d399;
    text-decoration: underline;
    font-weight: 600;
}

.ai-key-input-wrapper {
    display: flex;
    position: relative;
    align-items: center;
}

.btn-toggle-key-visibility {
    position: absolute;
    right: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.btn-toggle-key-visibility:hover {
    opacity: 1;
}

.ai-key-help {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.ai-test-connection-box {
    margin-top: 0.85rem;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    line-height: 1.4;
}

.ai-test-connection-box.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid #10b981;
    color: #34d399;
}

.ai-test-connection-box.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid #ef4444;
    color: #f87171;
}

/* AI Loading Overlay on Editor Wrapper */
.ai-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 250;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.68);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.22s ease-in-out;
}

.ai-loading-overlay.active {
    opacity: 1;
}

.ai-loading-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.96));
    border: 1px solid rgba(168, 85, 247, 0.45);
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.55), 0 0 30px rgba(168, 85, 247, 0.25);
    border-radius: 18px;
    padding: 24px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
    min-width: 280px;
    max-width: 380px;
    animation: aiCardPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-loading-icon-wrap {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-loading-glow {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.5), transparent 70%);
    animation: aiGlowPulse 1.8s infinite alternate;
}

.ai-loading-spinner {
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: #c084fc;
    border-right-color: #6366f1;
    animation: aiSpin 0.95s linear infinite;
}

.ai-loading-sparkle-center {
    font-size: 1.45rem;
    line-height: 1;
    animation: rotateSparkle 2.5s ease-in-out infinite;
}

.ai-loading-text-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ai-loading-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: -0.2px;
}

.ai-loading-subtitle {
    font-size: 0.78rem;
    color: #94a3b8;
    line-height: 1.35;
    max-width: 290px;
}

.ai-loading-progress-track {
    width: 100%;
    height: 4px;
    background: rgba(51, 65, 85, 0.55);
    border-radius: 99px;
    overflow: hidden;
    position: relative;
    margin-top: 4px;
}

.ai-loading-progress-bar {
    width: 45%;
    height: 100%;
    background: linear-gradient(90deg, #a855f7, #6366f1, #38bdf8);
    border-radius: 99px;
    animation: aiIndeterminate 1.4s ease-in-out infinite;
}

@keyframes aiCardPop {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes aiSpin {
    to { transform: rotate(360deg); }
}

@keyframes aiGlowPulse {
    from { transform: scale(0.85); opacity: 0.45; }
    to { transform: scale(1.18); opacity: 1; }
}

@keyframes aiIndeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(250%); }
}

/* =========================================================
   FLOATING SELECTION TOOLBAR (MS WORD-STYLE MINI POPUP)
   ========================================================= */
.floating-selection-toolbar {
    position: fixed;
    z-index: 10000;
    pointer-events: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px) scale(0.96);
    transition: opacity 0.16s ease, transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.16s;
    user-select: none;
    -webkit-user-select: none;
}

/* Pastikan floating toolbar langsung dan mutlak hilang saat AI sedang loading atau saat Search Bar aktif */
body.ai-loading-active .floating-selection-toolbar,
body.search-bar-active .floating-selection-toolbar {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.floating-selection-toolbar.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.fst-toolbar-content {
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    padding: 6px 8px;
    box-shadow: 0 14px 34px -4px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(255, 255, 255, 0.08);
    gap: 4px;
    position: relative;
    box-sizing: border-box;
}

/* Light theme support */
body.theme-light .fst-toolbar-content,
body.theme-classic .fst-toolbar-content,
body.theme-solarized-light .fst-toolbar-content,
body.theme-gruvbox-light .fst-toolbar-content,
body.theme-lavender .fst-toolbar-content,
body.theme-matcha .fst-toolbar-content {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(0, 0, 0, 0.14);
    box-shadow: 0 14px 34px -4px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.fst-toolbar-row {
    display: flex;
    align-items: center;
    gap: 3px;
    width: 100%;
}

.fst-toolbar-row-top {
    justify-content: flex-start;
}

.fst-toolbar-row-bottom {
    justify-content: space-between;
}

.fst-copy-actions-group {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-wrap: nowrap;
}

.fst-row-divider {
    height: 1px;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    margin: 1px 0;
}

body.theme-light .fst-row-divider,
body.theme-classic .fst-row-divider,
body.theme-solarized-light .fst-row-divider,
body.theme-gruvbox-light .fst-row-divider,
body.theme-lavender .fst-row-divider,
body.theme-matcha .fst-row-divider {
    background: rgba(0, 0, 0, 0.08);
}

.fst-btn-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.fst-btn {
    background: transparent;
    border: none;
    color: var(--text-primary, #f8fafc);
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.14s ease;
    line-height: 1;
    min-width: 28px;
    height: 28px;
    box-sizing: border-box;
}

.fst-btn:hover {
    background: rgba(168, 85, 247, 0.22);
    color: #c084fc;
    transform: translateY(-1px);
}

.fst-btn:active {
    transform: translateY(0) scale(0.95);
}

.fst-btn.active {
    background: rgba(168, 85, 247, 0.35) !important;
    color: #f3e8ff !important;
    border: 1px solid rgba(168, 85, 247, 0.6);
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.3);
}

body.theme-light .fst-btn.active,
body.theme-classic .fst-btn.active,
body.theme-solarized-light .fst-btn.active,
body.theme-gruvbox-light .fst-btn.active,
body.theme-lavender .fst-btn.active,
body.theme-matcha .fst-btn.active {
    background: rgba(168, 85, 247, 0.25) !important;
    color: #7e22ce !important;
    border-color: rgba(168, 85, 247, 0.5);
}

.fst-btn-bold strong {
    font-family: serif;
    font-size: 1.05rem;
    font-weight: 700;
}

.fst-btn-italic em {
    font-family: serif;
    font-size: 1.05rem;
    font-style: italic;
}

.fst-btn-strike s {
    font-weight: 600;
}

.fst-btn-code code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.78rem;
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 4px;
    border-radius: 4px;
    color: #38bdf8;
}

.fst-tag-text {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.fst-icon-btn {
    font-size: 0.95rem;
    padding: 4px 6px;
}

.fst-divider {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.14);
    margin: 0 3px;
}

body.theme-light .fst-divider,
body.theme-solarized-light .fst-divider {
    background: rgba(0, 0, 0, 0.12);
}

.fst-more-icons-wrap {
    position: relative;
    display: inline-block;
}

.fst-btn-more-icons span {
    font-size: 0.76rem;
}

.fst-icons-dropdown {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
    z-index: 10005;
    animation: fstDropIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

body.theme-light .fst-icons-dropdown,
body.theme-solarized-light .fst-icons-dropdown {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.22);
}

@keyframes fstDropIn {
    from { opacity: 0; transform: translateX(-50%) translateY(6px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.fst-icons-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    min-width: 260px;
}

.fst-grid-icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 6px 8px;
    color: var(--text-primary, #f8fafc);
    font-size: 0.78rem;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    transition: all 0.14s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.fst-grid-icon-btn:hover {
    background: rgba(168, 85, 247, 0.25);
    border-color: rgba(168, 85, 247, 0.5);
    color: #f3e8ff;
    transform: translateY(-1px);
}

body.theme-light .fst-grid-icon-btn,
body.theme-solarized-light .fst-grid-icon-btn {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
    color: #1e293b;
}

.fst-btn-copy-prompt {
    color: #38bdf8;
    font-weight: 600;
    font-size: 0.8rem;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 4px 9px;
    border-radius: 6px;
    white-space: nowrap;
}

.fst-btn-copy-prompt:hover {
    background: rgba(56, 189, 248, 0.28);
    color: #e0f2fe;
}

.fst-btn-copy-unchecked {
    color: #f59e0b;
    font-weight: 600;
    font-size: 0.8rem;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.32);
    padding: 4px 9px;
    border-radius: 6px;
    white-space: nowrap;
}

.fst-btn-copy-unchecked:hover {
    background: rgba(245, 158, 11, 0.26);
    color: #fef3c7;
}

body.theme-light .fst-btn-copy-unchecked,
body.theme-solarized-light .fst-btn-copy-unchecked {
    color: #b45309;
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.35);
}

.fst-btn-copy-unchecked-md {
    color: #10b981;
    font-weight: 600;
    font-size: 0.8rem;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.32);
    padding: 4px 9px;
    border-radius: 6px;
    white-space: nowrap;
}

.fst-btn-copy-unchecked-md:hover {
    background: rgba(16, 185, 129, 0.26);
    color: #d1fae5;
}

body.theme-light .fst-btn-copy-unchecked-md,
body.theme-solarized-light .fst-btn-copy-unchecked-md {
    color: #047857;
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.35);
}

.fst-btn-preview-edit {
    color: #c084fc;
    font-weight: 600;
    font-size: 0.8rem;
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.3);
    padding: 4px 9px;
}

.fst-btn-preview-edit:hover {
    background: rgba(168, 85, 247, 0.28);
    color: #f3e8ff;
}

/* AI Assistant Dropdown on Floating Toolbar */
.fst-ai-wrap {
    position: relative;
    display: inline-block;
}

.fst-btn-ai {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.24), rgba(99, 102, 241, 0.24));
    border: 1px solid rgba(168, 85, 247, 0.45);
    color: #e9d5ff;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 4px 9px;
    border-radius: 6px;
    white-space: nowrap;
    gap: 4px;
    display: inline-flex;
    align-items: center;
}

.fst-btn-ai:hover {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.42), rgba(99, 102, 241, 0.42));
    border-color: #c084fc;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.35);
}

.fst-ai-arrow {
    font-size: 0.65rem;
    opacity: 0.8;
    margin-left: 1px;
}

.fst-ai-dropdown {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    min-width: 250px;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(168, 85, 247, 0.35);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
    z-index: 10006;
    animation: fstDropIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

body.theme-light .fst-ai-dropdown,
body.theme-solarized-light .fst-ai-dropdown {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(168, 85, 247, 0.35);
    box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.22);
}

.fst-ai-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 10px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    width: 100%;
    color: var(--text-primary, #f8fafc);
    transition: all 0.14s ease;
    box-sizing: border-box;
}

.fst-ai-item:hover {
    background: rgba(168, 85, 247, 0.18);
    transform: translateX(2px);
}

.fst-ai-item-icon {
    font-size: 1.05rem;
    line-height: 1.2;
    flex-shrink: 0;
}

.fst-ai-item-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.fst-ai-item-text strong {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e9d5ff;
}

body.theme-light .fst-ai-item-text strong,
body.theme-solarized-light .fst-ai-item-text strong {
    color: #7c3aed;
}

.fst-ai-item-text small {
    font-size: 0.7rem;
    color: var(--text-muted, #94a3b8);
    line-height: 1.2;
}

/* =========================================================
   FOCUSED AI LOADER & TARGETED SENTENCE HIGHLIGHT
   ========================================================= */

/* Badge indikator cakupan target pada modal Custom Prompt */
.ai-custom-target-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.35);
    border-radius: 8px;
    padding: 6px 12px;
    margin-bottom: 0.75rem;
    font-size: 0.82rem;
    color: #e2e8f0;
}

body.theme-light .ai-custom-target-badge,
body.theme-solarized-light .ai-custom-target-badge {
    background: rgba(168, 85, 247, 0.08);
    border-color: rgba(168, 85, 247, 0.3);
    color: #334155;
}

.ai-custom-target-icon {
    font-size: 1rem;
}

.ai-custom-target-label {
    font-weight: 700;
    color: #c084fc;
}

body.theme-light .ai-custom-target-label,
body.theme-solarized-light .ai-custom-target-label {
    color: #7c3aed;
}

.ai-custom-target-text {
    font-style: italic;
    color: #cbd5e1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 380px;
}

body.theme-light .ai-custom-target-text,
body.theme-solarized-light .ai-custom-target-text {
    color: #475569;
}

/* Focused AI Loader (Menargetkan teks/kalimat terpilih secara lokal) */
.ai-focused-loader {
    position: fixed;
    z-index: 10001;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 7px 16px;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(168, 85, 247, 0.6);
    border-radius: 9999px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 24px rgba(168, 85, 247, 0.38);
    color: #f8fafc;
    font-size: 0.84rem;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transform: translateY(6px) scale(0.96);
    transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    white-space: nowrap;
}

.ai-focused-loader.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

body.theme-light .ai-focused-loader,
body.theme-solarized-light .ai-focused-loader {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(168, 85, 247, 0.65);
    color: #0f172a;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14), 0 0 18px rgba(168, 85, 247, 0.28);
}

.ai-focused-spinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(168, 85, 247, 0.25);
    border-top-color: #c084fc;
    border-radius: 50%;
    animation: aiFocusedSpin 0.75s linear infinite;
    flex-shrink: 0;
}

@keyframes aiFocusedSpin {
    to { transform: rotate(360deg); }
}

.ai-focused-sparkle {
    display: inline-block;
    font-size: 0.95rem;
    animation: aiSparklePulse 1.4s ease-in-out infinite;
}

@keyframes aiSparklePulse {
    0%, 100% { transform: scale(1); opacity: 0.85; }
    50% { transform: scale(1.3); opacity: 1; filter: drop-shadow(0 0 6px #c084fc); }
}

.ai-focused-text {
    letter-spacing: 0.2px;
}

/* Shimmer Highlight pada Kalimat Terpilih di Mode Preview */
.ai-inline-target-loading {
    position: relative;
    border-radius: 6px;
    outline: 2px solid rgba(168, 85, 247, 0.65) !important;
    outline-offset: 2px;
    background: linear-gradient(90deg, rgba(168, 85, 247, 0.12), rgba(59, 130, 246, 0.22), rgba(168, 85, 247, 0.12)) !important;
    background-size: 200% 100% !important;
    animation: aiTargetShimmer 1.8s linear infinite !important;
    box-shadow: 0 0 18px rgba(168, 85, 247, 0.28) !important;
    transition: all 0.2s ease;
}

@keyframes aiTargetShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* AI Polish Locked Selection & Interactive Protection */
.ai-locked-target,
.ai-locked-line,
[data-ai-locked="true"] {
    position: relative !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    cursor: not-allowed !important;
    outline: 2px dashed rgba(168, 85, 247, 0.8) !important;
    outline-offset: 3px;
    background: linear-gradient(90deg, rgba(168, 85, 247, 0.16), rgba(59, 130, 246, 0.24), rgba(168, 85, 247, 0.16)) !important;
    background-size: 200% 100% !important;
    animation: aiTargetShimmer 1.8s linear infinite !important;
    border-radius: 6px;
    box-shadow: 0 0 18px rgba(168, 85, 247, 0.35) !important;
    transition: all 0.2s ease;
}

.ai-locked-target *,
.ai-locked-line *,
[data-ai-locked="true"] * {
    user-select: none !important;
    -webkit-user-select: none !important;
    cursor: not-allowed !important;
}

.ai-locked-target input[type="checkbox"],
.ai-locked-line input[type="checkbox"],
[data-ai-locked="true"] input[type="checkbox"] {
    pointer-events: none !important;
    opacity: 0.55;
}

.ai-locked-segment {
    display: inline !important;
    border-radius: 4px;
    padding: 1px 4px;
    user-select: none !important;
    -webkit-user-select: none !important;
    cursor: not-allowed !important;
}

.ai-locked-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(168, 85, 247, 0.95);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 9999px;
    margin-right: 6px;
    vertical-align: middle;
    user-select: none;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Animasi highlight lembut saat teks selesai dipoles AI */
.ai-just-polished {
    animation: aiJustPolishedGlow 2.2s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
    border-radius: 6px;
}

@keyframes aiJustPolishedGlow {
    0% {
        background-color: rgba(34, 197, 94, 0.35);
        outline: 2px solid rgba(34, 197, 94, 0.7);
        outline-offset: 2px;
        box-shadow: 0 0 18px rgba(34, 197, 94, 0.45);
    }
    60% {
        background-color: rgba(34, 197, 94, 0.15);
        outline: 2px solid rgba(34, 197, 94, 0.35);
    }
    100% {
        background-color: transparent;
        outline: 2px solid transparent;
        outline-offset: 0;
        box-shadow: none;
    }
}

/* =========================================================
   IN-NOTE SEARCH & REPLACE BAR (MARKDOWN & VISUAL MODES)
   ========================================================= */
.note-search-bar {
    position: absolute;
    top: 14px;
    right: 28px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 7px 10px;
    box-shadow: 0 16px 36px -6px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
    min-width: 330px;
    max-width: 460px;
    box-sizing: border-box;
    animation: noteSearchSlideDown 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    user-select: none;
}

@keyframes noteSearchSlideDown {
    0% {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Light & Classic theme adaptations */
body.theme-light .note-search-bar,
body.theme-classic .note-search-bar,
body.theme-solarized-light .note-search-bar,
body.theme-gruvbox-light .note-search-bar,
body.theme-lavender .note-search-bar,
body.theme-matcha .note-search-bar {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(0, 0, 0, 0.14);
    box-shadow: 0 14px 30px -4px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.note-search-main-row,
.note-replace-row {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.note-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.note-search-icon {
    position: absolute;
    left: 8px;
    color: var(--text-muted);
    pointer-events: none;
    flex-shrink: 0;
}

.note-search-input {
    width: 100%;
    height: 30px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 0 24px 0 28px;
    color: var(--text-primary);
    font-size: 0.84rem;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

body.theme-light .note-search-input,
body.theme-classic .note-search-input,
body.theme-solarized-light .note-search-input,
body.theme-gruvbox-light .note-search-input,
body.theme-lavender .note-search-input,
body.theme-matcha .note-search-input {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.14);
}

.note-search-input:focus {
    border-color: var(--accent-color);
    background: rgba(0, 0, 0, 0.38);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

body.theme-light .note-search-input:focus,
body.theme-classic .note-search-input:focus {
    background: #ffffff;
}

.note-search-input::placeholder {
    color: var(--text-muted);
    opacity: 0.75;
}

.btn-search-clear {
    position: absolute;
    right: 6px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
}

.btn-search-clear:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.note-search-info {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.note-search-count {
    font-size: 0.76rem;
    font-family: var(--font-mono, monospace);
    font-weight: 600;
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    min-width: 32px;
    text-align: center;
}

.note-search-count.has-matches {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
}

.note-search-count.no-matches {
    color: #f87171;
    background: rgba(239, 68, 68, 0.12);
}

.note-search-nav-buttons,
.note-search-options,
.note-replace-buttons {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

.btn-search-nav,
.btn-search-toggle,
.btn-search-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.btn-search-nav:hover,
.btn-search-toggle:hover,
.btn-search-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

body.theme-light .btn-search-nav:hover,
body.theme-light .btn-search-toggle:hover,
body.theme-light .btn-search-close:hover {
    background: rgba(0, 0, 0, 0.06);
}

.btn-search-toggle.active {
    background: var(--accent-glow);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.btn-search-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.note-replace-row {
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

body.theme-light .note-replace-row {
    border-top-color: rgba(0, 0, 0, 0.08);
}

.btn-replace-action {
    height: 28px;
    padding: 0 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 0.76rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-replace-action:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #000;
}

/* =========================================================
   SEARCH HIGHLIGHTING IN VISUAL / PREVIEW MODE
   ========================================================= */
mark.note-search-highlight {
    background: rgba(245, 158, 11, 0.38) !important;
    color: inherit !important;
    border-radius: 3px;
    padding: 1px 2px;
    margin: 0 -1px;
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.45);
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

mark.note-search-highlight.note-search-highlight-active {
    background: #f59e0b !important;
    color: #0f172a !important;
    font-weight: 700 !important;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.9), 0 0 0 2px #ffffff;
    animation: searchHighlightPulse 1.4s ease-in-out infinite;
}

@keyframes searchHighlightPulse {
    0%, 100% {
        box-shadow: 0 0 8px rgba(245, 158, 11, 0.8), 0 0 0 2px rgba(255, 255, 255, 0.9);
    }
    50% {
        box-shadow: 0 0 16px rgba(245, 158, 11, 1), 0 0 0 3px #fbbf24;
    }
}

/* Mobile search bar adjustments */
@media (max-width: 640px) {
    .note-search-bar {
        left: 10px;
        right: 10px;
        min-width: unset;
        max-width: unset;
        width: calc(100% - 20px);
        top: 8px;
    }
}


