/* REDLINE Notes - Main Stylesheet
   All custom styles for the app (sharp zero-radius, #dc2626 red accents, zinc/dark + full light theme).
   Keep this file focused on layout, components, and theme overrides.
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Space+Grotesk:wght@500;600&display=swap');

:root {
    --red-accent: #dc2626;
    --ring: #dc2626;
    --editor-bg: #18181b;
    --line-number-color: #52525b;
}

.dark {
    --red-accent: #ef4444;
    --ring: #ef4444;
    --editor-bg: #18181b;
    --line-number-color: #52525b;
}

.light {
    --editor-bg: #f8fafc;
    --line-number-color: #94a3b8;
}

body { font-family: 'Inter', system_ui, sans-serif; }
.font-display { font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 600; letter-spacing: -0.025em; }
.sharp { border-radius: 0 !important; }

.demo-button {
    font-weight: 600;
    letter-spacing: -0.01em;
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}
.demo-button-red {
    background-color: #dc2626;
    color: white;
    border: 1px solid #b91c1c;
}
.demo-button-red:hover {
    background-color: #b91c1c;
}

/* Light theme hover fixes for header demo buttons (import, cmd-palette, help, theme toggle).
   They use hover:bg-zinc-900 in HTML (dark) which looks poor in light mode. */
.light .demo-button:hover {
  background-color: #e2e8f0 !important;
  color: #1e2937 !important;
  border-color: #cbd5e1 !important;
}

/* New note (demo-button-red) should keep its red hover even in light theme. */
.light .demo-button-red:hover {
  background-color: #b91c1c !important;
  color: white !important;
  border-color: #b91c1c !important;
}

.section-header {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #71717a;
    padding-bottom: 6px;
    border-bottom: 2px solid #dc2626;
    margin-bottom: 8px;
}
.dark .section-header { color: #a1a1aa; border-bottom-color: #ef4444; }
.light .section-header { color: #475569; border-bottom-color: #dc2626; }

.note-item {
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}
.note-item:hover { background-color: #18181b; border-color: #3f3f46; }
.note-item.active {
    background-color: #27251f;
    border-color: #dc2626;
    border-left: 3px solid #dc2626;
}
.dark .note-item.active { background-color: #27251f; border-color: #ef4444; border-left: 3px solid #ef4444; }
.light .note-item:hover { background: #f1f5f9; border-color: #e2e8f0; }
.light .note-item.active { background: #fff; border-color: #dc2626; border-left-color: #dc2626; }

/* Line Numbers */
.editor-wrapper {
    display: flex;
    flex: 1;
    position: relative;
    overflow: hidden;
}
.line-numbers {
    background-color: var(--editor-bg);
    color: var(--line-number-color);
    text-align: right;
    padding: 24px 12px;
    user-select: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
    font-size: 14.5px;
    line-height: 1.65;
    border-right: 1px solid #3f3f46;
    overflow-y: hidden;
    pointer-events: none;
    z-index: 10;
}
.editor-with-lines {
    position: relative;
    flex: 1;
    overflow: hidden;
    height: 100%;
    min-height: 0; /* important for flex in some browsers */
}

/* Legacy line-numbers is hidden (CM provides its own gutter) */
#line-numbers {
    display: none !important;
}

/* CodeMirror container - reset any old overlay styles and ensure it fills */
#markdown-editor {
    position: static !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    height: 100% !important;
    background: transparent;
    color: inherit;
    -webkit-text-fill-color: inherit;
    z-index: auto;
    padding: 0;
    margin: 0;
    border: none;
    overflow: visible;
    min-height: 200px; /* prevent collapse */
}

/* CodeMirror core styles to match the app theme */
.cm-container .CodeMirror {
    height: 100% !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
    font-size: 14.5px;
    line-height: 1.65;
    background: #18181b;
    color: #e4e4e7;
    border: none;
    padding: 0;
}
.cm-container .CodeMirror-scroll {
    min-height: 100%;
}
.cm-container .CodeMirror-gutters {
    background: #18181b;
    border-right: 1px solid #3f3f46;
}
.cm-container .CodeMirror-linenumber {
    color: #71717a;
}
.cm-container .CodeMirror-cursor {
    border-left-color: #f87171;
}
.cm-container .CodeMirror-selected {
    background: rgba(248, 113, 113, 0.3);
}

.light .cm-container .CodeMirror {
    background: #f8fafc;
    color: #1f2937;
}
.light .cm-container .CodeMirror-gutters {
    background: #f1f5f9;
    border-right-color: #e2e8f0;
}
.light .cm-container .CodeMirror-linenumber {
    color: #6b7280;
}
.light .cm-container .CodeMirror-selected {
    background: rgba(185, 28, 28, 0.2);
}

/* CodeMirror styling to match the app (VS Code-like feel).
   Source editor is intentionally raw/plain text (mode: null) — no syntax token coloring.
   Only base editor, gutter, cursor, selection, and wrap rules are styled. */
.cm-container .CodeMirror {
  height: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 14.5px;
  line-height: 1.65;
  background: #18181b;
  color: #e4e4e7;
  border: none;
  padding: 0;
}
.light .cm-container .CodeMirror {
  background: #f8fafc;
  color: #1f2937;
}
.cm-container .CodeMirror-gutters {
  background: #18181b;
  border-right: 1px solid #3f3f46;
}
.light .cm-container .CodeMirror-gutters {
  background: #f1f5f9;
  border-right-color: #e2e8f0;
}
.cm-container .CodeMirror-linenumber {
  color: #71717a;
  padding: 0 8px;
}
.light .cm-container .CodeMirror-linenumber {
  color: #6b7280;
}
.cm-container .CodeMirror-cursor {
  border-left: 1px solid #f87171;
}
.cm-container .CodeMirror-selected {
  background: rgba(248, 113, 113, 0.3);
}
.light .cm-container .CodeMirror-selected {
  background: rgba(185, 28, 28, 0.2);
}

/* No syntax highlighting tokens for the source editor (raw text mode as requested).
   Base CM editor styling remains for monospace, gutters, selection, etc. to keep the raw text editor feel. */

/* Rich Preview */
.markdown-preview {
    font-size: 15.2px;
    line-height: 1.78;
    color: #e4e4e7;
}
.light .markdown-preview { color: #1e2937; background: #fff; }

.markdown-preview h1, .markdown-preview h2, .markdown-preview h3,
.markdown-preview h4, .markdown-preview h5, .markdown-preview h6 {
    font-weight: 700;
    letter-spacing: -0.015em;
}
.markdown-preview h1 { font-size: 2.05rem; margin: 1.35em 0 0.45em; border-bottom: 1px solid #27272a; padding-bottom: 0.25em; }
.markdown-preview h2 { font-size: 1.65rem; margin: 1.25em 0 0.35em; }
.markdown-preview h3 { font-size: 1.32rem; margin: 1.15em 0 0.3em; }
.markdown-preview h4 { font-size: 1.1rem; margin: 1.05em 0 0.25em; color: #d4d4d8; }
.light .markdown-preview h1, .light .markdown-preview h2, .light .markdown-preview h3 { color: #0f172a; }

.markdown-preview p { margin: 0.65em 0; }
.markdown-preview a { color: #f87171; text-decoration: none; border-bottom: 1px solid rgba(248, 113, 113, 0.3); }
.light .markdown-preview a { color: #b91c1c; border-bottom-color: rgba(185, 28, 28, 0.35); }
.markdown-preview strong { font-weight: 700; color: #f4f4f5; }
.light .markdown-preview strong { color: #111113; }

.markdown-preview blockquote {
    border-left: 3px solid #dc2626;
    background: #18181b;
    margin: 1.1em 0;
    padding: 0.85em 1.1em;
    color: #a1a1aa;
}
.light .markdown-preview blockquote { background: #f1f5f9; border-left-color: #dc2626; color: #475569; }

.markdown-preview pre {
    background-color: #0f0f11;
    border: 1px solid #27272a;
    padding: 15px 17px;
    margin: 1em 0;
    font-size: 13.2px;
    overflow-x: auto;
}
.light .markdown-preview pre { background: #f1f5f9; border-color: #e2e8f0; }

.markdown-preview code {
    font-family: ui-monospace, monospace;
    background: #27272a;
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 0.92em;
}
.light .markdown-preview code { background: #e2e8f0; color: #1e2937; }

.markdown-preview table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.1em 0;
    font-size: 14px;
}
.markdown-preview th, .markdown-preview td {
    border: 1px solid #3f3f46;
    padding: 8px 11px;
    text-align: left;
    vertical-align: top;
}
.light .markdown-preview th, .light .markdown-preview td { border-color: #e2e8f0; }
.markdown-preview th { background: #18181b; font-weight: 600; color: #f1f5f9; }
.light .markdown-preview th { background: #f1f5f9; color: #0f172a; }
.markdown-preview tr:nth-child(even) td { background: rgba(24,24,27,0.45); }
.light .markdown-preview tr:nth-child(even) td { background: #f8fafc; }

.markdown-preview hr { border: none; border-top: 1px solid #3f3f46; margin: 1.6em 0; }
.light .markdown-preview hr { border-top-color: #e2e8f0; }

.markdown-preview img {
    max-width: 100%;
    height: auto;
    margin: 1.15rem 0;
    border: 1px solid #27272a;
    display: block;
}

.markdown-preview .task-list-item { list-style: none; margin-left: -1.1em; }
.markdown-preview input[type="checkbox"] {
    accent-color: #dc2626;
    width: 15px;
    height: 15px;
    margin-right: 8px;
    vertical-align: middle;
    cursor: pointer;
}

.markdown-preview .callout {
    border-left: 3px solid #3f3f46;
    background: #18181b;
    padding: 0.75em 1em;
    margin: 1em 0;
}
.light .markdown-preview .callout { background: #f1f5f9; }
.markdown-preview .callout.note { border-color: #60a5fa; }
.markdown-preview .callout.tip { border-color: #4ade80; }
.markdown-preview .callout.warning { border-color: #fbbf24; }
.markdown-preview .callout.danger { border-color: #f87171; }

/* Tab Bar */
.tab-bar { background: #111113; border-bottom: 1px solid #27272a; display: flex; flex-direction: column; min-height: 34px; }
.tab-bar.light { background: #f8fafc; border-bottom-color: #e2e8f0; }

.pinned-tabs-row { display: flex; align-items: center; border-bottom: 1px solid #1f1f22; background: #0f0f11; min-height: 28px; }
.tab-bar.light .pinned-tabs-row { background: #f1f5f9; border-bottom-color: #e2e8f0; }

.pinned-collapse { font-size: 10px; padding: 0 8px; color: #71717a; cursor: pointer; user-select: none; display: flex; align-items: center; gap: 4px; border-right: 1px solid #27272a; }
.tab-bar.light .pinned-collapse { border-right-color: #e2e8f0; color: #475569; }

.pinned-tabs { display: flex; align-items: center; flex: 1; overflow-x: auto; scrollbar-width: none; }
.pinned-tabs::-webkit-scrollbar { display: none; }

.tabs-row { display: flex; align-items: center; height: 34px; overflow-x: auto; scrollbar-width: thin; background: #111113; }
.tab-bar.light .tabs-row { background: #f8fafc; }
.tabs-row::-webkit-scrollbar { height: 3px; }

.tab {
    display: flex; align-items: center; gap: 6px;
    padding: 0 10px 0 12px; height: 34px; font-size: 12px;
    border-right: 1px solid #27272a; background: #18181b; color: #a1a1aa;
    white-space: nowrap; min-width: 120px; max-width: 220px;
    cursor: pointer; user-select: none; position: relative;
}
.tab-bar.light .tab { background: #f1f5f9; color: #475569; border-right-color: #e2e8f0; }
.tab:hover { background: #202023; color: #e4e4e7; }
.tab-bar.light .tab:hover { background: #e2e8f0; color: #1e2937; }
.tab.active { background: #27251f; color: #f4f4f5; border-bottom: 2px solid #dc2626; height: 32px; margin-bottom: -1px; }
.tab-bar.light .tab.active { background: #fff; color: #111113; border-bottom-color: #dc2626; }
.tab.pinned { background: #1f1f22; font-weight: 500; }
.tab-bar.light .tab.pinned { background: #e0e7ff; }
.tab .tab-icon { width: 14px; text-align: center; color: #71717a; }
.tab.active .tab-icon { color: #f87171; }
.tab .tab-title { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.tab .tab-dirty { color: #f59e0b; font-size: 14px; line-height: 1; }
.tab .tab-close { width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; color: #52525b; font-size: 11px; }
.tab:hover .tab-close { color: #a1a1aa; }
.tab .tab-close:hover { background: #3f3f46; color: #fff; }
.tab-bar.light .tab .tab-close:hover { background: #cbd5e1; color: #111; }

.tab-add-btn { padding: 0 10px; height: 34px; display: flex; align-items: center; color: #71717a; border-right: 1px solid #27272a; cursor: pointer; }
.tab-add-btn:hover { color: #ef4444; background: #18181b; }
.tab-bar.light .tab-add-btn { border-right-color: #e2e8f0; }
.tab-add-btn:hover { background: #f1f5f9; }

/* File Tree */
.explorer { font-size: 12px; color: #a1a1aa; }
.explorer.light { color: #475569; }
.explorer-header { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: #52525b; border-bottom: 1px solid #27272a; }
.explorer.light .explorer-header { color: #64748b; border-bottom-color: #e2e8f0; }

.tree-item { display: flex; align-items: center; gap: 6px; padding: 3px 6px 3px 4px; cursor: pointer; user-select: none; }
.tree-item:hover { background: #18181b; }
.explorer.light .tree-item:hover { background: #f1f5f9; }
.tree-item.active { background: #27251f; color: #f4f4f5; }
.explorer.light .tree-item.active { background: #fee2e2; color: #111113; }
.tree-item .chev { width: 12px; text-align: center; color: #52525b; }
.tree-item .icon { width: 15px; color: #71717a; }
.tree-item.file .icon { color: #64748b; }
.tree-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-children { border-left: 1px solid #27272a; margin-left: 10px; }
.explorer.light .tree-children { border-left-color: #e2e8f0; }

.workspace-bar { display: flex; align-items: center; gap: 6px; padding: 3px 8px; background: #0f0f11; border-bottom: 1px solid #27272a; }
.explorer.light .workspace-bar { background: #f1f5f9; border-bottom-color: #e2e8f0; }
.workspace-name { flex: 1; font-size: 11px; font-family: ui-monospace, monospace; color: #ef4444; overflow: hidden; text-overflow: ellipsis; }

/* Slash menu, modals, forms, etc. (abbreviated for brevity - full styles from original) */
.slash-menu { position: absolute; z-index: 60; background: #18181b; border: 1px solid #3f3f46; min-width: 260px; max-height: 320px; overflow: auto; box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.4); }
.slash-item { padding: 8px 12px; display: flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; }
.slash-item:hover, .slash-item.selected { background: #27272a; }
.slash-item .icon { width: 18px; color: #dc2626; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.75); z-index: 70; display: flex; align-items: center; justify-content: center; }
.modal-panel { background: #18181b; border: 1px solid #3f3f46; width: 100%; max-width: 420px; box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.3); }
.modal-header { padding: 14px 18px; border-bottom: 1px solid #27272a; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 18px; }
.modal-footer { padding: 12px 18px; border-top: 1px solid #27272a; display: flex; gap: 8px; justify-content: flex-end; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #71717a; margin-bottom: 5px; }
.form-input { width: 100%; background: #111113; border: 1px solid #3f3f46; color: #e4e4e7; padding: 8px 10px; font-size: 14px; }
.form-input:focus { border-color: #dc2626; outline: none; }

.mini-btn { padding: 6px 12px; font-size: 12px; border: 1px solid #3f3f46; background: #27272a; transition: all .1s ease; }
.mini-btn:hover { background: #3f3f46; border-color: #52525b; }
.mini-btn.primary { background: #dc2626; color: white; border-color: #b91c1c; }
.mini-btn.primary:hover { background: #b91c1c; }

.outline-item { padding: 4px 8px; font-size: 12.5px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.outline-item:hover { background: #27272a; }
.outline-item .level { opacity: .5; font-family: ui-monospace, monospace; width: 14px; }

.seg { display: inline-flex; border: 1px solid #3f3f46; border-radius: 0; overflow: hidden; }
.seg button { padding: 4px 11px; font-size: 11px; border-right: 1px solid #3f3f46; background: transparent; color: #a1a1aa; transition: all 0.1s ease; display: inline-flex; align-items: center; gap: 4px; }
.seg button:last-child { border-right: none; }
.seg button:hover { background: #3f3f46; color: #fff; }
.seg button.active { background: #dc2626; color: #fff; border-color: #b91c1c; }
.seg button.active:hover { background: #b91c1c; }

.find-bar { background: #18181b; border-bottom: 1px solid #27272a; padding: 6px 12px; display: flex; align-items: center; gap: 8px; font-size: 12px; }
.find-bar input { background: #111113; border: 1px solid #3f3f46; padding: 4px 8px; font-size: 12px; width: 220px; }
.find-bar .stat { color: #52525b; font-family: ui-monospace, monospace; }

.status-bar { background: #111113; border-top: 1px solid #27272a; font-size: 11px; padding: 2px 12px; display: flex; align-items: center; gap: 14px; color: #52525b; }
.status-bar .dot { width: 3px; height: 3px; background: #22c55e; border-radius: 50%; display: inline-block; }

.focus-mode .sidebar { display: none !important; }
/* Note: we no longer hide #preview-pane in focus-mode. This way the rendered markdown in the
   preview stays visible when the user enters full screen / focus mode (sidebar is hidden for
   more space, but current Editor/Split/Preview choice is respected). The editor/preview border
   (if in split) is left as-is for visual separation. */

.red-accent { color: #ef4444; }

/* Save indicator states */
#save-indicator.unsaved { color: #ef4444 !important; border-color: #b91c1c !important; background: rgba(239,68,68,0.08); }
#save-indicator.autosaved { color: #22c55e !important; border-color: #166534 !important; background: rgba(34,197,94,0.06); }
.light #save-indicator.unsaved { background: #fee2e2; border-color: #f87171; color: #b91c1c !important; }
.light #save-indicator.autosaved { background: #dcfce7; border-color: #4ade80; color: #166534 !important; }

/* Light mode overrides (key surfaces) */
.light .bg-zinc-950 { background: #f8fafc !important; }
.light .bg-zinc-900 { background: #f1f5f9 !important; }
.light .bg-zinc-800 { background: #e2e8f0 !important; }
.light .text-zinc-200 { color: #1e2937 !important; }
.light .text-zinc-400 { color: #64748b !important; }
.light .text-zinc-500 { color: #475569 !important; }
.light .border-zinc-800 { border-color: #e2e8f0 !important; }
.light .border-zinc-700 { border-color: #cbd5e1 !important; }

.light #markdown-editor { color: #1e2937; }
.light .line-numbers { background: #f8fafc; color: #94a3b8; border-right-color: #e2e8f0; }
.light .markdown-preview pre { background: #f1f5f9; border-color: #e2e8f0; }
.light .markdown-preview code { background: #e2e8f0; color: #1e2937; }
.light .markdown-preview th { background: #f1f5f9; color: #0f172a; }
.light .tag-pill { background: #f1f5f9; border-color: #e2e8f0; color: #334155; }
.light .toolbar-btn:hover { background: #e2e8f0; color: #1e2937; }
.light .slash-menu { background: #fff; border-color: #e2e8f0; }
.light .modal-panel { background: #fff; border-color: #e2e8f0; }
.light .form-input { background: #f8fafc; border-color: #cbd5e1; color: #1e2937; }
.light .status-bar { background: #f1f5f9; border-top-color: #e2e8f0; color: #64748b; }

/* Toolbar */
.toolbar-btn { transition: all 0.1s ease; }
.toolbar-btn:hover { background-color: #27272a; color: #f3f4f6; }
.toolbar-btn.active { background-color: #3f3f46; color: #fff; }
.light .toolbar-btn:hover { background: #e2e8f0; color: #1e2937; }
.light .toolbar-btn.active { background: #e2e8f0; }

/* Additional strong light mode readability - high contrast */
.light body, .light .markdown-preview, .light .note-item, .light .tree-item, .light .tab, .light .section-header, .light .explorer, .light .status-bar, .light .pinned-collapse, .light .find-bar, .light .slash-menu, .light .modal-panel, .light .form-input, .light .workspace-name {
  color: #1f2937 !important;
}
.light .text-zinc-400 { color: #6b7280 !important; }
.light .text-zinc-500 { color: #9ca3af !important; }
.light .bg-zinc-950, .light .bg-zinc-900, .light .bg-zinc-800, .light .pinned-tabs-row, .light .tabs-row, .light .tab-bar, .light .find-bar, .light .slash-menu, .light .modal-panel, .light .form-input, .light .status-bar, .light .workspace-bar, .light #markdown-editor, .light .line-numbers {
  background-color: #f8fafc !important;
}
.light .bg-zinc-900 { background-color: #f1f5f9 !important; }
.light .bg-zinc-800 { background-color: #e2e8f0 !important; }
.light .border-zinc-800, .light .border-zinc-700, .light .tab, .light .pinned-tabs-row, .light .tab-bar, .light .find-bar, .light .slash-menu, .light .modal-panel, .light .form-input, .light .status-bar, .light .workspace-bar, .light .explorer-header, .light .line-numbers {
  border-color: #e2e8f0 !important;
}
.light .tab { background: #f1f5f9 !important; color: #374151 !important; }
.light .tab:hover { background: #e2e8f0 !important; }
.light .tab.active { background: #ffffff !important; color: #111827 !important; }
.light .tab.pinned { background: #e0e7ff !important; }
.light .note-item { color: #374151 !important; }
.light .note-item:hover { background: #f1f5f9 !important; }
.light .note-item.active { background: #ffffff !important; color: #111827 !important; }
.light .tree-item { color: #374151 !important; }
.light .tree-item:hover { background: #f1f5f9 !important; }
.light .tree-item.active { background: #fee2e2 !important; color: #111827 !important; }
.light .markdown-preview { color: #1f2937 !important; background: #ffffff !important; }
.light .markdown-preview h1, .light .markdown-preview h2, .light .markdown-preview h3, .light .markdown-preview h4 { color: #0f172a !important; }
.light .markdown-preview strong { color: #0f172a !important; }
.light .markdown-preview a { color: #b91c1c !important; }
.light .markdown-preview pre { background: #f1f5f9 !important; border-color: #e2e8f0 !important; }
.light .markdown-preview code { background: #e2e8f0 !important; color: #1f2937 !important; }
.light .markdown-preview blockquote { background: #f1f5f9 !important; color: #4b5563 !important; }
.light .markdown-preview th { background: #f1f5f9 !important; color: #0f172a !important; }
.light .markdown-preview tr:nth-child(even) td { background: #f8fafc !important; }
.light .section-header { color: #4b5563 !important; }
.light .explorer { color: #4b5563 !important; }
.light .explorer-header { color: #6b7280 !important; }
.light .workspace-name { color: #b91c1c !important; }
.light .status-bar { color: #6b7280 !important; }
.light .toolbar-btn { color: #374151 !important; }
.light .toolbar-btn:hover { background: #e2e8f0 !important; color: #1f2937 !important; }
.light .tag-pill { background: #f1f5f9 !important; border-color: #e2e8f0 !important; color: #374151 !important; }
.light .tag-pill:hover { background: #e2e8f0 !important; border-color: #dc2626 !important; }
.light .tag-pill.active { background: #dc2626 !important; color: #ffffff !important; }
.light #save-indicator { color: #166534 !important; }
.light #save-indicator.unsaved { color: #b91c1c !important; }
.light .line-numbers { background: #f8fafc !important; color: #9ca3af !important; }
.light .tab-add-btn { color: #6b7280 !important; }
.light .tab-add-btn:hover { background: #f1f5f9 !important; color: #b91c1c !important; }

/* Stronger light mode readability fixes - dark text, light backgrounds for all key elements */
.light,
.light body,
.light .text-zinc-200,
.light .text-zinc-400,
.light .text-zinc-500,
.light .markdown-preview,
.light .note-item,
.light .tree-item,
.light .tab,
.light .section-header,
.light .explorer,
.light .workspace-name,
.light .status-bar,
.light .pinned-collapse,
.light .find-bar {
  color: #1f2937 !important;
}
.light .text-zinc-400 { color: #6b7280 !important; }
.light .text-zinc-500 { color: #9ca3af !important; }

.light .bg-zinc-950,
.light .bg-zinc-900,
.light .bg-zinc-800,
.light .pinned-tabs-row,
.light .tabs-row,
.light .tab-bar,
.light .find-bar,
.light .slash-menu,
.light .modal-panel,
.light .form-input,
.light .status-bar,
.light .workspace-bar,
.light #markdown-editor,
.light .line-numbers {
  background-color: #f8fafc !important;
}
.light .bg-zinc-900 { background-color: #f1f5f9 !important; }
.light .bg-zinc-800 { background-color: #e2e8f0 !important; }

.light .border-zinc-800,
.light .border-zinc-700,
.light .tab,
.light .pinned-tabs-row,
.light .tab-bar,
.light .find-bar,
.light .slash-menu,
.light .modal-panel,
.light .form-input,
.light .status-bar,
.light .workspace-bar,
.light .explorer-header,
.light .line-numbers {
  border-color: #e2e8f0 !important;
}

.light .tab { background: #f1f5f9 !important; color: #374151 !important; border-right-color: #e2e8f0 !important; }
.light .tab:hover { background: #e2e8f0 !important; color: #1f2937 !important; }
.light .tab.active { background: #ffffff !important; color: #111827 !important; border-bottom-color: #dc2626 !important; }
.light .tab.pinned { background: #e0e7ff !important; }

.light .note-item { color: #374151 !important; }
.light .note-item:hover { background: #f1f5f9 !important; border-color: #e2e8f0 !important; }
.light .note-item.active { background: #ffffff !important; color: #111827 !important; border-color: #dc2626 !important; }

.light .tree-item { color: #374151 !important; }
.light .tree-item:hover { background: #f1f5f9 !important; }
.light .tree-item.active { background: #fee2e2 !important; color: #111827 !important; }

.light .markdown-preview { color: #1f2937 !important; background: #ffffff !important; }
.light .markdown-preview h1, .light .markdown-preview h2, .light .markdown-preview h3, .light .markdown-preview h4 { color: #0f172a !important; }
.light .markdown-preview strong { color: #0f172a !important; }
.light .markdown-preview a { color: #b91c1c !important; border-bottom-color: rgba(185,28,28,.35) !important; }
.light .markdown-preview pre { background: #f1f5f9 !important; border-color: #e2e8f0 !important; }
.light .markdown-preview code { background: #e2e8f0 !important; color: #1f2937 !important; }
.light .markdown-preview blockquote { background: #f1f5f9 !important; color: #4b5563 !important; }
.light .markdown-preview th { background: #f1f5f9 !important; color: #0f172a !important; }
.light .markdown-preview tr:nth-child(even) td { background: #f8fafc !important; }
.light .markdown-preview hr { border-top-color: #e2e8f0 !important; }
.light .markdown-preview .callout { background: #f1f5f9 !important; }

.light .section-header { color: #4b5563 !important; border-bottom-color: #dc2626 !important; }

.light .explorer { color: #4b5563 !important; }
.light .explorer-header { color: #6b7280 !important; border-bottom-color: #e2e8f0 !important; }
.light .workspace-name { color: #b91c1c !important; }
.light .status-bar { color: #6b7280 !important; background: #f1f5f9 !important; border-top-color: #e2e8f0 !important; }

.light .toolbar-btn { color: #374151 !important; }
.light .toolbar-btn:hover { background: #e2e8f0 !important; color: #1f2937 !important; }
.light .toolbar-btn.active { background: #e2e8f0 !important; }

.light .tag-pill { background: #f1f5f9 !important; border-color: #e2e8f0 !important; color: #374151 !important; }
.light .tag-pill:hover { background: #e2e8f0 !important; border-color: #dc2626 !important; }
.light .tag-pill.active { background: #dc2626 !important; color: #ffffff !important; border-color: #b91c1c !important; }

.light .pinned-collapse { color: #6b7280 !important; }

.light .find-bar { background: #f1f5f9 !important; border-bottom-color: #e2e8f0 !important; color: #374151 !important; }
.light .find-bar input { background: #ffffff !important; border-color: #cbd5e1 !important; color: #1f2937 !important; }

.light .slash-menu { background: #ffffff !important; border-color: #e2e8f0 !important; color: #1f2937 !important; }
.light .slash-item:hover, .light .slash-item.selected { background: #f1f5f9 !important; }

.light .modal-panel { background: #ffffff !important; border-color: #e2e8f0 !important; color: #1f2937 !important; }
.light .modal-header { border-bottom-color: #e2e8f0 !important; }
.light .modal-footer { border-top-color: #e2e8f0 !important; }
.light .form-input { background: #ffffff !important; border-color: #cbd5e1 !important; color: #1f2937 !important; }

.light #save-indicator { color: #166534 !important; border-color: #4ade80 !important; background: #dcfce7 !important; }
.light #save-indicator.unsaved { color: #b91c1c !important; border-color: #f87171 !important; background: #fee2e2 !important; }

/* Extra light theme coverage for sticky/pin/export/highlight as requested */
.light .sticky,
.light [class*="sticky"] { background: #f8fafc !important; }
.light .pinned-tabs-row { background: #f1f5f9 !important; border-bottom-color: #e2e8f0 !important; }
.light .tab.pinned { background: #e0e7ff !important; }
.light .pinned-collapse { color: #6b7280 !important; border-right-color: #e2e8f0 !important; }
.light [class*="export"],
.light .toolbar-btn[title*="Export"],
.light [title*="export"] { color: #374151 !important; }
.light [class*="export"]:hover,
.light .toolbar-btn[title*="Export"]:hover { background: #e2e8f0 !important; }
.light ::selection { background: #bae6fd !important; color: #0f172a !important; }
.light .stat,
.light #find-stat,
.light .highlight { color: #1e2937 !important; }
.light #editor-preview-resizer { background: #e2e8f0 !important; }
.light #editor-preview-resizer:hover { background: #dc2626 !important; }

.light .line-numbers { background: #f8fafc !important; color: #9ca3af !important; border-right-color: #e2e8f0 !important; }

.light .tab-add-btn { color: #6b7280 !important; border-right-color: #e2e8f0 !important; }
.light .tab-add-btn:hover { background: #f1f5f9 !important; color: #b91c1c !important; }

/* Sidebar top views bar (data-view-action buttons under logo): override dark Tailwind hover:bg-zinc-800 etc. in light */
.light #sidebar-views-bar {
  background-color: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
}
.light #sidebar-views-bar button {
  border-color: #cbd5e1 !important;
  color: #475569 !important;
}
.light #sidebar-views-bar button:hover {
  background-color: #e2e8f0 !important;
  color: #1e2937 !important;
  border-color: #94a3b8 !important;
}

/* Find bar mini buttons (Next/Prev/Replace/All/✕) were missing light styles — they stayed dark */
.light .mini-btn {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #374151 !important;
}
.light .mini-btn:hover {
  background: #e2e8f0 !important;
  border-color: #94a3b8 !important;
  color: #1e2937 !important;
}
.light .mini-btn.primary {
  background: #dc2626 !important;
  color: #fff !important;
  border-color: #b91c1c !important;
}
.light .mini-btn.primary:hover {
  background: #b91c1c !important;
}

/* Segmented Editor/Split/Preview control (also had dark hovers) */
.light .seg {
  border-color: #cbd5e1 !important;
}
.light .seg button {
  border-right-color: #cbd5e1 !important;
  color: #475569 !important;
}
.light .seg button:hover {
  background: #e2e8f0 !important;
  color: #1e2937 !important;
}
/* Active state must force white text because active bg is the red accent (#dc2626) */
.light .seg button.active {
  color: #fff !important;
}
.light .seg button.active:hover {
  background: #b91c1c !important;
}

/* Meta bar action icon buttons (find, outline, pin, star, export, close) — now receive hover:bg-zinc-800 in dark via HTML.
   Ensure light theme also gives them a visible hover background, and fix hover:text-white for find/outline. */
.light .h-12 button:hover {
  background-color: #e2e8f0 !important;
}
.light .h-12 button[title*="Find & Replace"]:hover,
.light .h-12 button[title*="Toggle Outline"]:hover {
  color: #1e2937 !important;
}

/* Outline pane + list items — dark hover and container styles were leaking in light theme */
.light #outline-pane {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}
.light #outline-pane > div:first-child {
  border-bottom-color: #e2e8f0 !important;
  color: #475569 !important;
}
.light #outline-pane .text-zinc-400,
.light #outline-pane .text-zinc-500 {
  color: #64748b !important;
}
.light #outline-pane button {
  color: #64748b !important;
}
.light #outline-pane button:hover {
  color: #1e2937 !important;
}

.light .outline-item {
  color: #374151 !important;
}
.light .outline-item:hover {
  background: #f1f5f9 !important;
}
.light .outline-item .level {
  color: #64748b !important;
}