.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(15, 23, 42, 0.75); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background-color: white; padding: 2.5rem; border-radius: 1rem; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); max-width: 90%; max-height: 90%; overflow-y: auto; position: relative; }
.modal-close { position: absolute; top: 1.25rem; right: 1.25rem; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #64748b; transition: color 0.2s; }
.modal-close:hover { color: #0f172a; }
summary::-webkit-details-marker { display: none; }
.scrollbar-hide::-webkit-scrollbar { display: none; }

/* Custom Scrollbar for Workspaces */
.custom-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.custom-scroll::-webkit-scrollbar-track { background: transparent; }
.custom-scroll::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 20px; }
.custom-scroll-dark::-webkit-scrollbar { width: 6px; }
.custom-scroll-dark::-webkit-scrollbar-track { background: transparent; }
.custom-scroll-dark::-webkit-scrollbar-thumb { background-color: #475569; border-radius: 20px; }

html { scroll-behavior: smooth; }

/* Drag and Drop Styling */
.border-dashed-hover { border-color: #059669 !important; background-color: #ecfdf5 !important; }

/* Index Letter Grid styling */
.az-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.25rem; }

/* CaseLines Highlight */
.caselines-badge { background-color: #fef3c7; color: #9f1239; border: 1px solid #fda4af; padding: 0.1rem 0.4rem; border-radius: 0.25rem; font-family: monospace; font-weight: bold; font-size: 0.85rem; }
.caselines-inline-badge { background-color: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; padding: 0.1rem 0.4rem; border-radius: 0.25rem; font-family: monospace; font-weight: bold; font-size: 0.75rem; }

/* Collapsible Panel Styles */
.panel-collapsed { width: 3rem !important; min-width: 3rem !important; cursor: pointer; }
.panel-collapsed > div:not(.toggle-btn-container) { display: none !important; }
.panel-collapsed:hover { background-color: #f1f5f9; }
.toggle-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 1.5rem; height: 3rem; background-color: white; border: 1px solid #e2e8f0; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 50; color: #64748b; transition: all 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.toggle-btn:hover { background-color: #f8fafc; color: #0f172a; }
.toggle-left { right: -0.75rem; border-radius: 0 0.5rem 0.5rem 0; border-left: none; }
.toggle-right { left: -0.75rem; border-radius: 0.5rem 0 0 0.5rem; border-right: none; }

/* Fullscreen Workspace Styles */
.workspace-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    margin: 0 !important;
    z-index: 50 !important; /* Above header */
    background-color: #f8fafc;
    padding: 1rem !important;
    border-radius: 0 !important;
}

/* PDF.js Custom Viewer Styles - Multi-page Continuous Scroll */
.pdf-viewer-container {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    background-color: #64748b; /* Darkened from #cbd5e1 so the scrollbar is visible! */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 0;
    overflow-y: auto !important; 
    overflow-x: auto !important; 
    gap: 20px; 
}

.pdf-page-wrapper {
    position: relative;
    background-color: white;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

/* The text layer must sit exactly on top of its specific canvas */
.textLayer {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    opacity: 0.2; /* Set to 0 in prod, slightly visible for debugging */
    line-height: 1.0;
}
.textLayer > span {
    color: transparent;
    position: absolute;
    white-space: pre;
    cursor: text;
    transform-origin: 0% 0%;
}
::selection { background: rgba(190, 18, 58, 0.3); } /* Rose color selection */

/* Loading overlay for PDF */
.pdf-loading-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}/* Premium Legal Tech Styles */

:root {
    --legal-primary: #0f172a;
    --legal-secondary: #1e293b;
    --legal-accent: #6366f1;
    --legal-text: #f1f5f9;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbar */
.custom-scroll::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 10px;
}
.custom-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.layout-full-notes #pdf-pane {
    width: 0% !important;
    display: none !important;
}
.layout-full-notes #notes-pane {
    width: 100% !important;
}

/* Quick Links Bar Styling & Scrollbar */
#quick-links-bar {
    scrollbar-width: thin;
    scrollbar-color: #4f46e5 #1e293b;
}

#quick-links-bar::-webkit-scrollbar {
    height: 4px;
}

#quick-links-bar::-webkit-scrollbar-track {
    background: #1e293b;
}

#quick-links-bar::-webkit-scrollbar-thumb {
    background-color: #4f46e5;
    border-radius: 20px;
}

header {
    backdrop-filter: blur(12px);
    background-color: rgba(15, 23, 42, 0.9) !important;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(15, 23, 42, 0.75); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background-color: white; padding: 2.5rem; border-radius: 1rem; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); max-width: 90%; max-height: 90%; overflow-y: auto; position: relative; }
.modal-close { position: absolute; top: 1.25rem; right: 1.25rem; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #64748b; transition: color 0.2s; }
.modal-close:hover { color: #0f172a; }
summary::-webkit-details-marker { display: none; }
.scrollbar-hide::-webkit-scrollbar { display: none; }

/* Custom Scrollbar for Workspaces */
.custom-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.custom-scroll::-webkit-scrollbar-track { background: transparent; }
.custom-scroll::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 20px; }
.custom-scroll-dark::-webkit-scrollbar { width: 6px; }
.custom-scroll-dark::-webkit-scrollbar-track { background: transparent; }
.custom-scroll-dark::-webkit-scrollbar-thumb { background-color: #475569; border-radius: 20px; }

html { scroll-behavior: smooth; }

/* Drag and Drop Styling */
.border-dashed-hover { border-color: #059669 !important; background-color: #ecfdf5 !important; }

/* Index Letter Grid styling */
.az-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.25rem; }

/* CaseLines Highlight */
.caselines-badge { background-color: #fef3c7; color: #9f1239; border: 1px solid #fda4af; padding: 0.1rem 0.4rem; border-radius: 0.25rem; font-family: monospace; font-weight: bold; font-size: 0.85rem; }
.caselines-inline-badge { background-color: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; padding: 0.1rem 0.4rem; border-radius: 0.25rem; font-family: monospace; font-weight: bold; font-size: 0.75rem; }

/* Collapsible Panel Styles */
.panel-collapsed { width: 3rem !important; min-width: 3rem !important; cursor: pointer; }
.panel-collapsed > div:not(.toggle-btn-container) { display: none !important; }
.panel-collapsed:hover { background-color: #f1f5f9; }
.toggle-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 1.5rem; height: 3rem; background-color: white; border: 1px solid #e2e8f0; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 50; color: #64748b; transition: all 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.toggle-btn:hover { background-color: #f8fafc; color: #0f172a; }
.toggle-left { right: -0.75rem; border-radius: 0 0.5rem 0.5rem 0; border-left: none; }
.toggle-right { left: -0.75rem; border-radius: 0.5rem 0 0 0.5rem; border-right: none; }

/* Fullscreen Workspace Styles */
.workspace-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    margin: 0 !important;
    z-index: 50 !important; /* Above header */
    background-color: #f8fafc;
    padding: 1rem !important;
    border-radius: 0 !important;
}

/* PDF.js Custom Viewer Styles - Multi-page Continuous Scroll */
.pdf-viewer-container {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    height: 100%;
    background-color: #64748b; /* Darkened from #cbd5e1 so the scrollbar is visible! */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 0;
    overflow-y: auto !important; 
    overflow-x: auto !important; 
    gap: 20px; 
}

.pdf-page-wrapper {
    position: relative;
    background-color: white;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

::selection { background: rgba(190, 18, 58, 0.3); } /* Rose color selection */

/* Loading overlay for PDF */
.pdf-loading-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}/* Premium Legal Tech Styles */

:root {
    --legal-primary: #0f172a;
    --legal-secondary: #1e293b;
    --legal-accent: #6366f1;
    --legal-text: #f1f5f9;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbar */
.custom-scroll::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scroll::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 10px;
}
.custom-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.layout-full-notes #pdf-pane {
    width: 0% !important;
    display: none !important;
}
.layout-full-notes #notes-pane {
    width: 100% !important;
}

/* Quick Links Bar Styling & Scrollbar */
#quick-links-bar {
    scrollbar-width: thin;
    scrollbar-color: #4f46e5 #1e293b;
}

#quick-links-bar::-webkit-scrollbar {
    height: 4px;
}

#quick-links-bar::-webkit-scrollbar-track {
    background: #1e293b;
}

#quick-links-bar::-webkit-scrollbar-thumb {
    background-color: #4f46e5;
    border-radius: 20px;
}

header {
    backdrop-filter: blur(12px);
    background-color: rgba(15, 23, 42, 0.9) !important;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

#quick-links-bar button {
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(4px);
}

#quick-links-bar button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -4px rgba(79, 70, 229, 0.4);
    background-color: #6366f1 !important;
}

/* PDF Viewer Specifics */

.pdf-page-container {
    margin-bottom: 3rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: white;
    border-radius: 4px;
}

.textLayer {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    opacity: 1;
    line-height: 1.0;
    pointer-events: auto;
}

.textLayer > span {
    color: transparent;
    position: absolute;
    white-space: pre;
    cursor: text;
    transform-origin: 0% 0%;
    z-index: 2;
}

.pdf-highlight-item {
    background-color: #fef08a;
    border-radius: 2px;
    z-index: 10;
    mix-blend-mode: multiply;
    display: inline;
}

#flag-sidebar {
    width: 42px;
    flex-shrink: 0;
    background: rgba(15, 23, 42, 0.03);
    border-right: 1px solid rgba(0,0,0,0.05);
    scrollbar-width: thin;
    scrollbar-gutter: stable;
}

.pdf-page-container:hover {
    transform: translateY(-4px);
}

/* Notes Editor Styles */
#global-notepad-input-center {
    min-height: 100%;
    outline: none;
    font-size: 14px;
    line-height: 1.6;
}

#global-notepad-input-center:empty:before {
    content: attr(placeholder);
    color: #94a3b8;
    font-style: italic;
}

/* Ruled Paper Effect */
.ruled-paper #global-notepad-input-center {
    background-color: #fff;
    background-image: linear-gradient(#e2e8f0 1.1px, transparent 1.1px);
    background-size: 100% 32px;
    line-height: 32px;
    padding-top: 0;
}

/* Note Ribbons */
.note-ribbon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none; /* Hide scrollbar Firefox */
}
.note-ribbon::-webkit-scrollbar {
    display: none; /* Hide scrollbar Chrome/Safari */
}
.note-ribbon > div {
    flex-shrink: 0;
}

/* Side-by-Side scrolling for Index */
.index-open-shift {
    padding-right: 320px !important; /* Matches sidebar width */
    transition: padding-right 0.3s ease;
}

/* Flag & Link Styles */
.flag-item {
    min-width: 26px;
    width: auto;
    padding-left: 5px;
    padding-right: 5px;
    height: 32px;
    clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 50% 85%, 0% 100%);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 4px;
    color: #000;
    font-size: 8px;
    font-weight: bold;
    white-space: nowrap;
}
.flag-item:hover {
    transform: translateX(2px) scale(1.1);
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
}
.linked-text {
    background-color: rgba(99, 102, 241, 0.08);
    border-bottom: 1px dashed #6366f1;
    cursor: pointer;
    transition: all 0.2s;
}
.note-link-sup {
    font-size: 10px;
    color: #4f46e5;
    font-weight: bold;
    vertical-align: super;
    margin-left: 2px;
}

.note-link {
    color: #4f46e5;
    text-decoration: underline;
    text-decoration-style: solid;
    text-underline-offset: 2px;
    cursor: pointer;
    font-weight: 500;
    transition: color 0.15s ease-in-out;
}
.note-link:hover {
    color: #3730a3;
    text-decoration-color: #3730a3;
}
.notes-dark-mode .note-link {
    color: #818cf8 !important;
}
.notes-dark-mode .note-link:hover {
    color: #a5b4fc !important;
}

.note-anchor {
    border-bottom: 2px dotted #10b981;
    background-color: rgba(16, 185, 129, 0.08);
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 500;
}
.notes-dark-mode .note-anchor {
    border-color: #34d399 !important;
    background-color: rgba(52, 211, 153, 0.15) !important;
    color: #e2e8f0 !important;
}


/* Notes Dark Mode */
.notes-dark-mode {
    background-color: #0f172a !important;
    color: #cbd5e1 !important;
}
.notes-dark-mode .bg-white, .notes-dark-mode .bg-amber-50, .notes-dark-mode .bg-indigo-50 {
    background-color: #1e293b !important;
}
.notes-dark-mode .bg-slate-50, .notes-dark-mode .bg-slate-50\/50, .notes-dark-mode .bg-slate-50\/30, .notes-dark-mode .bg-slate-50\/10 {
    background-color: #0f172a !important;
}
.notes-dark-mode .border-slate-200, .notes-dark-mode .border-slate-100, .notes-dark-mode .border-b, .notes-dark-mode .border-r, .notes-dark-mode .border-indigo-200 {
    border-color: #334155 !important;
}
.notes-dark-mode select, .notes-dark-mode .text-slate-600, .notes-dark-mode .text-slate-700, .notes-dark-mode .text-slate-800, .notes-dark-mode .text-slate-500, .notes-dark-mode span#nt-mode-text, .notes-dark-mode .text-indigo-700 {
    color: #cbd5e1 !important;
}
.notes-dark-mode .hover\:bg-slate-100:hover {
    background-color: #334155 !important;
}
.notes-dark-mode #notes-editor-container {
    background-color: #0f172a !important;
}
.notes-dark-mode #flag-sidebar {
    background-color: #1e293b !important;
}
.notes-dark-mode .flag-item {
    color: #000 !important; /* Keep flags readable if they are bright colors */
}
.notes-dark-mode #right-note-text {
    background-color: #334155 !important;
    color: #fff !important;
}
.notes-dark-mode .note-ribbon button.bg-white {
    background-color: #334155 !important;
}
.notes-dark-mode .bg-emerald-50 {
    background-color: #064e3b !important;
}
.notes-dark-mode .text-emerald-800 {
    color: #a7f3d0 !important;
}


/* ==============================================================
   SCROLL ARROWS, NOTE TABS & STICKY NOTES STYLING
   ============================================================== */

/* Scroll Container & Arrows System */
.ribbon-scroll-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    overflow: hidden;
}

/* Ensure ribbons stay compact */
.note-ribbon {
    min-height: 42px;
    max-height: 48px;
}

.note-ribbon, #note-tab-bar, .scrollable-tabs, #quick-links-bar {
    overflow-x: auto;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
    display: flex;
    align-items: center;
}

.note-ribbon::-webkit-scrollbar, 
#note-tab-bar::-webkit-scrollbar, 
.scrollable-tabs::-webkit-scrollbar, 
#quick-links-bar::-webkit-scrollbar {
    display: none;
}

.scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 50;
    transition: all 0.2s ease;
    opacity: 0;
    pointer-events: none;
    border: none;
    outline: none;
}

.scroll-arrow.visible {
    opacity: 1;
    pointer-events: auto;
}

.scroll-arrow:hover {
    background: rgba(0,0,0,0.08);
}

.scroll-arrow-left { left: 0; }
.scroll-arrow-right { right: 0; }

.scroll-arrow { background: #f8fafc; color: #64748b; }
.scroll-arrow-left::after {
    content: ""; position: absolute; top: 0; left: 100%; width: 12px; height: 100%;
    background: linear-gradient(to right, #f8fafc, transparent); pointer-events: none;
}
.scroll-arrow-right::after {
    content: ""; position: absolute; top: 0; right: 100%; width: 12px; height: 100%;
    background: linear-gradient(to left, #f8fafc, transparent); pointer-events: none;
}

/* Dark Mode scroll arrows */
.notes-dark-mode .scroll-arrow { background: #0f172a; color: #94a3b8; }
.notes-dark-mode .scroll-arrow-left::after {
    background: linear-gradient(to right, #0f172a, transparent);
}
.notes-dark-mode .scroll-arrow-right::after {
    background: linear-gradient(to left, #0f172a, transparent);
}

.scroll-arrow svg {
    width: 12px;
    height: 12px;
    stroke-width: 3;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Tab Bar Scrolling & Stable Baseline Alignment */
#note-tab-bar {
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-top: 4px;
    padding-bottom: 4px;
    margin-top: 0;
    margin-bottom: 0;
    border-bottom: none !important;
    display: flex;
    align-items: center;
}
#note-tab-bar::-webkit-scrollbar {
    display: none;
}

.custom-scroll-sm::-webkit-scrollbar {
    height: 4px;
}
.custom-scroll-sm::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
}

/* Tabbed Notes Styling */
.note-tab {
    height: 28px;
    box-sizing: border-box;
    transition: all 0.15s ease;
}

.note-tab:hover {
    filter: brightness(0.97);
}

.note-tab button {
    transition: all 0.2s ease;
}

/* Dark mode note tabs overrides */
.notes-dark-mode .note-tab.bg-slate-50 { background-color: #1e293b !important; border-color: #334155 !important; color: #f1f5f9 !important; font-weight: 800; }
.notes-dark-mode .note-tab.bg-indigo-50 { background-color: #1e1b4b !important; border-color: #312e81 !important; color: #e0e7ff !important; font-weight: 800; }
.notes-dark-mode .note-tab.bg-emerald-50 { background-color: #022c22 !important; border-color: #064e3b !important; color: #d1fae5 !important; font-weight: 800; }
.notes-dark-mode .note-tab.bg-amber-50 { background-color: #451a03 !important; border-color: #78350f !important; color: #fef08a !important; font-weight: 800; }
.notes-dark-mode .note-tab.bg-rose-50 { background-color: #4c0519 !important; border-color: #881337 !important; color: #ffe4e6 !important; font-weight: 800; }
.notes-dark-mode .note-tab.bg-sky-50 { background-color: #082f49 !important; border-color: #0c4a6e !important; color: #e0f2fe !important; font-weight: 800; }
.notes-dark-mode .note-tab.bg-violet-50 { background-color: #2e1065 !important; border-color: #4c1d95 !important; color: #f3e8ff !important; font-weight: 800; }

.notes-dark-mode .note-tab.bg-slate-200 { background-color: #0f172a !important; border-color: #1e293b !important; color: #94a3b8 !important; opacity: 1 !important; }
.notes-dark-mode .note-tab.bg-indigo-200 { background-color: #0c0a2e !important; border-color: #1e1b4b !important; color: #a5b4fc !important; opacity: 1 !important; }
.notes-dark-mode .note-tab.bg-emerald-200 { background-color: #011c16 !important; border-color: #022c22 !important; color: #6ee7b7 !important; opacity: 1 !important; }
.notes-dark-mode .note-tab.bg-amber-200 { background-color: #2b1102 !important; border-color: #451a03 !important; color: #fde047 !important; opacity: 1 !important; }
.notes-dark-mode .note-tab.bg-rose-200 { background-color: #2e0310 !important; border-color: #4c0519 !important; color: #fca5a5 !important; opacity: 1 !important; }
.notes-dark-mode .note-tab.bg-sky-200 { background-color: #031c2c !important; border-color: #082f49 !important; color: #7dd3fc !important; opacity: 1 !important; }
.notes-dark-mode .note-tab.bg-violet-200 { background-color: #1c0a3f !important; border-color: #2e1065 !important; color: #c084fc !important; opacity: 1 !important; }

/* Notes Tab Manager & Tree Styles */
.notes-dark-mode #notes-tab-manager-btn {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}
.notes-dark-mode #notes-tab-manager-btn:hover {
    background-color: #334155 !important;
    color: #818cf8 !important;
}
.notes-dark-mode #notes-tab-manager-menu {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}
.notes-dark-mode #notes-tab-manager-menu .bg-slate-50 {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}
.notes-dark-mode #notes-tab-manager-menu .bg-white {
    background-color: #0f172a !important;
    border-color: #1e293b !important;
}
.notes-dark-mode #notes-tab-manager-menu input {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}
.notes-dark-mode #notes-tab-manager-menu .border-slate-100,
.notes-dark-mode #notes-tab-manager-menu .border-slate-200 {
    border-color: #334155 !important;
}

/* Drag and Drop Tab states */
.note-tab.tab-dragging,
.tab-tree-item.tab-dragging {
    opacity: 0.4 !important;
    transform: scale(0.96);
}
.note-tab.tab-drag-over,
.tab-tree-item.tab-drag-over {
    border-color: #6366f1 !important;
    outline: 2px dashed #6366f1 !important;
    outline-offset: 1px;
}
.tab-tree-item {
    cursor: pointer;
    transition: all 0.15s ease;
}
.tab-tree-item:hover {
    background-color: rgba(99, 102, 241, 0.08);
}
.notes-dark-mode .tab-tree-item:hover {
    background-color: rgba(99, 102, 241, 0.2);
}

/* Flag Customization Modal Dark Mode */
.notes-dark-mode #flag-customization-modal .bg-white {
    background-color: #0f172a !important;
    border-color: #1e293b !important;
    color: #f1f5f9 !important;
}
.notes-dark-mode #flag-customization-modal .bg-slate-50 {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}
.notes-dark-mode #flag-customization-modal input,
.notes-dark-mode #flag-customization-modal textarea {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}
.notes-dark-mode #flag-customization-modal .text-slate-800 {
    color: #f8fafc !important;
}
.notes-dark-mode #flag-customization-modal .border-slate-100 {
    border-color: #334155 !important;
}

/* Sticky notes styles inside PDF Viewer */
.sticky-note-minimized {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.sticky-note-minimized:hover {
    transform: scale(1.1);
}
.sticky-note-header {
    user-select: none;
}
.sticky-note-textarea {
    font-family: 'Inter', sans-serif;
}

/* ==============================================================
   LIGHT MODE OVERRIDES (Applies to main layout components)
   ============================================================== */
body:not(.notes-dark-mode) header,
body:not(.notes-dark-mode) .bg-legal-900,
body:not(.notes-dark-mode) .w-16.bg-legal-900,
body:not(.notes-dark-mode) #app-tabs-container {
    background: #ffffff !important;
    background-color: #ffffff !important;
}

body:not(.notes-dark-mode) header {
    border-bottom: 1px solid #cbd5e1 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03) !important;
}

body:not(.notes-dark-mode) .w-16.bg-legal-900 {
    border-right: 1px solid #cbd5e1 !important;
}

body:not(.notes-dark-mode) header h1 {
    color: #0f172a !important;
}

body:not(.notes-dark-mode) header h1 span.text-indigo-400 {
    color: #4f46e5 !important;
}

body:not(.notes-dark-mode) header a.text-legal-400 {
    color: #64748b !important;
}

body:not(.notes-dark-mode) header a.text-legal-400:hover {
    color: #4f46e5 !important;
}

body:not(.notes-dark-mode) .bg-legal-800 {
    background-color: #f8fafc !important;
    border-color: #cbd5e1 !important;
}

body:not(.notes-dark-mode) .w-16.bg-legal-900 button {
    color: #64748b !important;
}
body:not(.notes-dark-mode) .w-16.bg-legal-900 button:hover,
body:not(.notes-dark-mode) .w-16.bg-legal-900 button.active-nav-btn {
    color: #4f46e5 !important;
    background-color: #f1f5f9 !important;
}

/* Custom workspace tabs layout */
#master-tab-bar {
    align-items: center !important;
    min-height: 40px !important;
    padding-top: 4px !important;
    padding-bottom: 4px !important;
    display: flex !important;
}

/* Master tabs light mode */
body:not(.notes-dark-mode) #master-tab-bar > div.bg-indigo-600 {
    background-color: #4f46e5 !important;
    color: #ffffff !important;
    border-right-color: #cbd5e1 !important;
}

body:not(.notes-dark-mode) #master-tab-bar > div:not(.bg-indigo-600) {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
    border-right-color: #cbd5e1 !important;
}
body:not(.notes-dark-mode) #master-tab-bar > div:not(.bg-indigo-600):hover {
    background-color: #e2e8f0 !important;
    color: #1e293b !important;
}

body:not(.notes-dark-mode) #master-tab-bar button {
    color: currentColor !important;
    opacity: 0.6;
}
body:not(.notes-dark-mode) #master-tab-bar button:hover {
    opacity: 1;
}

/* Master tabs dark mode */
body.notes-dark-mode #master-tab-bar > div.bg-indigo-600 {
    background-color: #6366f1 !important;
    color: #ffffff !important;
}
body.notes-dark-mode #master-tab-bar > div:not(.bg-indigo-600) {
    background-color: #1e293b !important;
    color: #94a3b8 !important;
}
body.notes-dark-mode #master-tab-bar > div:not(.bg-indigo-600):hover {
    background-color: #334155 !important;
    color: #ffffff !important;
}

body.notes-dark-mode #master-tab-bar button {
    color: currentColor !important;
    opacity: 0.6;
}
body.notes-dark-mode #master-tab-bar button:hover {
    opacity: 1;
}

body:not(.notes-dark-mode) .scroll-arrow {
    background: #ffffff !important;
    color: #475569 !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
}
body:not(.notes-dark-mode) .scroll-arrow:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}

body:not(.notes-dark-mode) .scroll-arrow-left::after {
    background: linear-gradient(to right, #ffffff, transparent) !important;
}
body:not(.notes-dark-mode) .scroll-arrow-right::after {
    background: linear-gradient(to left, #ffffff, transparent) !important;
}

/* PDF viewer tools light mode */
body:not(.notes-dark-mode) .bg-legal-800 {
    background-color: #f8fafc !important;
    border-bottom: 1px solid #cbd5e1 !important;
}

body:not(.notes-dark-mode) .border-legal-700,
body:not(.notes-dark-mode) .border-legal-800 {
    border-color: #cbd5e1 !important;
}

body:not(.notes-dark-mode) #app-center-panel select {
    background-color: #ffffff !important;
    color: #334155 !important;
    border: 1px solid #cbd5e1 !important;
}

body:not(.notes-dark-mode) #app-center-panel button,
body:not(.notes-dark-mode) .pdf-tool {
    color: #64748b !important;
}

body:not(.notes-dark-mode) #app-center-panel button:hover,
body:not(.notes-dark-mode) .pdf-tool:hover {
    color: #1e293b !important;
    background-color: #f1f5f9 !important;
}

/* PDF Pages and Canvas background */
body:not(.notes-dark-mode) #pdf-split-layout,
body:not(.notes-dark-mode) #main-split-area {
    background-color: #f1f5f9 !important;
}

body:not(.notes-dark-mode) #pdf-container-main,
body:not(.notes-dark-mode) #pdf-container-split {
    background-color: #f1f5f9 !important;
}

/* Base Body and Text */
body:not(.notes-dark-mode) {
    background-color: #f1f5f9 !important;
    color: #334155 !important;
}

/* Slide Out Menu */
body:not(.notes-dark-mode) #slide-menu {
    background-color: #ffffff !important;
    border-right: 1px solid #cbd5e1 !important;
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.04) !important;
}
body:not(.notes-dark-mode) #slide-menu .bg-legal-800 {
    background-color: #ffffff !important;
}
body:not(.notes-dark-mode) #slide-menu .bg-legal-900 {
    background-color: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
}
body:not(.notes-dark-mode) #slide-menu h3 {
    color: #0f172a !important;
}
body:not(.notes-dark-mode) #slide-menu button,
body:not(.notes-dark-mode) #slide-menu a {
    color: #64748b !important;
}
body:not(.notes-dark-mode) #slide-menu button:hover,
body:not(.notes-dark-mode) #slide-menu a:hover {
    color: #4f46e5 !important;
    background-color: #f1f5f9 !important;
}
body:not(.notes-dark-mode) #slide-menu .border-legal-700 {
    border-color: #cbd5e1 !important;
}
body:not(.notes-dark-mode) #slide-menu .text-legal-400 {
    color: #64748b !important;
}
body:not(.notes-dark-mode) #slide-menu .text-legal-300 {
    color: #475569 !important;
}
body:not(.notes-dark-mode) #slide-menu .hover\:text-white:hover {
    color: #0f172a !important;
}

/* Light mode overrides for Personal Library Slide View */
body:not(.notes-dark-mode) #lib-tab-btn-court:not(.bg-indigo-600) {
    color: #64748b !important;
}
body:not(.notes-dark-mode) #lib-tab-btn-personal:not(.bg-indigo-600) {
    color: #64748b !important;
}
body:not(.notes-dark-mode) #app-library-view .bg-legal-900 {
    background-color: #f1f5f9 !important;
}
body:not(.notes-dark-mode) #app-library-view .border-legal-750 {
    border-color: #cbd5e1 !important;
}
body:not(.notes-dark-mode) #app-library-view .border-legal-700 {
    border-color: #cbd5e1 !important;
}
body:not(.notes-dark-mode) #app-library-view details {
    border-color: #cbd5e1 !important;
    background-color: #ffffff !important;
}
body:not(.notes-dark-mode) #app-library-view summary {
    color: #334155 !important;
}
body:not(.notes-dark-mode) #app-library-view summary:hover {
    background-color: #f8fafc !important;
}
body:not(.notes-dark-mode) #app-library-view .bg-legal-800 {
    background-color: #ffffff !important;
}
body:not(.notes-dark-mode) #app-library-view button {
    color: #475569 !important;
}
body:not(.notes-dark-mode) #app-library-view button:hover {
    background-color: #f1f5f9 !important;
    color: #4f46e5 !important;
}
body:not(.notes-dark-mode) #lib-slide-search {
    background-color: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}
body:not(.notes-dark-mode) #lib-slide-search::placeholder {
    color: #94a3b8 !important;
}

/* Light mode overrides for header text and authentication labels */
body:not(.notes-dark-mode) header a,
body:not(.notes-dark-mode) header nav a {
    color: #0f172a !important;
}
body:not(.notes-dark-mode) header a:hover,
body:not(.notes-dark-mode) header nav a:hover {
    color: #4f46e5 !important;
    background-color: #f1f5f9 !important;
}
body:not(.notes-dark-mode) #auth-desktop,
body:not(.notes-dark-mode) #auth-desktop span,
body:not(.notes-dark-mode) #auth-logged-out span,
body:not(.notes-dark-mode) #header-user-name {
    color: #0f172a !important;
}
body:not(.notes-dark-mode) #auth-desktop {
    border-left-color: #cbd5e1 !important;
}
body:not(.notes-dark-mode) #logout-btn-desktop {
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #475569 !important;
}
body:not(.notes-dark-mode) #logout-btn-desktop:hover {
    background-color: #e2e8f0 !important;
    color: #0f172a !important;
}

/* Slide Library Tab active button override */
body:not(.notes-dark-mode) #app-library-view button.bg-indigo-600 {
    color: #ffffff !important;
}

/* Parsed Library Content (HTML rules/directives) display styling */
.html-rules-viewer {
    color: #0f172a !important;
    font-size: 0.875rem !important;
    line-height: 1.5 !important;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}
.notes-dark-mode .html-rules-viewer {
    color: #cbd5e1 !important;
}
.html-rules-viewer p {
    margin-top: 0.25rem !important;
    margin-bottom: 0.75rem !important;
    line-height: 1.6 !important;
    color: #1e293b !important;
}
.notes-dark-mode .html-rules-viewer p {
    color: #cbd5e1 !important;
}
.html-rules-viewer h1, .html-rules-viewer h2, .html-rules-viewer h3, .html-rules-viewer h4 {
    color: #0f172a !important;
    margin-top: 1.5rem !important;
    margin-bottom: 0.5rem !important;
    font-weight: 700 !important;
}
.notes-dark-mode .html-rules-viewer h1, .notes-dark-mode .html-rules-viewer h2, .notes-dark-mode .html-rules-viewer h3, .notes-dark-mode .html-rules-viewer h4 {
    color: #cbd5e1 !important;
}

/* Light mode overrides for Pinned Resources list dropdown menu */
body:not(.notes-dark-mode) #pinned-resources-list details {
    border-color: #cbd5e1 !important;
    background-color: #ffffff !important;
}
body:not(.notes-dark-mode) #pinned-resources-list summary {
    color: #0f172a !important;
}
body:not(.notes-dark-mode) #pinned-resources-list summary:hover {
    background-color: #f1f5f9 !important;
}
body:not(.notes-dark-mode) #pinned-resources-list .bg-legal-800 {
    background-color: #ffffff !important;
}
body:not(.notes-dark-mode) #pinned-resources-list button {
    color: #334155 !important;
}
body:not(.notes-dark-mode) #pinned-resources-list button:hover {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}
body:not(.notes-dark-mode) #pinned-resources-list .text-legal-400 {
    color: #334155 !important;
}
body:not(.notes-dark-mode) #pinned-resources-list .text-legal-500 {
    color: #64748b !important;
}

/* Stylus Drawing Sticky Note Canvas Overlay */
.sticky-note-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* Float Tablet Handwriting Input Panel */
#handwriting-pad {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

#handwriting-candidates button {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Excel Sheet Style inside Notes Pane */
.excel-table-wrapper table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    color: #334155;
    background-color: #ffffff;
}
.excel-table-wrapper th, .excel-table-wrapper td {
    border: 1px solid #cbd5e1;
    padding: 8px 12px;
    text-align: left;
    white-space: nowrap;
}
.excel-table-wrapper tr:nth-child(even) {
    background-color: #f8fafc;
}
.excel-table-wrapper tr:hover {
    background-color: #f1f5f9;
}
.excel-table-wrapper th {
    background-color: #e2e8f0;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.05em;
}

#app-notes-view {
    transition: border 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

