/* =================================================================
   CONSOLIDATED STYLESHEET — Collective Agreement App
   Replaces style2.css (~6168 lines) + style.css (~474 lines)
   Organized by component, uses CSS variables throughout
   ================================================================= */

/* =================================================================
   1. CSS VARIABLES & RESETS
   ================================================================= */
:root {
    /* Colors */
    --brand-blue: #204164;
    --brand-accent: #5a99b8;
    --brand-hover: #81b4eb;
    --brand-active: #4794dc;
    --bg-color: #ffffff;
    --text-color: #333;
    --text-dark: #000;
    --text-light: #555;
    --text-muted: #666;
    --sidebar-bg: #f5f5f5;
    --sidebar-text: #204164;
    --sidebar-hover: #e0e0e0;
    --heading-color: #204164;
    --border-color: #dde2eb;
    --border-light: #eee;
    --card-bg: #fff;
    --table-header-bg: #204164;
    --table-header-text: #ffffff;
    --table-row-text: #333;
    --row-bg-odd: #ffffff;
    --row-bg-even: #f0f6fc;
    --row-hover: #e1effe;
    --note-personal: #e6a23c;
    --note-personal-bg: #fef9c3;
    --note-personal-border: #eab308;
    --note-office: #204164;
    --note-office-bg: #e3f2fd;
    --note-office-border: #204164;
    --search-highlight: #fff34d;
    --danger: #d32f2f;
    --danger-hover: #b71c1c;
    --success: #4ade80;
    --warning-bg: #fee2e2;
    --scrollbar-thumb: #204164;
    --scrollbar-thumb-hover: #1a3552;
    --p-tag-color: #000;
    --title-color: var(--brand-accent);
    --accent-color: #5a99b8;

    /* Tag colors */
    --tag-grievance: #dc2626;
    --tag-grievance-bg: #fef2f2;
    --tag-question: #ea580c;
    --tag-question-bg: #fff7ed;
    --tag-action: #7c3aed;
    --tag-action-bg: #f5f3ff;
    --tag-reference: #059669;
    --tag-reference-bg: #ecfdf5;
    --tag-important: #d97706;
    --tag-important-bg: #fffbeb;
    --tag-followup: #2563eb;
    --tag-followup-bg: #eff6ff;
    --tag-custom: #6b7280;
    --tag-custom-bg: #f3f4f6;

    /* Typography scale */
    --font-xs: 0.75rem;
    --font-sm: 0.85rem;
    --font-base: 1rem;
    --font-md: 1.1rem;
    --font-lg: 1.2rem;
    --font-xl: 1.4rem;
    --font-2xl: 1.45rem;
    --font-3xl: 1.7rem;

    /* Spacing scale (4px units) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Z-index scale */
    --z-content: 1;
    --z-sidebar: 1000;
    --z-overlay: 3000;
    --z-hamburger: 4000;
    --z-controls: 4000;
    --z-notebook: 4500;
    --z-modal: 5000;
}

/* Dark mode overrides */
body.dark-mode {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --text-dark: #fff;
    --text-light: #ccc;
    --text-muted: #aaa;
    --primary: #4a90d9;
    --brand-blue: #4a90d9;
    --sidebar-bg: #1e1e1e;
    --sidebar-text: #90caf9;
    --sidebar-hover: #333;
    --heading-color: #64b5f6;
    --border-color: #444;
    --border-light: #333;
    --card-bg: #1e1e1e;
    --table-header-bg: #152b42;
    --table-header-text: #e0e0e0;
    --row-bg-odd: #1e1e1e;
    --row-bg-even: #252525;
    --row-hover: #2c2c2c;
    --note-office: #5a99b8;
    --note-office-bg: #1a2634;
    --note-office-border: #5a99b8;
    --scrollbar-thumb: #5a99b8;
    --scrollbar-thumb-hover: #7ab8d4;
    --p-tag-color: #fff;
    --title-color: #fff;
    --accent-color: #81d4fa;
}

/* Flash prevention */
html.dark-preload { background: #121212; }

/* Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* =================================================================
   2. BASE STYLES
   ================================================================= */
html,
body {
    overflow-x: hidden;
    max-width: 100%;
    margin: 0;
}

html {
    height: 100%;
}

body {
    margin: 0;
    font-family: 'Inter', 'Open Sans', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
    font-size: 100%;
    transition: background-color 0.3s, color 0.3s;
}

h2, h3, h4, h5 {
    color: var(--heading-color);
    font-family: 'Manrope', 'Inter', sans-serif;
}

/* ── Library branding overrides ── */

/* Notyf */
.notyf__toast { border-radius: 10px !important; font-family: 'Inter', 'Open Sans', sans-serif !important; box-shadow: 0 4px 16px rgba(0,0,0,0.15) !important; }
.notyf__toast--success { background: #204164 !important; }
.notyf__message { font-weight: 500; font-size: 0.88em; }

/* Tippy OECTA theme */
.tippy-box[data-theme~='oecta'] { background: #fff; color: #204164; font-size: 0.78em; font-weight: 600; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); border: 1px solid #e2e8f0; }
.tippy-box[data-theme~='oecta'] .tippy-arrow { color: #fff; }
body.dark-mode .tippy-box[data-theme~='oecta'] { background: #1e293b; color: #e2e8f0; border-color: #334155; }
body.dark-mode .tippy-box[data-theme~='oecta'] .tippy-arrow { color: #1e293b; }

/* Choices.js OECTA branding */
.choices__inner {
    border-radius: 10px !important;
    border-color: #e2e8f0 !important;
    background: #f8fafc !important;
    padding: 6px 10px !important;
    font-size: 0.85em !important;
    min-height: 38px !important;
}
.choices__inner:focus-within { border-color: #204164 !important; box-shadow: 0 0 0 3px rgba(32, 65, 100, 0.1) !important; }
.choices__list--dropdown { border-radius: 10px !important; border-color: #e2e8f0 !important; box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important; }
.choices__list--dropdown .choices__item--selectable.is-highlighted { background: #eff6ff !important; color: #204164 !important; }
.choices__list--dropdown .choices__item--selectable { font-size: 0.85em; padding: 8px 12px !important; }
.choices__input { font-size: 0.85em !important; font-family: 'Inter', 'Open Sans', sans-serif !important; }
.choices[data-type*='select-one'] .choices__input { border-bottom: 1px solid #e2e8f0 !important; padding: 8px !important; }
.choices__placeholder { color: #94a3b8 !important; }
body.dark-mode .choices__inner { background: #334155 !important; border-color: #475569 !important; color: #e2e8f0 !important; }
body.dark-mode .choices__list--dropdown { background: #1e293b !important; border-color: #475569 !important; }
body.dark-mode .choices__list--dropdown .choices__item--selectable.is-highlighted { background: #334155 !important; color: #93c5fd !important; }

/* AOS reduced motion */
@media (prefers-reduced-motion: reduce) { [data-aos] { transition: none !important; transform: none !important; opacity: 1 !important; } }

/* Material Icons sizing */
.material-icons-outlined { font-size: 20px; vertical-align: middle; }

h1,
.centralterms h2,
.content h2 {
    color: var(--title-color);
    margin-bottom: 0;
}

#PartA-Top,
#PartB-Top,
#PartC-Top {
    color: white !important;
}

#white {
    color: var(--p-tag-color);
}

#main p {
    color: var(--p-tag-color);
}

#section-top-A p,
#section-top-B p,
#section-top-C p {
    color: white;
}

#section-top-B h5,
#section-top-C h5 {
    color: var(--accent-color) !important;
    margin-top: 0;
    font-size: var(--font-2xl);
}

/* =================================================================
   3. LAYOUT
   ================================================================= */
.container {
    display: flex;
    flex-grow: 1;
    height: 100%;
}

.content {
    flex-grow: 1;
    padding: 30px var(--space-10);
    background-color: var(--bg-color);
    border-color: var(--border-color);
    overflow-y: auto;
    position: relative;
    z-index: var(--z-content);
    min-height: 100vh;
    margin-left: 280px;
    width: calc(100% - 280px);
    scroll-behavior: smooth;
}

.content h2 {
    font-size: var(--font-3xl);
    margin-top: var(--space-10);
    color: var(--title-color);
    margin-left: 0;
}

.content h3 {
    font-weight: normal;
    margin-top: var(--space-5);
    margin-bottom: 5px;
    color: #222;
    line-height: 1.4;
    display: flex;
    align-items: baseline;
    padding-left: 50px;
    font-size: var(--font-base);
}

.content h4 {
    font-weight: normal;
    margin-top: 3px;
    margin-bottom: 3px;
    color: #222;
    line-height: 1.4;
    display: flex;
    align-items: baseline;
    font-size: var(--font-lg);
}

.content h5 {
    font-size: var(--font-3xl);
    margin-top: 0;
    margin-bottom: 0;
    color: #97dcff;
    margin-left: 0;
}

.content a,
.content a:visited {
    color: var(--brand-blue);
    text-decoration: underline;
    font-weight: 600;
    transition: color 0.2s ease;
}

.content a:hover,
.content a:focus {
    color: var(--brand-accent);
    text-decoration: underline;
}

body.dark-mode .content a,
body.dark-mode .content a:visited {
    color: #90caf9;
    text-decoration-color: #90caf9;
}

body.dark-mode .content a:hover,
body.dark-mode .content a:focus {
    color: #ffffff;
    text-decoration-color: #ffffff;
}

.content ul,
.content ol {
    list-style: disc;
    list-style-position: outside;
    margin-left: 100px;
    padding-left: 0;
    margin-bottom: 1em;
}

.content ul li,
.content ol li {
    margin-bottom: 5px;
}

.content .wage-adjustments-list {
    list-style: none;
    margin-left: 130px;
    font-size: var(--font-md);
    line-height: 1.15em;
}

.content .benefits-funding-adjustments-list {
    list-style: none;
    margin-left: 130px;
    font-size: 1.05em;
    line-height: 1.15em;
}

/* =================================================================
   4. SIDEBAR
   ================================================================= */
.sidebar {
    width: 280px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: var(--z-sidebar);
    background-color: #fbfbfd;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    overflow-y: hidden;
    border-right: 1px solid #eaecf0;
}

.sidebar-header {
    flex-shrink: 0;
    background-color: #fbfbfd;
    padding: 0;
    z-index: 10;
}

/* Reading progress bar */
.reading-progress {
    height: 2px;
    background: var(--brand-accent);
    width: 0%;
    transition: width 0.15s ease;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 20;
}

/* Sidebar brand bar — clean text, no logo */
.sidebar-brand-bar {
    padding: 18px 20px 12px;
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #204164;
}

.sidebar-logo-sm {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-brand-info {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.sidebar-brand-org {
    font-size: 0.82em;
    font-weight: 700;
    color: #204164;
    letter-spacing: 0.2px;
    font-family: 'Manrope', 'Inter', sans-serif;
}

.sidebar-brand-doc {
    font-size: 0.68em;
    color: #94a3b8;
    font-weight: 500;
}

/* Sidebar search */
.sidebar-search {
    position: relative;
    padding: 0 16px 10px;
}

.sidebar-search-icon {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-65%);
    font-size: 0.85em;
    opacity: 0.4;
    pointer-events: none;
}

.sidebar-search input {
    width: 100%;
    padding: 9px 12px 9px 34px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.85em;
    font-family: inherit;
    background: #fff;
    color: var(--text-color);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sidebar-search input:focus { border-color: #204164; box-shadow: 0 0 0 3px rgba(32,65,100,0.08); }
.sidebar-search input::placeholder { color: #b0b8c4; }

.sidebar-search-clear {
    position: absolute;
    right: 22px;
    top: 50%;
    transform: translateY(-65%);
    background: none;
    border: none;
    font-size: 1.2em;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 4px;
}

/* Sidebar tabs (3 tabs) */
.sidebar-tabs {
    display: flex;
    padding: 0 16px 12px;
    gap: 6px;
}

.sidebar-tab {
    flex: 1;
    padding: 6px 0;
    text-align: center;
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.78em;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s;
}

.sidebar-tab:hover { background: #f1f5f9; color: #334155; }

.sidebar-tab.active {
    background: #204164;
    color: white;
    border-color: #204164;
    box-shadow: 0 1px 4px rgba(32,65,100,0.2);
}

body.dark-mode .sidebar-tab { background: transparent; border-color: #475569; color: #94a3b8; }
body.dark-mode .sidebar-tab.active { background: #5a99b8; color: #000; border-color: #5a99b8; }

/* Nav tree */
.sidebar-nav {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0 0 40px;
    scrollbar-color: rgba(0,0,0,0.1) transparent;
    scrollbar-width: thin;
}

.nav-tree { padding: 0; }

.nav-article { position: relative; }

.nav-article-header {
    display: flex;
    align-items: baseline;
    padding: 6px 16px 6px 20px;
    color: #475569;
    text-decoration: none;
    font-size: 0.85em;
    line-height: 1.3;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    border-left: 2px solid transparent;
    gap: 4px;
}

.nav-article-header:hover { background: rgba(32, 65, 100, 0.04); color: #1e293b; }

.nav-article-header.active-article {
    background: rgba(32, 65, 100, 0.06);
    border-left-color: #204164;
    color: #204164;
    font-weight: 600;
}

.nav-arrow {
    font-size: 0.55em;
    transition: transform 0.2s;
    flex-shrink: 0;
    width: 10px;
    color: #cbd5e1;
    display: inline-block;
}

.nav-article.expanded .nav-arrow { transform: rotate(90deg); color: #204164; }

.nav-num {
    font-weight: 700;
    color: #204164;
    flex-shrink: 0;
    min-width: 18px;
    font-size: 0.95em;
}

.nav-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: inherit;
    font-weight: 400;
}

.nav-dots {
    flex-shrink: 0;
    width: 14px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
}

/* Note indicator dots */
.nav-dots .dot-office {
    width: 5px; height: 5px; border-radius: 50%;
    background: #204164; flex-shrink: 0;
}

.nav-dots .dot-admin {
    width: 5px; height: 5px; border-radius: 50%;
    background: #dc2626; flex-shrink: 0;
}

/* Sub-items (collapsible children) */
.nav-sub-items {
    display: none;
    border-left: 1px solid #e2e8f0;
    margin-left: 30px;
    padding: 1px 0;
}

.nav-article.expanded .nav-sub-items { display: block; }

.nav-sub-item {
    display: block;
    padding: 4px 12px;
    font-size: 0.8em;
    color: #94a3b8;
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-sub-item:hover { background: rgba(32, 65, 100, 0.04); color: #334155; }

.nav-sub-num {
    font-weight: 600;
    color: #204164;
    margin-right: 4px;
    font-size: 0.92em;
}

.nav-top-link { font-style: italic; opacity: 0.7; }

/* Nav appendix divider */
.nav-divider-line {
    display: flex;
    align-items: center;
    padding: 14px 20px 6px;
    font-size: 0.65em;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.nav-divider-line::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
    margin-left: 8px;
}

.nav-loa {
    font-size: 0.8em;
    color: #64748b;
    padding: 5px 20px;
}

.nav-loa .nav-title { white-space: normal; -webkit-line-clamp: 2; }

/* Part section headers in continuous scroll */
.nav-part-header {
    padding: 10px 20px 6px;
    font-size: 0.65em;
    font-weight: 700;
    color: #204164;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    border-top: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 2;
}

.nav-part-section:first-child .nav-part-header { border-top: none; }

body.dark-mode .nav-part-header {
    background: var(--sidebar-bg);
    color: var(--brand-accent);
    border-color: #444;
}

/* Search results */
.sidebar-search-results {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 0 8px;
}

.sidebar.search-active .sidebar-nav { display: none; }
.sidebar.search-active .sidebar-search-results { display: block; }

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0 10px 0 -15px;
}

.sidebar li {
    margin-bottom: 0;
}

.sidebar a,
.sidebar .collapsible-header {
    text-decoration: none;
    display: flex;
    align-items: baseline;
    padding: 3px 10px;
    font-size: 1em;
    transition: background-color 0.2s, color 0.2s;
    min-height: 0;
}

/* Sidebar text colors */
.sidebar .sidebar-item-text,
.sidebar .sidebar-item-number,
.sidebar-item-text-moreright,
.sidebar-item-text-moreright2,
.sidebar-appendix-item {
    color: var(--sidebar-text);
    font-weight: lighter;
    line-height: 1.2;
}

.sidebar-appendix-item {
    padding-left: 18px;
}

/* Sub-item colors */
.sidebar .collapsible-content a .sidebar-item-text,
.sidebar .collapsible-content a .sidebar-item-number,
.sidebar .collapsible-content a .sidebar-item-text-moreright,
.sidebar .collapsible-content a .sidebar-item-text-moreright2,
.sidebar .collapsible-content-display {
    color: var(--brand-accent);
    font-weight: 600;
}

/* Hover states */
.sidebar a:hover,
.sidebar a:focus,
.sidebar .collapsible-header:hover,
.sidebar .collapsible-header:focus {
    background-color: var(--sidebar-hover);
}

.sidebar a:hover .sidebar-item-text,
.sidebar a:hover .sidebar-item-number,
.sidebar a:hover .sidebar-appendix-item,
.sidebar a:hover .sidebar-item-text-moreright,
.sidebar a:hover .sidebar-item-text-moreright2,
.sidebar .collapsible-header:hover .sidebar-item-text,
.sidebar .collapsible-header:hover .sidebar-item-text-moreright,
.sidebar .collapsible-header:hover .sidebar-item-text-moreright2,
.sidebar .collapsible-header:hover .sidebar-item-number {
    color: var(--text-color);
}

/* Sidebar logo */
.sidebar-logo {
    max-width: 70%;
    height: auto;
    display: block;
    margin: 0 auto;
}

#sidebar-logo {
    scale: 1.2;
    height: auto;
}

.desktop-logo-link {
    display: block;
}

.site-title-sidebar {
    font-size: var(--font-3xl);
    font-weight: 700;
    color: var(--brand-blue);
    line-height: 1.3;
    margin: 0;
}

/* Sidebar item numbers and text */
.sidebar-item-number {
    font-weight: normal;
    flex-shrink: 0;
    flex-grow: 0;
    width: 1em;
    text-align: right;
    padding-right: 0;
}

.sidebar-item-number-top {
    font-weight: normal;
    flex-shrink: 0;
    flex-grow: 0;
    width: 100%;
    text-align: right;
    padding-right: 0;
}

.sidebar-item-text {
    font-weight: normal;
    flex-grow: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
    margin-left: 30px;
}

.sidebar-item-numberold {
    font-weight: normal;
    flex-shrink: 0;
    flex-grow: 0;
    min-width: 10px;
    text-align: center;
    padding-right: 15px;
}

.sidebar-text-content {
    display: flex;
    align-items: baseline;
    flex-grow: 1;
}

.sidebar-text-content-C-appendix {
    display: flex;
    align-items: baseline;
    flex-grow: 1;
    margin-left: 50px;
    margin-top: -5px;
}

.sidebar-item-text-C-appendix {
    flex-grow: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
    color: var(--brand-accent);
    font-weight: 600;
}

.sidebar-item-text-moreright {
    font-weight: normal;
    flex-grow: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
    padding-left: 27px;
}

.sidebar-item-text-moreright2 {
    font-weight: normal;
    flex-grow: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
    margin-left: 4rem;
    margin-top: -0.75rem;
}

/* Desktop tabs */
.part-selector {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    width: 100%;
    margin: 15px 0;
    gap: 0;
}

.part-tab {
    flex: 1;
    padding: 10px 2px;
    text-align: center;
    background-color: var(--brand-blue);
    color: #fff;
    border: 1px solid #666;
    border-left: none;
    cursor: pointer;
    font-size: var(--font-xs);
    transition: background-color 0.2s ease;
    border-radius: 0;
    white-space: nowrap;
}

.part-tab:first-child {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
    border-left: 1px solid #666;
}

.part-tab:last-child {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
}

.part-tab:not(.active):hover {
    background-color: var(--brand-hover);
}

.part-tab.active {
    background-color: var(--brand-active);
    font-weight: 700;
}

.main-menu > li > a,
.main-menu > li > .collapsible-header {
    padding-left: var(--space-5);
}

.loa-header {
    margin-top: 10px;
    margin-bottom: 10px;
    text-align: center;
    font-size: 1.5em;
    color: var(--brand-blue);
    font-weight: 700;
}

#toc-no-child {
    padding-left: 0;
}

/* Collapsible sections */
.collapsible-header .arrow {
    font-size: 0.8em;
    transition: transform 0.2s;
    flex-shrink: 0;
    flex-grow: 0;
    width: 15px;
    text-align: center;
    margin-right: 3px;
}

.collapsible-parent.expanded .collapsible-header .arrow {
    transform: rotate(180deg);
}

.collapsible-content {
    display: none;
    padding-left: 0;
    border-left: 2px solid #ddd;
    margin-top: 2px;
    padding-bottom: 2px;
}

.collapsible-content-display {
    padding-left: 0;
    color: var(--brand-accent);
    font-weight: 500;
}

.collapsible-content li {
    padding-left: 15px;
}

.collapsible-content > li > a,
.collapsible-content > li > .collapsible-header {
    padding-left: 50px;
}

.collapsible-content .collapsible-content > li > a,
.collapsible-content .collapsible-content > li > .collapsible-header {
    padding-left: 50px;
}

.collapsible-content .collapsible-content .collapsible-content > li > a,
.collapsible-content .collapsible-content .collapsible-content > li > .collapsible-header {
    padding-left: 65px;
}

.collapsible-parent.expanded .collapsible-content {
    display: block;
}

/* Search container */
.search-container {
    padding: 2px 0 8px 0;
}

#search-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1em;
    font-family: 'Inter', 'Open Sans', sans-serif;
}

#search-results {
    display: none;
    padding: 0 15px;
}

.sidebar.search-active nav {
    display: none;
}

.sidebar.search-active #search-results {
    display: block;
}

/* TOC zoom controls */
.toc-zoom-controls {
    position: absolute;
    bottom: 15px;
    right: 15px;
    display: flex;
    gap: 5px;
    z-index: 20;
    background-color: #ffffff;
    padding: var(--space-1);
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #c0c0c0;
}

.toc-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background-color: var(--brand-blue);
    color: white;
    font-size: var(--font-4);
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding-bottom: 2px;
    transition: background 0.2s;
}

.toc-btn:hover {
    background-color: var(--brand-accent);
}

body.dark-mode .toc-zoom-controls {
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

body.dark-mode .toc-btn {
    background-color: var(--brand-accent);
    color: #fff;
}

/* Desktop-only HR */
.desktop-only-hr {
    margin-top: 5px;
    margin-bottom: 5px;
}

/* Dark mode sidebar */
body.dark-mode .sidebar {
    background-color: #0f172a;
    border-right-color: #1e293b;
}
body.dark-mode .sidebar-header {
    background-color: #0f172a;
}
body.dark-mode .sidebar-brand-org { color: #e2e8f0; }
body.dark-mode .sidebar-brand-doc { color: #64748b; }
body.dark-mode .sidebar-search input { background: #1e293b; border-color: #334155; color: #e2e8f0; }
body.dark-mode .sidebar-search input:focus { border-color: #5a99b8; }
body.dark-mode .nav-article-header { color: #94a3b8; }
body.dark-mode .nav-article-header:hover { background: rgba(255,255,255,0.04); color: #e2e8f0; }
body.dark-mode .nav-article-header.active-article { background: rgba(90,153,184,0.1); border-left-color: #5a99b8; color: #e2e8f0; }
body.dark-mode .nav-num { color: #5a99b8; }
body.dark-mode .nav-sub-items { border-left-color: #334155; }
body.dark-mode .nav-sub-item { color: #64748b; }
body.dark-mode .nav-sub-item:hover { background: rgba(255,255,255,0.04); color: #e2e8f0; }
body.dark-mode .nav-part-header { background: #1e293b; color: #5a99b8; border-color: #334155; }
body.dark-mode .nav-divider-line { color: #64748b; }
body.dark-mode .nav-divider-line::after { background: #334155; }

body.dark-mode .sidebar .sidebar-item-text,
body.dark-mode .sidebar .sidebar-item-number,
body.dark-mode .sidebar .sidebar-appendix-item,
body.dark-mode .sidebar .sidebar-text-content-C-appendix,
body.dark-mode .collapsible-header {
    color: var(--sidebar-text);
}

body.dark-mode .sidebar a:hover,
body.dark-mode .sidebar .collapsible-header:hover {
    background-color: var(--sidebar-hover);
}

body.dark-mode .sidebar a:hover .sidebar-item-text,
body.dark-mode .sidebar a:hover .sidebar-item-number,
body.dark-mode .sidebar a:hover .sidebar-appendix-item,
body.dark-mode .sidebar .collapsible-header:hover .sidebar-item-text,
body.dark-mode .sidebar .collapsible-header:hover .sidebar-item-number,
body.dark-mode .sidebar .collapsible-header:hover .sidebar-appendix-item {
    color: #ffffff !important;
}

/* Dark mode nav hierarchy */
body.dark-mode .sidebar .collapsible-content .sidebar-item-text,
body.dark-mode .sidebar .collapsible-content .sidebar-item-number {
    color: var(--text-color) !important;
    font-weight: 400;
    opacity: 0.95;
}

body.dark-mode .sidebar .collapsible-content a:hover .sidebar-item-text,
body.dark-mode .sidebar .collapsible-content a:hover .sidebar-item-number {
    color: #ffffff !important;
    opacity: 1;
}

body.dark-mode .sidebar .collapsible-header .sidebar-item-text,
body.dark-mode .sidebar .collapsible-header .sidebar-item-number {
    color: #90caf9 !important;
    font-weight: 400;
}

/* =================================================================
   5. SCROLLBAR STYLING
   ================================================================= */
* {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    transition: scrollbar-color 0.4s ease;
}

*:hover {
    scrollbar-color: var(--scrollbar-thumb) transparent;
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background-color: transparent;
    border-radius: 20px;
    border: 2px solid transparent;
    background-clip: content-box;
}

*:hover::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb);
}

*::-webkit-scrollbar-thumb:hover {
    background-color: var(--scrollbar-thumb-hover);
}

body.dark-mode * {
    scrollbar-color: transparent transparent;
}

body.dark-mode *:hover {
    scrollbar-color: var(--scrollbar-thumb) transparent;
}

body.dark-mode *:hover::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb);
}

/* =================================================================
   6. DOCUMENT CONTENT
   ================================================================= */

/* Clause rows */
.clause-row {
    display: flex;
    flex-direction: row;
    width: 100%;
    margin-bottom: 15px;
    position: relative;
    padding-left: 38px !important;
}

.clause-number {
    flex: 0 0 60px;
    font-weight: 700;
    color: var(--brand-blue);
    font-size: var(--font-md);
    padding-right: 10px;
    box-sizing: border-box;
    position: relative;
}

body.dark-mode .clause-number {
    color: var(--heading-color);
}

.clause-number .note-flag {
    position: absolute;
    top: 0;
    right: 100%;
    transform: none;
    margin-top: 6px;
    margin-right: 7px;
    line-height: 1;
}

.clause-number .note-flag.office-flag {
    margin-right: 22px;
}

.clause-text {
    flex: 1;
    font-size: var(--font-md);
    line-height: 1.6;
    color: var(--text-color);
    min-width: 0;
}

.clause-text strong {
    display: block;
    font-size: 1.15em;
    color: var(--heading-color);
    margin-bottom: 6px;
    line-height: 1.3;
}

/* Level indentation */
.clause-row.level-1 { margin-left: 0; }
.clause-row.level-2 { margin-left: 25px; width: calc(100% - 25px); }
.clause-row.level-3 { margin-left: 50px; width: calc(100% - 50px); }

/* Part B specific */
.part-b-header {
    text-align: center;
    width: 100%;
}

.part-b-header h1 {
    font-weight: 700 !important;
    font-size: var(--font-xl);
    margin-bottom: var(--space-5);
    color: var(--title-color) !important;
}

.part-b-header h3 {
    font-weight: 500;
    font-size: var(--font-md);
    margin-bottom: var(--space-5);
    color: var(--text-color) !important;
}

.part-b-row .clause-number {
    flex: 0 0 60px;
    text-align: right;
    padding-right: 10px;
}

.part-b-row .clause-text {
    flex: 1;
}

#B-title .clause-number {
    min-width: 60px;
}

#B-title h1 {
    display: block;
    width: 100%;
    text-align: center;
    font-weight: 600;
    font-size: var(--font-xl);
    margin-bottom: 35px;
    color: var(--text-color) !important;
}

#B-title .B-indent {
    display: block;
    width: 100%;
    margin-left: 50px;
    padding-right: 80px;
    text-align: left;
    font-weight: 500;
    font-size: var(--font-md);
    margin-bottom: 35px;
    padding-left: 0;
}

#B-title h3 {
    display: block;
    width: 100%;
    text-align: center;
    font-weight: 500;
    font-size: var(--font-md);
    margin-bottom: 35px;
    padding-left: 0;
    color: var(--text-color) !important;
}

#B-title-h32 {
    text-align: center;
    font-weight: 500;
    font-size: var(--font-md);
    margin-bottom: 35px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

#B-title .top {
    margin-top: 175px;
    font-size: var(--font-xl);
    font-weight: 600;
    color: var(--text-color);
}

#Language_B h3,
#Appendix_B h3,
#Appendix_B h2,
#Language_C h3,
#Appendix_C h3,
#Appendix_C h2 {
    color: var(--text-color) !important;
}

/* Headings and sections */
.section-header {
    background-color: var(--brand-blue);
    color: #fff;
    text-align: center;
    padding: 10px;
}

/* Central terms */
.central-terms-section p {
    margin: 0 0 10px 0;
    color: white;
}

.central-terms-section h1 {
    margin: var(--space-2) 0 0 0;
    color: white;
}

.central-terms-section .term-dates {
    list-style: disc;
    margin: 0 auto;
    padding: 0;
    width: fit-content;
    text-align: left;
    font-size: 1.3em;
    opacity: 0.8;
    color: #fff;
}

.centralterms p {
    margin-left: 125px;
    color: #fff;
    margin-right: 60px;
    margin-top: 5px;
    margin-bottom: 1em;
    line-height: 1.6;
    text-indent: 0;
    font-size: var(--font-md);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.centralterms h4 {
    font-size: var(--font-lg);
    font-weight: normal;
    margin-top: 25px;
    margin-bottom: var(--space-2);
    color: #222;
    margin-left: 130px;
    text-indent: -30px;
    line-height: 1.4;
}

/* Text area */
.text-area {
    margin-right: 50px;
}

/* Letters of agreement */
.letters-of-agreement ul {
    margin: 0;
    margin-top: var(--space-5);
    margin-left: 55px;
    font-size: var(--font-lg);
}

.letters-of-agreement h2 {
    font-size: var(--font-2xl);
    margin-top: var(--space-10);
    margin-bottom: 15px;
    color: var(--text-dark);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.letters-of-agreement h3 {
    font-size: var(--font-2xl);
    font-weight: 600;
    margin-top: var(--space-10);
    padding: 0;
    margin-bottom: 15px;
    color: var(--text-dark);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.letters-of-agreement h4 {
    font-weight: 400;
    font-size: var(--font-md);
    color: #222;
}

.letters-of-agreement p {
    margin-left: 0;
    color: #222;
    margin-top: 5px;
    margin-bottom: 0;
    line-height: 1.6;
    text-indent: 0;
    font-size: var(--font-md);
}

.letters-of-agreement .space {
    margin-bottom: 15px;
}

.letters-of-agreement .loa14-bullets {
    list-style-type: none;
    margin-left: 25px;
}

.letters-of-agreement .loa14-bulleted-list {
    font-size: 1em;
}

/* Nested tables */
.nested-table {
    margin-left: 100px;
    margin-top: 0;
    margin-bottom: 1em;
    width: calc(100% - 100px);
    border-collapse: collapse;
    table-layout: fixed;
    word-wrap: normal;
}

.nested-table td {
    padding: 0;
    vertical-align: top;
    line-height: 1.6;
    color: #222;
    word-wrap: normal;
}

.nested-table td:first-child {
    width: 100px;
    text-align: right;
    padding-right: 25px;
}

.nested-table td:nth-child(2) {
    padding-left: 0;
    word-wrap: normal;
    font-size: var(--font-md);
    padding-right: 60px;
}

body.dark-mode .nested-table td:nth-child(2) {
    color: #fff;
}

.nested-table td:first-child h3 {
    font-weight: normal;
    margin: 0;
    padding: 0;
    text-indent: 0;
    line-height: inherit;
    color: inherit;
    display: inline;
    font-size: var(--font-md);
}

/* Nested table B */
.nested-table-B {
    margin-left: 40px;
    margin-top: 0;
    margin-bottom: 1em;
    width: calc(100% - 100px);
    border-collapse: collapse;
    table-layout: fixed;
    word-wrap: normal;
}

.nested-table-B td {
    padding: 0;
    vertical-align: top;
    line-height: 1.6;
    color: #222;
    word-wrap: normal;
}

.nested-table-B td:first-child {
    width: 100px;
    text-align: right;
    padding-right: 25px;
}

.nested-table-B td:nth-child(2) {
    padding-left: 0;
    word-wrap: normal;
    font-size: var(--font-md);
    padding-right: 60px;
}

.nested-table-B td:first-child h3 {
    font-weight: normal;
    margin: 0;
    padding: 0;
    text-indent: 0;
    line-height: inherit;
    color: inherit;
    display: inline;
    font-size: var(--font-md);
}

/* Nested table 2 */
.nested-table2 {
    margin-left: 0;
    margin-top: 5px;
    margin-bottom: 0;
    width: 100%;
    border-collapse: collapse;
    font-size: 1em;
    table-layout: fixed;
    word-wrap: normal;
}

.nested-table2 td {
    padding: 0;
    vertical-align: top;
    line-height: 1.6;
    color: #222;
}

.nested-table2 td:first-child {
    width: 80px;
    text-align: right;
    padding-right: 25px;
}

.nested-table2 td:nth-child(2) {
    padding-left: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 1em;
    padding-right: 100px;
}

.nested-table2 td:first-child h3 {
    font-size: 1em;
    font-weight: normal;
    margin: 0;
    padding: 0;
    text-indent: 0;
    line-height: inherit;
    color: inherit;
    display: inline;
}

/* Nested table 3 */
.nested-table3 {
    margin-left: 25px;
    margin-top: 5px;
    margin-bottom: 0;
    width: 100%;
    border-collapse: collapse;
    font-size: 1em;
    table-layout: fixed;
    word-wrap: normal;
}

.nested-table3 td {
    padding: 0;
    vertical-align: top;
    line-height: 1.6;
    color: #222;
}

.nested-table3 td:first-child {
    width: 100px;
    text-align: right;
    padding-right: 25px;
}

.nested-table3 td:nth-child(2) {
    padding-left: 0;
    padding-right: 25px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 1em;
}

.nested-table3 td:first-child h3 {
    font-size: 1em;
    font-weight: normal;
    margin: 0;
    padding: 0;
    text-indent: 0;
    line-height: inherit;
    color: inherit;
    display: inline;
}

/* LOA nested table overrides */
.letters-of-agreement .nested-table {
    margin-left: 0;
    margin-top: 0;
    margin-bottom: 1em;
    width: calc(100% - 35px);
}

.letters-of-agreement .nested-table2 {
    margin-left: 25px;
    margin-top: 0;
    margin-bottom: 0;
    width: calc(100% - 35px);
}

.letters-of-agreement .nested-table3 {
    margin-left: 25px;
    margin-top: 0;
    margin-bottom: 1em;
    width: calc(100% - 35px);
}

.letters-of-agreement .nested-table2 h4 {
    font-size: 1em;
}

.letters-of-agreement .nested-table2 td {
    padding: 0;
    vertical-align: top;
    line-height: 1.6;
    color: #222;
    font-size: 1em;
}

.letters-of-agreement .nested-table td:nth-child(1) {
    width: 100px;
    text-align: left;
    padding-left: 35px;
    padding-right: 0;
}

.letters-of-agreement .nested-table td:nth-child(2) {
    padding-left: 0;
    word-wrap: normal;
    font-size: var(--font-md);
}

.letters-of-agreement .nested-table3 td:nth-child(1) {
    width: 100px;
    text-align: left;
    padding-left: 0;
    padding-right: 0;
    font-size: var(--font-md);
}

.letters-of-agreement .nested-table3 td:nth-child(2) {
    padding-left: 0;
    word-wrap: normal;
    font-size: var(--font-md);
}

.letters-of-agreement .nested-table2 td:nth-child(2) {
    padding-left: 0;
    word-wrap: normal;
    font-size: 1em;
}

.letters-of-agreement .nested-table td:first-child h3 {
    font-weight: normal;
    margin: 0;
    padding: 0;
    text-indent: 0;
    line-height: inherit;
    color: inherit;
    display: inline;
}

/* Section numbers */
.section-number {
    display: inline-block;
    padding-right: 75px;
    white-space: nowrap;
    font-weight: 600;
    flex-shrink: 0;
    flex-grow: 0;
    width: 50px;
    text-align: right;
    font-size: var(--font-md);
}

.section-number-nobold {
    display: inline-block;
    padding-right: 75px;
    white-space: nowrap;
    font-weight: 500;
    flex-shrink: 0;
    flex-grow: 0;
    width: 50px;
    text-align: right;
    font-size: var(--font-md);
}

.sectionB-number {
    display: inline-block;
    padding-right: 90px;
    white-space: nowrap;
    font-weight: 800;
    flex-shrink: 0;
    flex-grow: 0;
    width: 50px;
    text-align: right;
    font-size: var(--font-md);
}

.sectionB-number-nobold {
    display: inline-block;
    padding-right: 90px;
    white-space: nowrap;
    font-weight: 500;
    flex-shrink: 0;
    flex-grow: 0;
    width: 50px;
    text-align: right;
    font-size: var(--font-md);
}

.section-text {
    font-weight: 700;
    flex-grow: 1;
}

.section-text-nobold {
    font-weight: normal;
    flex-grow: 1;
}

/* Appendix B numbers */
.appB-number-nobold {
    display: inline-block;
    padding-right: 75px;
    white-space: nowrap;
    font-weight: 500;
    flex-shrink: 0;
    flex-grow: 0;
    width: 50px;
    text-align: right;
    font-size: var(--font-md);
    margin-left: 50px;
}

.appB-number-nobold2 {
    display: inline-block;
    padding-right: 75px;
    white-space: nowrap;
    font-weight: 500;
    flex-shrink: 0;
    flex-grow: 0;
    width: 50px;
    text-align: right;
    font-size: var(--font-md);
    margin-left: 110px;
}

/* LOI-C */
.LOI-C-number {
    margin-left: 100px;
    display: inline-block;
    white-space: nowrap;
    font-weight: 500;
    flex-shrink: 0;
    flex-grow: 0;
    text-align: right;
}

.LOI-C-number2 {
    margin-left: 200px;
    display: inline-block;
    white-space: nowrap;
    font-weight: 500;
    flex-shrink: 0;
    flex-grow: 0;
    min-width: 3em;
    text-align: right;
}

.LOI-C-text {
    margin-left: 75px;
    display: inline-block;
    white-space: nowrap;
    font-weight: 500;
    flex-shrink: 0;
    flex-grow: 0;
    text-align: left;
}

.LOI-C-text2 {
    margin-left: 50px;
    display: inline-block;
    white-space: nowrap;
    font-weight: 500;
    flex-shrink: 0;
    flex-grow: 0;
    text-align: left;
}

/* ID-specific overrides */
#left-align h2 {
    text-align: left;
    margin-left: 50px;
}

#list {
    margin-bottom: 0;
    margin-top: var(--space-5);
}

#list-c {
    margin-bottom: 0;
    margin-top: 0;
}

#list h3 {
    margin-bottom: 0;
    margin-top: 0;
}

#por {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

#por li::before {
    content: "- ";
}

#Appendix_B_AppendixA .LOI-nobold,
#Appendix_B .LOI-nobold {
    font-weight: 500 !important;
}

#Appendix_B h2 {
    margin-left: 50px;
    width: 100%;
    text-align: left;
    font-size: var(--font-md);
}

#Appendix_B h3 {
    text-align: left;
    margin-left: 0;
    font-weight: 500;
    margin-top: 25px;
    margin-bottom: 25px;
}

#Appendix_C h3 {
    margin-left: 100px;
    text-align: left;
    font-weight: 500;
}

#apc {
    margin-left: -0.8rem;
}

#C705-list {
    margin-top: 25px;
    margin-left: 25px;
}

#main h3 {
    font-size: var(--font-md);
}

#bulleted-list1 {
    margin-top: 10px;
    margin-left: 35px;
    line-height: 1em;
}

#bulleted-list1 li {
    padding-left: 30px;
    margin-bottom: 5px;
}

/* LOA-specific table IDs */
#LOA13 .nested-table2 td:nth-child(1) {
    width: 55px;
    margin: 0;
    padding: 0;
}

#LOA13 .nested-table2 {
    margin-top: 10px;
    margin-bottom: 15px;
    font-size: var(--font-lg);
}

#LOA13 .nested-table {
    font-size: var(--font-lg);
}

#LOA13-Table {
    margin: 0;
    padding: 0;
}

#LOA13-Table td:nth-child(1) {
    width: 55px;
    margin: 0;
    padding: 0;
}

#LOA18-Table td:nth-child(1) {
    width: 70px;
    padding-left: 0;
    font-size: 1.3em;
}

#LOA18-Table2 {
    margin-left: 35px;
}

#LOA19-Table td:nth-child(1) {
    width: 55px;
    padding-left: 0;
    font-style: normal;
}

#LOA19-Table {
    margin-left: 35px;
    margin-top: 15px;
}

#LOA23-Table {
    margin-left: 0;
    font-size: var(--font-lg);
}

#LOA23-Table2 {
    margin-left: 0;
    font-size: 1em;
}

#LOA23 p {
    padding: 0;
    margin-top: 30px;
    margin-left: -40px;
    font-size: 1em;
}

#LOA23-Table td:nth-child(1) {
    width: 75px;
}

#appendix_a_fees h2 {
    font-weight: 800;
    font-size: 1.5em;
    color: black !important;
    text-align: left;
    margin-left: 135px;
}

#centre_title_fees {
    text-align: center;
}

/* Misc content classes */
.bold { font-weight: 800; }
.no_bold { font-weight: 500; }
.underline { text-decoration: underline; }
.top-align {
    align-self: flex-start;
    vertical-align: top;
}

.call-out-indent { margin-left: 150px; min-width: 9em; }
.call-out-indent2 { margin-left: 100px; }
.call-out-indent3 { min-width: 13.5em; margin-left: 60px; }
.call-out-indent4 { margin-left: 35px; }

.B-indent { margin-left: 50px; }
.B-indent2 { margin-left: -10px; }
.B-indent3 { margin-left: 120px; }
.B-indent4 { margin-left: 50px; }
.B-indent5 { margin-left: 35px; }
.B-indent6 { margin-left: 13px; }
.B-indent7 { margin-left: 175px; width: 200px; }
.B-indent8 { margin-left: 125px; }
.B-indent9 { margin-left: 175px; }
.B-indent10 { margin-left: 40px; }
.B-list { margin-left: -75px; }

.margin-top { margin-top: 15px; }
.space { margin-top: 200px; }
.space2 { margin-top: 100px; }
.space3 { margin-top: 10px; }
.spacing { padding-right: 40px; }
.top { margin-top: -5px; }
.indent { margin-left: 100px; }
.tab { padding-right: 1em; }
.table-width { width: 280px; }
.app-b-left-margin { margin-left: 0; width: 100%; text-align: left; font-size: var(--font-md); }
.LOA4STYLE { margin-left: 30px; font-weight: 800; font-size: var(--font-md); }
.wage-adjustment-list-space { padding-left: 10px; }
.main-content-header { margin-bottom: 30px; }
.formula { margin-left: 100px; padding-right: var(--space-5); }
.gratuityformula { margin-left: 160px; }
.gratuityformula2 { margin-left: 340px; margin-top: -25px; }
.balanced-day-table { margin-left: 200px; }
.responsibility-indent { padding-left: var(--space-5); }
.responsibility2-indent { padding-left: var(--space-5); }

/* Gratuity formula layout */
.gratuity-formula-container {
    display: flex;
    align-items: center;
    margin: var(--space-5) 0 var(--space-5) var(--space-10);
    font-size: var(--font-md);
    font-weight: 700;
}

.formula-fraction {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.formula-fraction .numerator {
    padding: 0 10px 2px 10px;
    border-bottom: 2px solid currentColor;
}

.formula-fraction .denominator {
    padding-top: 2px;
}

.formula-operator {
    margin-left: 15px;
    padding-bottom: 25px;
}

/* Banner */
.banner-image-container {
    width: 100%;
    overflow: hidden;
    background-color: #fff;
    padding-top: 0;
    text-align: center;
}

.main-banner-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* =================================================================
   7. TABLES
   ================================================================= */

/* Table wrappers — shared base */
.table-wrapper,
.table2-wrapper,
.table3-wrapper,
.table4-wrapper,
.table5-wrapper,
.table6-wrapper {
    overflow-x: auto;
    background-color: var(--card-bg);
    margin-top: 1.5em;
    margin-bottom: 2em;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
}

/* Width/margin per variant */
.table-wrapper { width: 55%; margin-left: 22%; }
.table2-wrapper { width: 35%; margin-left: 185px; }
.table3-wrapper { width: 35%; margin-left: 0; }
.table4-wrapper { width: 35%; margin-left: 50px; }
.table5-wrapper { width: 45%; margin-left: 175px; }
.table6-wrapper { width: 85%; margin-left: 25px; }

/* Dark mode table wrappers */
body.dark-mode .table-wrapper,
body.dark-mode .table2-wrapper,
body.dark-mode .table3-wrapper,
body.dark-mode .table4-wrapper,
body.dark-mode .table5-wrapper,
body.dark-mode .table6-wrapper {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

/* Salary table */
.salary-table {
    width: 100%;
    min-width: 40em;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9em;
}

.salary-table thead th {
    background-color: var(--table-header-bg);
    color: var(--table-header-text);
    padding: 0.85em 0.5em;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 0.9em;
    letter-spacing: 0.05em;
    border-bottom: 3px solid #152b42;
}

.salary-table td,
.salary-table tbody th {
    padding: 0.6em 1em;
    color: var(--table-row-text);
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.salary-table tbody tr:nth-child(odd) td,
.salary-table tbody tr:nth-child(odd) th {
    background-color: var(--row-bg-odd);
}

.salary-table tbody tr:nth-child(even) td,
.salary-table tbody tr:nth-child(even) th {
    background-color: var(--row-bg-even);
}

.salary-table tbody th {
    font-weight: 700;
    color: var(--brand-blue);
    border-right: 2px solid var(--border-color);
}

.salary-table tbody tr:hover td,
.salary-table tbody tr:hover th {
    background-color: var(--row-hover);
    cursor: default;
    transition: background-color 0.1s ease-in-out;
}

/* Sticky column */
.sticky-col {
    position: sticky;
    left: 0;
    z-index: 2;
}

thead th.sticky-col {
    z-index: 3;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.salary-table tbody tr:nth-child(odd) th.sticky-col { background-color: var(--row-bg-odd); }
.salary-table tbody tr:nth-child(even) th.sticky-col { background-color: var(--row-bg-even); }
.salary-table tbody tr:hover th.sticky-col { background-color: var(--row-hover); }

/* Responsibility table */
.responsibility-table {
    width: 100%;
    min-width: 10em;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--font-sm);
}

.responsibility-table thead th {
    background-color: var(--table-header-bg);
    color: var(--table-header-text);
    padding: 0.85em 0.5em 0.85em 1em;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 0.9em;
    letter-spacing: 0.1em;
    border-bottom: 1px solid #152b42;
    width: 60%;
}

.responsibility-table td,
.responsibility-table tbody th {
    padding: 0.6em 1em;
    color: var(--table-row-text);
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.responsibility-table tbody tr:nth-child(even) td,
.responsibility-table tbody tr:nth-child(even) th { background-color: var(--row-bg-even); }
.responsibility-table tbody tr:nth-child(odd) td,
.responsibility-table tbody tr:nth-child(odd) th { background-color: var(--row-bg-odd); }

.responsibility-table tbody th {
    font-weight: 700;
    color: var(--brand-blue);
    border-right: 2px solid var(--border-color);
}

/* Responsibility2 table */
.responsibility2-table {
    width: 100%;
    min-width: 10em;
    border-collapse: separate;
    border-spacing: 0;
}

.responsibility2-table thead th {
    background-color: var(--table-header-bg);
    color: var(--table-header-text);
    padding: 0.85em 1em;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 0.8em;
    letter-spacing: 0.1em;
    border-bottom: 2px solid #152b42;
    border-top: 1px solid #152b42;
    width: 25%;
    border-right: 2px solid #dadada;
}

.responsibility2-table td {
    padding: 0.6em 1em;
    color: var(--table-row-text);
    border-bottom: 1px solid #f7f7f7;
    text-align: center;
    font-variant-numeric: tabular-nums;
    border-right: 2px solid #dadada;
    font-size: 0.80em;
}

.responsibility2-table tbody tr:nth-child(even) td,
.responsibility2-table tbody tr:nth-child(even) th { background-color: var(--row-bg-even); }
.responsibility2-table tbody tr:nth-child(odd) td,
.responsibility2-table tbody tr:nth-child(odd) th { background-color: var(--row-bg-odd); }

.responsibility2-table tbody th {
    font-weight: 700;
    color: var(--brand-blue);
    border-right: 2px solid var(--border-color);
}

#header-col { background-color: var(--brand-blue); color: #ffffff; }
#header2-col { background-color: var(--brand-blue); color: #ffffff; text-align: left; margin-left: 20px; }
#last-col { border-right: 1px solid #152b42; }

.grid-header {
    background-color: var(--row-hover);
    color: var(--text-dark);
    padding: 10px 0;
    font-weight: 700;
}

/* Dark mode tables */
body.dark-mode .salary-table td,
body.dark-mode .salary-table tbody th,
body.dark-mode .responsibility-table td,
body.dark-mode .responsibility-table tbody th,
body.dark-mode .responsibility2-table td {
    color: var(--text-color);
    border-color: var(--border-color);
}

body.dark-mode .salary-table tbody tr:nth-child(even) td,
body.dark-mode .salary-table tbody tr:nth-child(even) th,
body.dark-mode .responsibility-table tbody tr:nth-child(even) td,
body.dark-mode .responsibility-table tbody tr:nth-child(even) th,
body.dark-mode .responsibility2-table tbody tr:nth-child(even) td {
    background-color: var(--row-bg-even);
}

body.dark-mode .salary-table tbody tr:nth-child(odd) td,
body.dark-mode .salary-table tbody tr:nth-child(odd) th,
body.dark-mode .responsibility-table tbody tr:nth-child(odd) td,
body.dark-mode .responsibility-table tbody tr:nth-child(odd) th,
body.dark-mode .responsibility2-table tbody tr:nth-child(odd) td {
    background-color: var(--row-bg-odd);
}

/* =================================================================
   8. FLOATING CONTROLS
   ================================================================= */
/* ── Floating Toolbar ── */
.floating-toolbar {
    position: fixed;
    bottom: var(--space-5);
    right: 20px;
    z-index: var(--z-controls);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 14px;
    padding: 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12), 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.06);
}

.tb-divider { width: 24px; height: 1px; background: #e2e8f0; margin: 2px 0; }

.tb-group { position: relative; }

.tb-btn {
    width: 38px; height: 38px;
    border-radius: 10px; border: none;
    background: transparent; color: #334155;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.15s;
    position: relative;
}
.tb-btn:hover { background: #f1f5f9; color: #1a365d; }
.tb-btn.active { background: #e0e7ff; color: #1a365d; }
.tb-btn svg { pointer-events: none; }

/* ── Flyout menus ── */
.tb-flyout {
    position: absolute;
    right: calc(100% + 10px); bottom: -8px; transform: scale(0.95);
    width: 220px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15), 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid #e5e7eb;
    opacity: 0; visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1200;
    overflow: hidden;
}
.tb-flyout.open { opacity: 1; visibility: visible; transform: scale(1); }
.tb-flyout-wide { width: 260px; }

.flyout-header {
    padding: 10px 14px 8px;
    font-size: 0.68em; font-weight: 700;
    color: #94a3b8; text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 1px solid #f1f5f9;
}

/* Flyout items (tools, export) */
.flyout-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 9px 14px;
    background: none; border: none;
    cursor: pointer; text-align: left;
    transition: background 0.15s;
    font-family: inherit; font-size: 0.85em;
    color: #334155; font-weight: 500;
}
.flyout-item:hover { background: #f1f5f9; }
.flyout-item:last-child { border-radius: 0 0 12px 12px; }
.flyout-item svg { flex-shrink: 0; color: #64748b; }

/* Export badges */
.flyout-badge {
    width: 32px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: #1a365d; color: #fff;
    border-radius: 6px; font-size: 0.65em; font-weight: 800;
    flex-shrink: 0; letter-spacing: -0.3px;
}
.flyout-item-text { display: flex; flex-direction: column; gap: 1px; }
.flyout-item-title { font-size: 0.88em; font-weight: 600; color: #1e293b; }
.flyout-item-desc { font-size: 0.72em; font-weight: 400; color: #94a3b8; }

/* ── Accessibility flyout sections ── */
.flyout-section {
    padding: 8px 14px;
    border-bottom: 1px solid #f1f5f9;
}
.flyout-section:last-child { border-bottom: none; }
.flyout-label { font-size: 0.72em; font-weight: 600; color: #64748b; margin-bottom: 6px; }

/* Toggle switches */
.flyout-toggle {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 0.82em; font-weight: 500; color: #334155; cursor: pointer;
}
.flyout-toggle input { display: none; }
.toggle-switch {
    width: 36px; height: 20px;
    background: #cbd5e1; border-radius: 10px;
    position: relative; transition: background 0.2s;
    flex-shrink: 0;
}
.toggle-switch::after {
    content: ''; position: absolute;
    width: 16px; height: 16px;
    background: #fff; border-radius: 50%;
    top: 2px; left: 2px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.flyout-toggle input:checked + .toggle-switch { background: #1a365d; }
.flyout-toggle input:checked + .toggle-switch::after { transform: translateX(16px); }

/* Text size controls */
.size-controls {
    display: flex; align-items: center; gap: 6px;
}
.size-btn {
    width: 32px; height: 28px;
    border: 1px solid #e2e8f0; border-radius: 6px;
    background: #f8fafc; color: #334155;
    font-size: 0.78em; font-weight: 700;
    cursor: pointer; transition: all 0.15s;
    display: flex; align-items: center; justify-content: center;
}
.size-btn:hover { background: #e2e8f0; }
.size-value { font-size: 0.75em; font-weight: 600; color: #64748b; min-width: 36px; text-align: center; }
.size-reset {
    font-size: 0.68em; font-weight: 600; color: #5a99b8;
    background: none; border: none; cursor: pointer;
    padding: 4px 6px;
}
.size-reset:hover { color: #1a365d; }

/* Font selector */
.flyout-select {
    width: 100%; padding: 6px 8px;
    border: 1px solid #e2e8f0; border-radius: 6px;
    background: #f8fafc; color: #334155;
    font-size: 0.78em; font-family: inherit;
    cursor: pointer;
}

/* ── Read Aloud Player Bar ── */
.readaloud-player {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 3500;
    background: linear-gradient(135deg, #022b4d 0%, #204164 100%);
    color: #fff;
    padding: 10px 20px;
    display: flex; align-items: center; gap: 12px;
    font-size: 0.85em;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
    border-top: 1px solid rgba(255,255,255,0.1);
}
.ra-btn {
    background: rgba(255,255,255,0.15); border: none; color: #fff;
    width: 30px; height: 30px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background 0.15s;
}
.ra-btn:hover { background: rgba(255,255,255,0.25); }
.ra-status { flex: 1; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ra-speed, .ra-voice {
    background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.2);
    color: #fff; border-radius: 4px; padding: 3px 6px;
    font-size: 0.9em; font-family: inherit;
}
.ra-speed option, .ra-voice option { color: #333; background: #fff; }
.ra-voice { max-width: 160px; }

/* Read aloud clause highlighting */
.clause-reading { background: rgba(90,153,184,0.12) !important; transition: background 0.3s; }

/* Article share button — visible on heading hover */
.article-share-btn { background: none; border: none; cursor: pointer; color: #94a3b8; padding: 2px 4px; margin-left: 6px; opacity: 0; transition: opacity 0.15s; vertical-align: middle; }
h2:hover .article-share-btn { opacity: 1; }
.article-share-btn:hover { color: #204164; }

/* ── Accessibility modes (applied to body) ── */
body.a11y-spacing .main-content,
body.a11y-spacing .main-content .clause-text,
body.a11y-spacing .main-content .clause-label,
body.a11y-spacing .main-content p,
body.a11y-spacing .main-content li { letter-spacing: 0.12em; line-height: 1.9 !important; word-spacing: 0.16em; }
body.a11y-spacing .clause-row { line-height: 1.9 !important; }

/* High Contrast — WCAG AAA level, maximum readability */
body.a11y-contrast .content,
body.a11y-contrast .main-content { background: #fff !important; color: #000 !important; }
body.a11y-contrast .sidebar { background: #fff !important; border-right: 2px solid #000 !important; }
body.a11y-contrast .sidebar-header { background: #fff !important; }
body.a11y-contrast .sidebar-brand-org { color: #000 !important; }
body.a11y-contrast .nav-article-header { color: #000 !important; border-left-color: transparent !important; }
body.a11y-contrast .nav-article-header.active-article { border-left-color: #000 !important; background: #ff0 !important; }
body.a11y-contrast .nav-num { color: #000 !important; }
body.a11y-contrast .nav-title { color: #000 !important; }
body.a11y-contrast .sidebar-tab { border-color: #000 !important; color: #000 !important; background: #fff !important; }
body.a11y-contrast .sidebar-tab.active { background: #000 !important; color: #fff !important; }
body.a11y-contrast .main-content .clause-row { color: #000 !important; background: #fff !important; border-bottom: 2px solid #000 !important; padding-bottom: 10px !important; }
body.a11y-contrast .main-content .clause-text { color: #000 !important; font-weight: 500 !important; font-size: 1.05em !important; }
body.a11y-contrast .main-content .clause-label { color: #000 !important; font-weight: 800 !important; }
body.a11y-contrast .main-content h1,
body.a11y-contrast .main-content h2,
body.a11y-contrast .main-content h3,
body.a11y-contrast .main-content h4 { color: #000 !important; text-decoration: underline !important; text-decoration-thickness: 2px !important; }
body.a11y-contrast .main-content a,
body.a11y-contrast .main-content .cross-ref-link { color: #00e !important; text-decoration: underline !important; font-weight: 700 !important; }
body.a11y-contrast .main-content .part-header { background: #000 !important; color: #ff0 !important; }
body.a11y-contrast .main-content .part-header h2,
body.a11y-contrast .main-content .part-header span { color: #ff0 !important; text-decoration: none !important; }
body.a11y-contrast .floating-toolbar { background: #fff !important; border: 2px solid #000 !important; }
body.a11y-contrast .tb-btn { color: #000 !important; }
body.a11y-contrast .an-card { border: 2px solid #000 !important; }
body.a11y-contrast * { border-radius: 0 !important; }

body.a11y-focus .clause-row { opacity: 0.25; transition: opacity 0.3s; }
body.a11y-focus .clause-row.in-view { opacity: 1; }

/* ── Shared Appearance: Fonts (data-font attribute) ── */
body[data-font="system"] { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important; }
body[data-font="inter"] { font-family: 'Inter', sans-serif !important; }
body[data-font="atkinson"] { font-family: 'Atkinson Hyperlegible', sans-serif !important; }
body[data-font="opendyslexic"] { font-family: 'OpenDyslexic', 'Comic Sans MS', cursive, sans-serif !important; }
body[data-font] *:not(.material-icons):not(.material-icons-outlined) { font-family: inherit !important; }

/* ── Shared Appearance: Line Spacing ── */
body[data-line-spacing] { line-height: var(--user-line-spacing) !important; }
body[data-line-spacing] p, body[data-line-spacing] li, body[data-line-spacing] td,
body[data-line-spacing] .clause-text, body[data-line-spacing] .clause-label { line-height: inherit !important; }

/* ── Shared Appearance: Word Spacing ── */
body[data-word-spacing] { word-spacing: var(--user-word-spacing) !important; }
body[data-word-spacing] p, body[data-word-spacing] li, body[data-word-spacing] td,
body[data-word-spacing] .clause-text { word-spacing: inherit !important; }

/* ── Appearance Controls: Dark Mode Toggle ── */
.dark-mode-toggle { position: relative; width: 56px; height: 30px; flex-shrink: 0; cursor: pointer; display: inline-block; }
.dark-mode-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.dark-mode-slider { position: absolute; inset: 0; background: #e2e8f0; border-radius: 99px; transition: background 0.25s; display: flex; align-items: center; justify-content: space-between; padding: 0 7px; }
.dark-mode-slider::after { content: ''; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.15); transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
.dark-mode-toggle input:checked + .dark-mode-slider { background: #334155; }
.dark-mode-toggle input:checked + .dark-mode-slider::after { transform: translateX(26px); background: #f39c12; }
.dark-mode-icon-sun { color: #f39c12; z-index: 1; font-size: 13px; }
.dark-mode-icon-moon { color: #94a3b8; z-index: 1; font-size: 13px; }
.dark-mode-toggle input:checked + .dark-mode-slider .dark-mode-icon-sun { color: #64748b; }
.dark-mode-toggle input:checked + .dark-mode-slider .dark-mode-icon-moon { color: #f39c12; }

/* ── Appearance Controls: Font Cards ── */
.settings-font-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.settings-font-btn { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1.5px solid #e2e8f0; border-radius: 8px; background: #fff; cursor: pointer; font-size: 0.75em; font-weight: 500; color: #475569; transition: all 0.15s; }
.settings-font-btn span:first-child { font-size: 1.2em; font-weight: 700; color: #204164; width: 24px; text-align: center; }
.settings-font-btn:hover { border-color: #204164; background: rgba(32,65,100,0.03); }
.settings-font-btn.active { border-color: #204164; background: rgba(32,65,100,0.06); font-weight: 700; color: #204164; box-shadow: 0 0 0 1px #204164; }
body.dark-mode .settings-font-btn { background: #1e293b; border-color: #2d3a4a; color: #e2e8f0; }
body.dark-mode .settings-font-btn span:first-child { color: #4a90d9; }
body.dark-mode .settings-font-btn.active { border-color: #4a90d9; background: rgba(74,144,217,0.1); color: #4a90d9; box-shadow: 0 0 0 1px #4a90d9; }

/* ── Appearance Controls: Sliders ── */
.settings-slider { width: 100%; height: 6px; -webkit-appearance: none; appearance: none; background: #e2e8f0; border-radius: 99px; outline: none; cursor: pointer; }
.settings-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #204164; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.2); cursor: pointer; transition: transform 0.1s; }
.settings-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.settings-slider::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #204164; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.2); cursor: pointer; }
body.dark-mode .settings-slider { background: #2d3a4a; }
body.dark-mode .settings-slider::-webkit-slider-thumb { background: #4a90d9; border-color: #1a2332; }
body.dark-mode .settings-slider::-moz-range-thumb { background: #4a90d9; border-color: #1a2332; }

/* ── Appearance Controls: Misc ── */
.settings-slider-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.settings-slider-label { font-size: 0.72em; font-weight: 600; color: #475569; flex: 1; }
.settings-slider-value { font-size: 0.72em; font-weight: 700; color: #204164; min-width: 32px; text-align: right; }
body.dark-mode .settings-slider-label { color: #94a3b8; }
body.dark-mode .settings-slider-value { color: #4a90d9; }
.flyout-actions { display: flex; gap: 6px; padding: 8px 14px; border-top: 1px solid #f1f5f9; }
.flyout-btn-save { flex: 1; padding: 7px 0; background: linear-gradient(135deg, #022b4d, #204164); color: #fff; border: none; border-radius: 8px; font-size: 0.75em; font-weight: 700; cursor: pointer; transition: all 0.15s; }
.flyout-btn-save:hover { box-shadow: 0 2px 8px rgba(32,65,100,0.3); }
.flyout-btn-reset { padding: 7px 10px; background: none; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 0.75em; font-weight: 600; color: #64748b; cursor: pointer; }
.flyout-btn-reset:hover { background: #f1f5f9; }
body.dark-mode .flyout-actions { border-top-color: #334155; }
body.dark-mode .flyout-btn-save { background: linear-gradient(135deg, #1e3a5f, #4a90d9); }
body.dark-mode .flyout-btn-reset { border-color: #475569; color: #94a3b8; }
body.dark-mode .flyout-btn-reset:hover { background: #334155; }
.flyout-divider-label { padding: 10px 14px 4px; font-size: 0.6em; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.8px; border-top: 1px solid #f1f5f9; }
body.dark-mode .flyout-divider-label { border-top-color: #334155; color: #64748b; }

/* ── Dark mode toolbar ── */
body.dark-mode .floating-toolbar {
    background: rgba(30,41,59,0.92);
    border-color: rgba(255,255,255,0.08);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
body.dark-mode .tb-divider { background: #334155; }
body.dark-mode .tb-btn { color: #94a3b8; }
body.dark-mode .tb-btn:hover { background: #334155; color: #e2e8f0; }
body.dark-mode .tb-btn.active { background: #334155; color: #93c5fd; }

body.dark-mode .tb-flyout { background: #1e293b; border-color: #334155; box-shadow: 0 8px 32px rgba(0,0,0,0.5); }
body.dark-mode .flyout-header { color: #64748b; border-color: #334155; }
body.dark-mode .flyout-item { color: #e2e8f0; }
body.dark-mode .flyout-item:hover { background: #334155; }
body.dark-mode .flyout-item svg { color: #94a3b8; }
body.dark-mode .flyout-badge { background: #334155; }
body.dark-mode .flyout-item-title { color: #e2e8f0; }
body.dark-mode .flyout-item-desc { color: #64748b; }
body.dark-mode .flyout-section { border-color: #334155; }
body.dark-mode .flyout-toggle { color: #e2e8f0; }
body.dark-mode .toggle-switch { background: #475569; }
body.dark-mode .size-btn { background: #334155; border-color: #475569; color: #e2e8f0; }
body.dark-mode .flyout-select { background: #334155; border-color: #475569; color: #e2e8f0; }
body.dark-mode .flyout-label { color: #94a3b8; }
body.dark-mode .size-value { color: #94a3b8; }

body.dark-mode .readaloud-player { background: #0f172a; }

/* Page controls (legacy) */
.page-controls {
    position: fixed;
    top: var(--space-5);
    right: 25px;
    z-index: 1100;
    display: flex;
    gap: 10px;
}

.control-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    background-color: var(--brand-blue);
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.control-btn:hover {
    background-color: var(--brand-accent);
    transform: scale(1.1);
}

/* =================================================================
   9. HAMBURGER MENU
   ================================================================= */
.hamburger-menu {
    display: none;
    position: fixed;
    top: 18px;
    left: 10px;
    z-index: var(--z-hamburger);
    width: 35px;
    height: 35px;
    background-color: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--space-1);
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s;
}

.hamburger-menu span {
    display: block;
    width: 20px;
    height: 2px;
    background-color: white;
    border-radius: 2px;
    transition: all 0.3s ease-in-out;
}

.hamburger-menu:active {
    transform: scale(0.95);
}

body.dark-mode .hamburger-menu {
    border-color: #444;
}

/* Overlay */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* =================================================================
   10. NOTEBOOK PANEL
   ================================================================= */
.notebook-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100vh;
    background-color: var(--bg-color);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    z-index: var(--z-notebook);
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-color);
    color: var(--text-color);
}

.notebook-panel.open {
    transform: translateX(0);
}

.notebook-header {
    padding: 18px 20px 14px;
    background-color: var(--brand-blue);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.notebook-header h2 {
    margin: 0;
    font-family: 'Newsreader', Georgia, serif;
    font-style: italic;
    font-size: 1.35em;
    font-weight: 600;
    color: white !important;
    letter-spacing: 0.3px;
}

.close-panel-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 1.8em;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s;
}
.close-panel-btn:hover { color: #fff; }

/* Toolbar */
.notebook-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background-color: var(--row-bg-even);
    border-bottom: 1px solid var(--border-color);
    gap: var(--space-2);
}

.notebook-toolbar-row-2 {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-2);
    padding-top: var(--space-2);
    border-top: 1px dashed #e0e0e0;
    font-size: 0.9em;
    min-height: 32px;
    gap: 10px;
    flex-wrap: wrap;
}

.notebook-stats {
    flex-shrink: 0;
    font-weight: 700;
    font-size: 0.9em;
    color: var(--text-color);
    margin-right: 10px;
    white-space: nowrap;
}

.notebook-stats,
.view-controls,
.bulk-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Notebook search */
.notebook-search-bar {
    padding: 10px var(--space-5);
    background-color: var(--row-bg-even);
    border-bottom: 1px solid var(--border-color);
}

#notebook-search-input {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: 'Inter', 'Open Sans', sans-serif;
    font-size: 0.95em;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#notebook-search-input:focus {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 2px rgba(90, 153, 184, 0.2);
}

body.dark-mode .notebook-search-bar { background-color: var(--sidebar-bg); }
body.dark-mode #notebook-search-input { background-color: #333; border-color: #555; color: white; }
body.dark-mode #notebook-search-input:focus { border-color: var(--brand-accent); }

/* Search toggle */
.search-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: var(--font-lg);
    margin-left: var(--space-3);
    padding: var(--space-1) var(--space-2);
    border-radius: 4px;
    transition: all 0.2s ease;
    vertical-align: middle;
    color: var(--text-color);
}

.search-toggle-btn:hover { background-color: rgba(0, 0, 0, 0.05); transform: scale(1.1); }
.search-toggle-btn.active { background-color: var(--brand-accent); color: white; }

#notebook-search-container {
    transition: all 0.3s ease;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--row-bg-odd);
}

body.dark-mode .search-toggle-btn:hover { background-color: rgba(255, 255, 255, 0.1); }
body.dark-mode .search-toggle-btn { color: var(--text-color); }

/* Layer controls */
.layer-controls-inline {
    display: flex;
    gap: 15px;
    align-items: center;
}

.select-all-wrap {
    display: none;
    align-items: center;
    gap: 5px;
    color: var(--text-color);
}

.select-all-wrap.visible { display: flex; }

.sort-wrap { margin-left: 0; }

.sort-select {
    padding: 2px 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--text-color);
    background-color: var(--bg-color);
    cursor: pointer;
}

body.dark-mode .sort-select { background-color: #333; border-color: #555; color: #fff; }

/* Bulk actions */
.bulk-actions {
    flex-grow: 1;
    justify-content: flex-end;
    gap: var(--space-1);
}

.bulk-btn {
    width: 28px;
    min-width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background-color: white;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s ease;
}

.bulk-btn svg { width: 16px; height: 16px; stroke: currentColor; display: block; }
.bulk-btn span { display: none; }

.bulk-btn:hover:not(:disabled) {
    background-color: var(--row-hover);
    color: var(--brand-blue);
    border-color: var(--brand-accent);
}

.bulk-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f9f9f9;
}

.bulk-btn.delete {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--danger);
    border-color: #ef9a9a;
    white-space: nowrap;
}

.bulk-btn.delete:hover:not(:disabled) {
    background-color: var(--warning-bg);
    border-color: var(--danger);
    color: var(--danger-hover);
}

.bulk-btn.drive { display: flex; align-items: center; gap: 5px; }

.bulk-btn.import:hover {
    background-color: #f0fdf4;
    border-color: #16a34a;
    color: #15803d;
}

body.dark-mode .bulk-btn.import:hover {
    background-color: var(--sidebar-bg);
    border-color: var(--success);
    color: var(--success);
}

body.dark-mode .bulk-btn {
    background-color: #333;
    border-color: #555;
    color: #ccc;
}

body.dark-mode .bulk-btn:hover:not(:disabled) {
    background-color: #444;
    color: #fff;
}

body.dark-mode .bulk-btn.delete { color: #ff8a80; border-color: #e57373; }

/* Google Drive Picker z-index */
.picker-dialog-bg { z-index: 3000 !important; }
.picker-dialog { z-index: 3001 !important; }

/* Resize handle */
.notebook-resizer {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 10px;
    cursor: ew-resize;
    z-index: 2600;
    background: transparent;
    transition: background-color 0.2s;
}

.notebook-resizer:hover,
.notebook-resizer.resizing {
    background-color: rgba(90, 153, 184, 0.5);
    border-left: 1px solid var(--brand-accent);
}

/* Select all row */
.notebook-select-all-container {
    padding: 10px var(--space-5);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9em;
    color: var(--text-color);
}

/* Notebook list */
.notebook-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: var(--space-5);
}

/* Table view */
.notebook-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-sm);
    background: white;
    table-layout: fixed;
}

.notebook-table th {
    text-align: left;
    padding: var(--space-2) var(--space-1);
    background-color: var(--row-bg-even);
    border-bottom: 2px solid #ddd;
    color: var(--heading-color);
}

.notebook-table td {
    padding: var(--space-2) var(--space-1);
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
    word-wrap: break-word;
}

.notebook-table th:first-child,
.notebook-table td:first-child { width: 25px; text-align: center; }

.notebook-table th:nth-child(2),
.notebook-table td:nth-child(2) { width: 30%; }

.notebook-table th:last-child,
.notebook-table td:last-child { width: 60px; text-align: right; }

.notebook-table tr:hover { background-color: #f9f9f9; }

.notebook-table .clickable-article-label { font-weight: 700; }

.tbl-content {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    max-width: 100%;
    color: var(--text-light);
    line-height: 1.3;
}

.tbl-actions { display: flex; gap: var(--space-1); justify-content: flex-end; }

.mini-btn {
    padding: 2px var(--space-1);
    font-size: 0.8em;
    cursor: pointer;
    background: none;
    border: 1px solid #ccc;
    border-radius: 3px;
    color: var(--text-color);
}

.mini-btn:hover {
    background-color: var(--brand-accent);
    color: white;
    border-color: var(--brand-accent);
}

/* View controls */
.view-controls {
    display: flex;
    gap: 5px;
    background: #e0e0e0;
    padding: 3px;
    border-radius: 4px;
}

.view-btn {
    padding: var(--space-1) var(--space-2);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 3px;
    color: var(--text-light);
    display: flex;
    align-items: center;
}

.view-btn:hover { background-color: rgba(255, 255, 255, 0.5); }

.view-btn.active {
    background-color: white;
    color: var(--brand-blue);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Group header */
.group-header {
    background-color: var(--row-bg-even);
    padding: var(--space-2) 10px;
    margin: 15px 0 10px 0;
    border-left: 4px solid var(--brand-accent);
    font-weight: 700;
    color: var(--brand-blue);
    border-radius: 0 4px 4px 0;
    font-size: 0.95em;
}

/* Note card */
.note-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    gap: 10px;
}

.note-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.note-card-checkbox { margin-top: 5px; }
.note-card-content { flex-grow: 1; min-width: 0; }

.note-card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-2);
    font-weight: 700;
    font-size: 0.95em;
    color: var(--brand-accent);
}

.note-card-body {
    font-size: 0.9em;
    color: var(--text-color);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 10px;
}

.note-card-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.note-card-footer.grouped {
    justify-content: flex-end;
    padding-top: 10px;
    margin-top: 5px;
    border-top: 1px solid #f0f0f0;
}

.card-action-btn {
    background: none;
    border: none;
    font-size: var(--font-sm);
    cursor: pointer;
    color: var(--text-muted);
    text-decoration: underline;
    padding: 0;
}

.card-action-btn:hover { color: var(--brand-blue); }
.card-action-btn.delete { color: var(--danger); }

.clickable-article-label {
    cursor: pointer;
    color: var(--brand-blue);
    transition: color 0.2s;
}

.clickable-article-label:hover {
    color: var(--brand-accent);
    text-decoration: underline;
}

/* Note date */
.note-date {
    font-size: var(--font-xs);
    color: #999;
    margin-right: auto;
    font-weight: 500;
}

.tbl-date {
    display: block;
    font-size: var(--font-xs);
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: normal;
}

/* Note group (condensed) */
.note-group-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    overflow: hidden;
}

.note-group-row {
    display: flex;
    align-items: center;
    padding: var(--space-2) 10px;
    border-bottom: 1px solid var(--border-light);
    background-color: #fff;
    transition: background-color 0.2s;
    cursor: pointer;
}

.note-group-row:last-child { border-bottom: none; }
.note-group-row:hover { background-color: #f9f9f9; }

.note-group-check { margin-right: 10px; display: flex; align-items: center; }
.note-group-info { flex-grow: 1; overflow: hidden; font-size: 0.9em; }
.note-group-date { font-size: var(--font-sm); color: #999; margin-bottom: 2px; display: block; }
.note-group-snippet {
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    line-height: 1.3;
}

/* Selection count */
.selection-count {
    color: #888;
    font-size: var(--font-sm);
    margin-left: 6px;
    font-style: italic;
    font-weight: normal;
}

body.dark-mode .selection-count { color: var(--text-muted); }

/* Dark mode notebook */
body.dark-mode .notebook-toolbar { background-color: var(--sidebar-bg); }
body.dark-mode .card-action-btn { color: var(--text-muted); }
body.dark-mode .card-action-btn.delete { color: #ff8a80; }

body.dark-mode .note-card {
    background-color: #1e293b;
    border: 1px solid #334155;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

body.dark-mode .note-group-row {
    background-color: #1e293b;
    border-bottom: 1px solid #334155;
    color: #cbd5e1;
}

body.dark-mode .note-group-row:hover { background-color: #334155; }
body.dark-mode .note-group-snippet { color: #e2e8f0; }
body.dark-mode .note-group-date { color: #94a3b8; }
body.dark-mode .clickable-article-label { color: #38bdf8; }

body.dark-mode .card-action-btn { color: #94a3b8; }
body.dark-mode .card-action-btn:hover { color: #ffffff; }

body.dark-mode .note-card.office-note {
    background-color: var(--brand-blue);
    border-left: 4px solid #38bdf8;
}

body.dark-mode .note-card.office-note .note-group-row { background-color: #0f172a; }

body.dark-mode #notebook-list { background-color: var(--sidebar-bg); }

#user-name {
    font-size: 0.8em;
    font-weight: bold;
    color: var(--brand-blue);
}

body.dark-mode #user-name { color: #38bdf8; }

/* Notebook sign-in prompt — animated gradient background */
.notebook-signin-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    text-align: center;
    flex-grow: 1;
    background: linear-gradient(-45deg, #e8ecf4, #dce4f0, #e0eaf5, #f0e8ef, #e5ecf5, #dae3f0);
    background-size: 400% 400%;
    animation: nb-gradient-shift 15s ease infinite;
    overflow: hidden;
    position: relative;
}
.notebook-signin-prompt.hidden { display: none; }

@keyframes nb-gradient-shift {
    0% { background-position: 0% 50%; }
    25% { background-position: 100% 0%; }
    50% { background-position: 100% 100%; }
    75% { background-position: 0% 100%; }
    100% { background-position: 0% 50%; }
}


.nb-login-card {
    width: 100%;
    max-width: 300px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(32,65,100,0.12), 0 1px 4px rgba(0,0,0,0.06);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.nb-login-header {
    background: linear-gradient(135deg, #1a365d 0%, #2a4a7f 100%);
    padding: 14px 16px 12px;
    text-align: center;
}
.nb-login-logo { height: 28px; margin-bottom: 6px; opacity: 0.95; }
.nb-login-title {
    color: #fff; font-size: 0.9em; font-weight: 700;
    margin: 0 0 2px; letter-spacing: 0.3px;
}
.nb-login-subtitle {
    color: #93c5fd; font-size: 0.68em; font-weight: 500; margin: 0;
}

.nb-login-body { padding: 14px 16px 12px; }

/* Error */
.nb-auth-error {
    display: none; padding: 8px 10px; border-radius: 6px; font-size: 0.78em;
    margin-bottom: 10px; background: #fff5f5; color: #c53030;
    border: 1px solid #fed7d7; border-left: 3px solid #e53e3e; text-align: left;
}

/* Loader */
.nb-auth-loader { display: none; text-align: center; padding: 10px; }
.nb-spinner {
    display: inline-block; width: 18px; height: 18px;
    border: 2px solid #e2e8f0; border-top-color: #204164;
    border-radius: 50%; animation: spin 0.8s linear infinite;
}

/* Google button */
.nb-btn-google {
    display: flex; align-items: center; justify-content: center;
    width: 100%; padding: 9px 12px; background: #fff;
    border: 1.5px solid #dadce0; border-radius: 7px;
    font-size: 0.82em; font-weight: 600; color: #3c4043;
    cursor: pointer; transition: all 0.2s;
}
.nb-btn-google:hover { background: #f8f9fa; border-color: #c6c9cc; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

/* Divider */
.nb-divider {
    display: flex; align-items: center; margin: 10px 0;
    color: var(--text-muted); font-size: 0.65em; text-transform: uppercase;
    letter-spacing: 0.5px; font-weight: 600;
}
.nb-divider::before, .nb-divider::after {
    content: ''; flex: 1; height: 1px; background: #e5e7eb;
}
.nb-divider span { padding: 0 8px; white-space: nowrap; }

/* Form */
.nb-form { width: 100%; }
.nb-field-label {
    display: block; font-size: 0.7em; font-weight: 600;
    color: #4a5568; margin-bottom: 3px; text-align: left;
}
.nb-input {
    width: 100%; padding: 7px 10px; border: 1px solid #e2e8f0;
    border-radius: 6px; font-size: 0.85em; margin-bottom: 8px;
    background: #f8fafc; color: var(--text-color); box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.nb-input:focus { outline: none; border-color: #5a99b8; box-shadow: 0 0 0 3px rgba(90,153,184,0.15); background: #fff; }
.nb-input::placeholder { color: #a0aec0; }

/* Sign In button */
.nb-btn-signin {
    width: 100%; padding: 9px; background: #1a365d; color: #fff;
    border: none; border-radius: 7px; font-size: 0.85em; font-weight: 700;
    cursor: pointer; transition: background 0.2s; margin-bottom: 3px;
}
.nb-btn-signin:hover { background: #2a4a7f; }

/* Forgot link */
.nb-forgot-link {
    display: block; text-align: right; font-size: 0.68em;
    color: #5a99b8; text-decoration: none; font-weight: 600;
    margin-bottom: 10px;
}
.nb-forgot-link:hover { color: #204164; }

/* Activate button */
.nb-btn-activate {
    width: 100%; padding: 7px; background: none;
    border: 1.5px solid #1a365d; color: #1a365d;
    border-radius: 8px; font-size: 0.78em; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
}
.nb-btn-activate:hover { background: #1a365d; color: #fff; }

/* Secured */
.nb-secured {
    margin: 14px 0 0; font-size: 0.65em; color: #a0aec0;
    display: flex; align-items: center; justify-content: center; gap: 4px;
}
.nb-secured::before { content: '\1F512'; font-size: 0.9em; }

/* Dark mode */
body.dark-mode .notebook-signin-prompt {
    background: linear-gradient(-45deg, #0f172a, #1a2744, #162035, #1e1a2e, #152240, #0f172a);
    background-size: 400% 400%;
    animation: nb-gradient-shift 15s ease infinite;
}
body.dark-mode .nb-login-card { background: #1e293b; }
body.dark-mode .nb-login-body { background: #1e293b; }
body.dark-mode .nb-btn-google { background: #2d3748; border-color: #4a5568; color: #e2e8f0; }
body.dark-mode .nb-btn-google:hover { background: #374151; }
body.dark-mode .nb-input { background: #2d3748; border-color: #4a5568; color: #e2e8f0; }
body.dark-mode .nb-input:focus { background: #374151; }
body.dark-mode .nb-field-label { color: #94a3b8; }
body.dark-mode .nb-btn-activate { border-color: #5a99b8; color: #5a99b8; }
body.dark-mode .nb-btn-activate:hover { background: #5a99b8; color: #0f172a; }
body.dark-mode .nb-divider::before, body.dark-mode .nb-divider::after { background: #374151; }

/* Notebook panel subtle distinction */
.notebook-panel {
    background-color: #f5f3f3 !important;
}
body.dark-mode .notebook-panel {
    background-color: #1a1a1a !important;
}

/* Notebook list scrollable */
.notebook-list {
    background-color: transparent;
    overflow-y: auto;
}

/* Notebook sticky footer */
.notebook-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: var(--brand-blue);
    flex-shrink: 0;
}
.nb-footer-btn {
    display: flex; align-items: center; gap: 5px;
    padding: 7px 14px; background: rgba(255,255,255,0.12);
    border: none; border-radius: 6px;
    font-size: 0.75em; font-weight: 600; color: rgba(255,255,255,0.85);
    cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.nb-footer-btn:hover { background: rgba(255,255,255,0.22); color: #fff; }
.nb-footer-spacer { flex: 1; }
.nb-footer-expand {
    padding: 7px 8px; color: rgba(255,255,255,0.6);
}
.nb-footer-expand:hover { color: #fff; }
body.dark-mode .notebook-footer { background: #0f172a; }
body.dark-mode .nb-footer-btn { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.6); }
body.dark-mode .nb-footer-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }

/* Maggie button in toolbar — default state (not authenticated) */
.tb-btn-maggie {
    color: #94a3b8 !important;
}
.tb-btn-maggie:hover {
    color: #204164 !important;
}

/* Maggie button — authenticated state */
.tb-btn-maggie.tb-btn-maggie-auth {
    background: linear-gradient(135deg, #204164 0%, #5a99b8 100%) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(32,65,100,0.3);
}
.tb-btn-maggie.tb-btn-maggie-auth:hover {
    box-shadow: 0 4px 12px rgba(32,65,100,0.4) !important;
    transform: scale(1.05);
}

/* ── Maggie AI — df-messenger chat panel ── */
df-messenger {
    --df-messenger-chat-bubble-size: 0px;
    --df-messenger-font-color: #1b1c1c;
    --df-messenger-font-family: 'Inter', 'Open Sans', sans-serif;
    --df-messenger-chat-background: #fbf9f8;
    --df-messenger-message-user-background: #d3e3fd;
    --df-messenger-message-bot-background: #ffffff;
    --df-messenger-chat-bubble-background: #204164;
    --df-messenger-chat-bubble-icon-color: #ffffff;
    --df-messenger-chat-bubble-border: 2px solid #5a99b8;
    --df-messenger-chat-window-height: 480px;
    z-index: 9999;
    position: fixed;
    bottom: 0;
    right: 0;
}
body.dark-mode df-messenger {
    --df-messenger-font-color: #e2e8f0;
    --df-messenger-chat-background: #1e293b;
    --df-messenger-message-user-background: #334155;
    --df-messenger-message-bot-background: #0f172a;
}

body.dark-mode .signin-prompt-title { color: #f1f5f9; }
body.dark-mode .signin-prompt-text { color: #94a3b8; }
body.dark-mode .signin-prompt-btn { background-color: var(--brand-accent); color: #000; }
body.dark-mode .signin-prompt-btn:hover { background-color: #38bdf8; }

/* =================================================================
   11. MODALS
   ================================================================= */

/* Note modal overlay */
.note-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(32, 65, 100, 0.5);
    z-index: var(--z-controls);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(6px);
}

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

/* Note modal */
.note-modal {
    background-color: #fff;
    color: var(--text-color);
    width: 90%;
    max-width: 480px;
    padding: 0;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(15, 31, 51, 0.2);
    font-family: 'Inter', 'Open Sans', sans-serif;
    position: relative;
    animation: modalSlideUp 0.3s ease-out;
    border: none;
    overflow: hidden;
}

body.dark-mode .note-modal {
    background-color: #1e293b;
    color: #e2e8f0;
    border: none;
}

.note-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: linear-gradient(135deg, #022b4d 0%, #204164 100%);
    color: #fff;
    border-bottom: none;
    margin-bottom: 0;
}

.note-modal-title {
    font-weight: 700;
    font-size: var(--font-md);
    color: #fff;
}

body.dark-mode .note-modal-title { color: #fff; }

.note-modal-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    color: #fff;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.15s;
}

.note-modal-close:hover { background: rgba(255, 255, 255, 0.25); color: #fff; }
body.dark-mode .note-modal-close { color: #fff; background: rgba(255, 255, 255, 0.15); }
body.dark-mode .note-modal-close:hover { color: #fff; background: rgba(255, 255, 255, 0.25); }

.note-modal-body { padding: 20px; }

.note-modal textarea {
    width: 100%;
    height: 150px;
    border: 1px solid #e2e8f0;
    background-color: #f8fafc;
    padding: 12px;
    font-family: inherit;
    font-size: 1em;
    resize: none;
    margin-bottom: 15px;
    border-radius: 10px;
    transition: border-color 0.15s;
}

.note-modal textarea:focus {
    outline: none;
    border-color: #204164;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(32, 65, 100, 0.1);
}

body.dark-mode .note-modal textarea {
    color: #000000 !important;
    background-color: #ffffff;
    border-color: #ccc !important;
}

body.dark-mode .note-modal textarea::placeholder {
    color: #666666 !important;
}

.note-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-note-save {
    background: linear-gradient(135deg, #022b4d, #204164);
    color: white;
    border: none;
    padding: var(--space-2) var(--space-4);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(32, 65, 100, 0.2);
}

.btn-note-save:hover { background-color: var(--brand-accent); }

.btn-note-delete {
    background-color: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: var(--space-2) var(--space-4);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.btn-note-delete:hover { background-color: var(--warning-bg); }

body.dark-mode .btn-note-delete:hover { background-color: #333; }

body.dark-mode .btn-note-delete:disabled {
    border-color: #444;
    color: #666;
    background-color: transparent;
    opacity: 0.5;
}

/* Office mode modal */
.note-modal.office-mode {
    border: 2px solid var(--note-office);
    background-color: var(--note-office-bg);
}

body.dark-mode .note-modal.office-mode {
    background-color: var(--sidebar-bg);
    border-color: var(--note-office-border);
}

/* Layer switcher */
.layer-switcher {
    display: flex;
    background: #e0e0e0;
    border-radius: 6px;
    padding: var(--space-1);
    margin-bottom: 15px;
}

.layer-switcher input { display: none; }

.switch-btn {
    flex: 1;
    text-align: center;
    padding: 10px;
    cursor: pointer;
    border-radius: 4px;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.2s ease;
    user-select: none;
}

#layer-personal:checked + .switch-btn {
    background-color: #fff;
    color: #b45309;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

#layer-office:checked + .switch-btn {
    background-color: var(--brand-blue);
    color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

#layer-admin:checked + .switch-btn-admin {
    background-color: #dc2626;
    color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

body.dark-mode .layer-switcher { background-color: #333; }
body.dark-mode .switch-btn { color: var(--text-muted); }
body.dark-mode #layer-personal:checked + .switch-btn { background-color: #f59e0b; color: #000; }
body.dark-mode #layer-office:checked + .switch-btn { background-color: var(--brand-accent); color: #000; }
body.dark-mode #layer-admin:checked + .switch-btn-admin { background-color: #f87171; color: #000; }

body.dark-mode #note-layer-select {
    background-color: #ffffff;
    color: #000000;
}

/* Article notes overlay */
#article-notes-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(32, 65, 100, 0.5);
    backdrop-filter: blur(6px);
    z-index: 3500;
    justify-content: center;
    align-items: center;
}

#article-notes-overlay.active { display: flex; }

/* =================================================================
   ARTICLE NOTES OVERLAY — Card-based redesign
   ================================================================= */

#article-notes-overlay .article-notes-modal {
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
    z-index: 3501;
}

.article-notes-modal {
    background-color: var(--bg-color);
    color: var(--text-color);
    width: 92%;
    max-width: 680px;
    height: 85vh;
    max-height: 750px;
    padding: 0;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(15, 31, 51, 0.2);
    font-family: 'Inter', 'Open Sans', sans-serif;
    position: relative;
    animation: modalSlideUp 0.3s ease-out;
    border: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- Header --- */
.article-notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.article-notes-header-left {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
}

#article-notes-title {
    font-weight: 700;
    font-size: 1.05em;
    color: var(--heading-color);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.article-notes-count {
    font-size: 0.8em;
    color: var(--text-muted, #888);
    font-weight: 500;
    white-space: nowrap;
}

/* --- Toolbar --- */
.article-notes-toolbar {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background-color: var(--row-bg-even);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    gap: 10px;
    flex-wrap: wrap;
}

/* Buttons */
.an-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.82em;
    font-weight: 600;
    font-family: 'Inter', 'Open Sans', sans-serif;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    background: #fff;
    color: var(--text-color);
}

.an-btn:hover { background: #f1f5f9; }

.an-btn-primary {
    background: linear-gradient(135deg, #022b4d, #204164);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 6px rgba(32, 65, 100, 0.2);
}
.an-btn-primary:hover { background: linear-gradient(135deg, #011d36, #183352); box-shadow: 0 4px 12px rgba(32, 65, 100, 0.3); }

.an-btn-danger {
    color: #dc2626;
    border-color: #fca5a5;
    background: #fff5f5;
}
.an-btn-danger:hover { background: #fee2e2; }
.an-btn-danger:disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Filter toggles */
.an-filter-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.an-filter-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8em;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    user-select: none;
}

.an-filter-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
    cursor: pointer;
}

.an-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.an-dot-personal { background: #e6a23c; }
.an-dot-office { background: #204164; }
.an-dot-admin { background: #dc2626; }

/* Search */
.an-search-wrap {
    flex: 1;
    min-width: 120px;
    position: relative;
}

.an-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.4;
    pointer-events: none;
}

#article-notes-search {
    width: 100%;
    padding: 6px 10px 6px 30px;
    border-radius: 7px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 0.85em;
    font-family: 'Inter', 'Open Sans', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

#article-notes-search:focus {
    border-color: var(--primary, #204164);
}

/* Bulk actions */
.an-bulk-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.an-select-all-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78em;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}

.an-select-all-label input { margin: 0; cursor: pointer; }

/* --- Note Cards Container --- */
.article-notes-cards {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.article-notes-cards::-webkit-scrollbar { width: 6px; }
.article-notes-cards::-webkit-scrollbar-track { background: transparent; }
.article-notes-cards::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }

/* --- Individual Note Card --- */
.an-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    position: relative;
    box-shadow: 0 1px 4px rgba(32, 65, 100, 0.03);
}

.an-card:hover {
    border-color: var(--primary, #204164);
    box-shadow: 0 2px 12px rgba(32, 65, 100, 0.06);
}

.an-card-office {
    border-left: 3px solid #204164;
}

.an-card-admin {
    border-left: 3px solid #dc2626;
}

.an-card-pinned {
    background: rgba(230, 162, 60, 0.04);
}

/* Card top row (meta) */
.an-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.an-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.an-card-check {
    width: 15px;
    height: 15px;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.an-card-date {
    font-size: 0.78em;
    color: var(--text-muted, #888);
    font-weight: 500;
}

.an-author {
    font-size: 0.75em;
    color: var(--text-muted, #888);
    font-style: italic;
}

/* Badges */
.an-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 4px;
    font-size: 0.68em;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.an-badge-office {
    background: rgba(32, 65, 100, 0.1);
    color: #204164;
}

.an-badge-admin {
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

.an-pin {
    color: var(--tag-important, #e6a23c);
    font-size: 0.9em;
}

.an-spot-badge {
    font-size: 0.8em;
}

/* Spot quote in card */
.an-spot-quote {
    border-left: 3px solid var(--note-personal, #e6a23c);
    padding: 5px 10px;
    margin: 0 0 6px 0;
    font-style: italic;
    font-size: 0.8em;
    color: var(--text-muted, #666);
    background: rgba(230, 162, 60, 0.05);
    border-radius: 0 4px 4px 0;
    line-height: 1.4;
    max-height: 52px;
    overflow: hidden;
}

/* Card body (note content) */
.an-card-body {
    font-size: 0.9em;
    line-height: 1.5;
    color: var(--text-color);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

/* Tags in card */
.an-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.an-card-tags .tag-pill {
    font-size: 0.72em;
    padding: 2px 8px;
}

/* Empty state */
.an-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.an-empty-icon {
    font-size: 2.5em;
    opacity: 0.3;
    margin-bottom: 12px;
}

.an-empty p {
    color: var(--text-muted, #888);
    margin: 0 0 16px 0;
    font-size: 0.95em;
}

/* --- Dark Mode --- */
body.dark-mode .article-notes-toolbar {
    background-color: var(--sidebar-bg);
    border-bottom: 1px solid #333;
}

body.dark-mode #article-notes-search {
    background-color: #2d2d2d;
    color: #fff;
    border: 1px solid #555;
}

body.dark-mode #article-notes-search::placeholder { color: var(--text-muted); }

body.dark-mode .an-card {
    background: var(--bg-color);
    border-color: #333;
}

body.dark-mode .an-card:hover {
    border-color: #5a99b8;
    box-shadow: 0 2px 8px rgba(90, 153, 184, 0.1);
}

body.dark-mode .an-badge-office {
    background: rgba(90, 153, 184, 0.15);
    color: #5a99b8;
}

body.dark-mode .an-badge-admin {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

body.dark-mode .an-btn {
    background: var(--bg-color);
    color: var(--text-color);
    border-color: #444;
}

body.dark-mode .an-btn:hover { background: rgba(255,255,255,0.05); }

body.dark-mode .an-btn-primary {
    background: #2d5a82;
    border-color: #2d5a82;
    color: #fff;
}

body.dark-mode .an-btn-danger {
    background: rgba(220, 38, 38, 0.1);
    border-color: #7f1d1d;
    color: #f87171;
}

body.dark-mode .an-dot-office { background: #5a99b8; }
body.dark-mode .an-dot-admin { background: #f87171; }

body.dark-mode .an-spot-quote {
    background: rgba(230, 162, 60, 0.06);
    color: var(--text-muted);
}

body.dark-mode .article-notes-cards::-webkit-scrollbar-thumb { background: #555; }

/* Confirmation modal */
.confirm-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(32, 65, 100, 0.5);
    backdrop-filter: blur(6px);
    z-index: 5500;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.confirm-overlay.active { display: flex; opacity: 1; }

.confirm-box {
    background: #fff;
    width: 90%;
    max-width: 480px;
    padding: 28px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(15, 31, 51, 0.2);
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.confirm-overlay.active .confirm-box { transform: scale(1); }

.confirm-title {
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 10px;
    display: block;
}

.confirm-message {
    font-size: 1em;
    color: var(--text-muted);
    margin-bottom: 25px;
    line-height: 1.5;
}

.confirm-actions { display: flex; justify-content: center; gap: 15px; }

.btn-confirm-cancel,
.btn-confirm-ok {
    padding: 10px var(--space-5);
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-confirm-cancel {
    background-color: var(--sidebar-bg);
    color: var(--text-color);
    border: 1px solid #ddd;
}

.btn-confirm-cancel:hover { background-color: var(--sidebar-hover); }

.btn-confirm-ok { background-color: var(--danger); color: white; }
.btn-confirm-ok:hover { background-color: var(--danger-hover); }

/* Import modal */
#import-modal-overlay {
    z-index: var(--z-modal);
}

/* Login modal */
.login-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(32, 65, 100, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: var(--z-modal);
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.login-overlay.active { display: flex; opacity: 1; }

.login-modal {
    background-color: var(--bg-color);
    width: 90%;
    max-width: 420px;
    padding: var(--space-10) 30px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    border: 1px solid var(--border-color);
}

.login-overlay.active .login-modal { transform: translateY(0); }

.login-logo-container {
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.login-logo {
    max-width: 380px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.login-title {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--brand-blue);
    margin-bottom: 15px;
    margin-top: 0;
}

.login-message {
    font-size: 1.05em;
    color: var(--text-color);
    margin-bottom: 30px;
    line-height: 1.5;
    opacity: 0.8;
}

.login-action-btn {
    width: 100%;
    padding: 14px;
    background-color: var(--brand-blue);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: var(--font-md);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 4px 12px rgba(32, 65, 100, 0.2);
}

.login-action-btn:hover {
    background-color: var(--brand-accent);
    transform: translateY(-1px);
}

.login-guest-link {
    background: none;
    border: none;
    margin-top: 15px;
    color: #888;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.95em;
    padding: 5px;
}

.login-guest-link:hover { color: var(--text-color); }

.login-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.8em;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.login-close-btn:hover { color: var(--text-color); }

body.dark-mode .login-modal {
    background-color: var(--sidebar-bg);
    border-color: #333;
}

body.dark-mode .login-title { color: #fff; }

/* =================================================================
   12. NOTE FLAGS
   ================================================================= */
.article-number-interactive {
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
}

.article-number-interactive:hover {
    color: var(--brand-accent);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
}

.note-flag {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-right: var(--space-1);
    font-size: var(--font-xs);
    color: var(--note-personal);
    cursor: pointer;
    line-height: 1;
    white-space: nowrap;
    opacity: 0.9;
    transition: transform 0.2s, opacity 0.2s;
}

.note-flag:hover {
    transform: translateY(-50%) scale(1.2);
    opacity: 1;
}

.note-flag.office-flag {
    color: var(--note-office);
    right: 100%;
    margin-right: 22px;
    z-index: 5;
}

body.dark-mode .note-flag.office-flag {
    color: var(--note-office-border);
}

/* Office note card */
.note-card.office-note {
    border-left: 4px solid var(--note-office);
    background-color: #f0f7ff;
}

body.dark-mode .note-card.office-note {
    background-color: var(--note-office-bg);
    border-left-color: var(--note-office-border);
}

/* Badges */
.office-badge {
    background-color: var(--brand-blue);
    color: white;
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
    vertical-align: middle;
    text-transform: uppercase;
    font-weight: 700;
}

/* Layer toggles */
.layer-toggle {
    display: flex;
    align-items: center;
    font-size: 0.9em;
    cursor: pointer;
    user-select: none;
    color: var(--text-color);
    white-space: nowrap;
}

.layer-toggle input { margin-right: 5px; }

.layer-toggle .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: var(--space-1);
    margin-right: var(--space-1);
    display: inline-block;
}

.layer-toggle .dot.yellow { background-color: #f59e0b; border: 1px solid #b45309; }
.layer-toggle .dot.blue { background-color: var(--brand-blue); border: 1px solid #fff; }
.layer-toggle .dot.red { background-color: #dc2626; border: 1px solid #991b1b; }

/* Admin note styling */
.note-card.admin-note {
    border-left: 4px solid #dc2626;
    background-color: #fef2f2;
}

body.dark-mode .note-card.admin-note {
    background-color: #1c1017;
    border-left-color: #f87171;
}

.note-flag.admin-flag {
    color: #dc2626;
    right: 100%;
    margin-right: 36px;
    z-index: 6;
}

body.dark-mode .note-flag.admin-flag { color: #f87171; }

.admin-badge {
    background-color: #dc2626;
    color: white;
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
    vertical-align: middle;
    text-transform: uppercase;
    font-weight: 700;
}

/* --- NOTEBOOK REDESIGN: Tabs --- */
.notebook-tabs {
    display: flex;
    background-color: var(--row-bg-even);
    border-bottom: 2px solid var(--border-color);
    padding: 0;
    flex-shrink: 0;
}

.nb-tab {
    flex: 1;
    padding: 10px 8px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.nb-tab:hover { color: var(--brand-blue); background-color: rgba(32, 65, 100, 0.05); }

.nb-tab.active {
    color: var(--brand-blue);
    border-bottom-color: var(--brand-blue);
    background-color: var(--bg-color);
}

.nb-tab .tab-count {
    background-color: var(--brand-blue);
    color: white;
    font-size: 0.7em;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
}

.nb-tab .tab-count.zero { background-color: var(--text-muted); opacity: 0.5; }

/* Tabs already dark — no dark mode override needed */

/* --- NOTEBOOK REDESIGN: Controls area --- */
.notebook-controls {
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-color);
}

.notebook-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
}

.notebook-search-row input[type="text"] {
    flex: 1;
    padding: 7px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: var(--font-sm);
    background-color: var(--row-bg-even);
    color: var(--text-color);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.notebook-search-row input[type="text"]:focus {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 2px rgba(90, 153, 184, 0.15);
    background-color: var(--bg-color);
}

.notebook-controls-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.notebook-filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    gap: 8px;
    border-top: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.notebook-bulk-row {
    display: none;
    align-items: center;
    padding: 6px 12px;
    gap: 8px;
    background-color: var(--row-bg-even);
    border-top: 1px solid var(--border-color);
    animation: slideDown 0.2s ease;
}

.notebook-bulk-row.visible { display: flex; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dark mode overrides for notebook controls */
body.dark-mode .notebook-controls { background-color: var(--bg-color); }
body.dark-mode .notebook-search-row input[type="text"] { background-color: #2a2a2a; border-color: #555; color: #fff; }
body.dark-mode .notebook-search-row input[type="text"]:focus { background-color: #333; border-color: var(--brand-accent); }
body.dark-mode .notebook-filter-row { border-top-color: #444; }
body.dark-mode .notebook-bulk-row { background-color: var(--sidebar-bg); border-top-color: #444; }
body.dark-mode .notebook-tabs { background-color: var(--sidebar-bg); border-bottom-color: #444; }
body.dark-mode .nb-tab { color: #888; }
body.dark-mode .nb-tab:hover { color: #fff; background-color: rgba(255,255,255,0.05); }
body.dark-mode .nb-tab.active { color: #38bdf8; border-bottom-color: #38bdf8; background-color: var(--bg-color); }

/* --- NOTEBOOK REDESIGN: Tag system --- */
.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: 600;
    white-space: nowrap;
    cursor: default;
    line-height: 1.4;
    border: 1px solid transparent;
}

.tag-pill.clickable { cursor: pointer; transition: opacity 0.2s, transform 0.1s; }
.tag-pill.clickable:hover { opacity: 0.85; transform: scale(1.05); }

.tag-pill.tag-grievance { background-color: var(--tag-grievance-bg); color: var(--tag-grievance); border-color: var(--tag-grievance); }
.tag-pill.tag-question { background-color: var(--tag-question-bg); color: var(--tag-question); border-color: var(--tag-question); }
.tag-pill.tag-action { background-color: var(--tag-action-bg); color: var(--tag-action); border-color: var(--tag-action); }
.tag-pill.tag-reference { background-color: var(--tag-reference-bg); color: var(--tag-reference); border-color: var(--tag-reference); }
.tag-pill.tag-important { background-color: var(--tag-important-bg); color: var(--tag-important); border-color: var(--tag-important); }
.tag-pill.tag-followup { background-color: var(--tag-followup-bg); color: var(--tag-followup); border-color: var(--tag-followup); }
.tag-pill.tag-custom { background-color: var(--tag-custom-bg); color: var(--tag-custom); border-color: var(--tag-custom); }

.tag-pill .tag-remove {
    cursor: pointer;
    font-size: 1.1em;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.tag-pill .tag-remove:hover { opacity: 1; }

body.dark-mode .tag-pill { opacity: 0.9; }
body.dark-mode .tag-pill.tag-grievance { background-color: #450a0a; color: #fca5a5; border-color: #7f1d1d; }
body.dark-mode .tag-pill.tag-question { background-color: #431407; color: #fdba74; border-color: #7c2d12; }
body.dark-mode .tag-pill.tag-action { background-color: #2e1065; color: #c4b5fd; border-color: #4c1d95; }
body.dark-mode .tag-pill.tag-reference { background-color: #022c22; color: #6ee7b7; border-color: #064e3b; }
body.dark-mode .tag-pill.tag-important { background-color: #451a03; color: #fcd34d; border-color: #78350f; }
body.dark-mode .tag-pill.tag-followup { background-color: #172554; color: #93c5fd; border-color: #1e3a5f; }
body.dark-mode .tag-pill.tag-custom { background-color: #1f2937; color: #d1d5db; border-color: #374151; }

/* Tag filter bar in notebook controls */
.tag-filter-chips {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
}

.tag-filter-chip {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-muted);
    transition: all 0.2s;
    user-select: none;
}

.tag-filter-chip:hover { border-color: var(--brand-accent); }

.tag-filter-chip.active {
    background-color: var(--brand-blue);
    color: white;
    border-color: var(--brand-blue);
}

body.dark-mode .tag-filter-chip { background-color: #2a2a2a; border-color: #555; color: #aaa; }
body.dark-mode .tag-filter-chip.active { background-color: var(--brand-accent); color: #000; border-color: var(--brand-accent); }

/* --- NOTEBOOK REDESIGN: Pin/star button --- */
.pin-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1em;
    padding: 2px;
    color: var(--text-muted);
    transition: all 0.2s;
    line-height: 1;
    flex-shrink: 0;
}

.pin-btn:hover { color: var(--tag-important); transform: scale(1.2); }
.pin-btn.pinned { color: var(--tag-important); }

/* Pinned note card accent */
.note-card.pinned {
    border-left: 3px solid var(--tag-important);
    background: linear-gradient(135deg, var(--tag-important-bg) 0%, var(--card-bg) 30%);
}

body.dark-mode .note-card.pinned {
    background: linear-gradient(135deg, #451a0320 0%, var(--card-bg) 30%);
    border-left-color: #fcd34d;
}

/* Pinned section divider */
.pinned-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    font-size: var(--font-xs);
    font-weight: 700;
    color: var(--tag-important);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pinned-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--border-light);
}

body.dark-mode .pinned-divider { color: #fcd34d; }
body.dark-mode .pinned-divider::after { background-color: #444; }

/* --- NOTEBOOK REDESIGN: Enhanced note cards --- */
.note-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 6px 0;
}

.note-card-header-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.note-card-header-row .card-header-check { flex-shrink: 0; }

.note-card-header-row .clickable-article-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    font-size: 0.95em;
}

.note-card-header-row .note-card-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s;
}

.note-card:hover .note-card-actions { opacity: 1; }

.note-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-xs);
    color: var(--text-muted);
    margin-bottom: 4px;
}

/* Inline expand for note content */
.note-group-snippet.expandable {
    cursor: pointer;
    position: relative;
}

.note-group-snippet.expanded {
    white-space: normal;
    overflow: visible;
    -webkit-line-clamp: unset;
}

.note-expand-hint {
    font-size: var(--font-xs);
    color: var(--brand-accent);
    margin-left: 4px;
    font-style: italic;
}

/* --- NOTEBOOK REDESIGN: Enhanced note editor --- */
/* =================================================================
   NOTE EDITOR MODAL — Enhanced design (matches article notes overlay)
   ================================================================= */

.note-modal.enhanced {
    max-width: 560px;
    border-radius: 12px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.note-editor-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0;
}

.note-editor-header .note-modal-title {
    flex: 1;
    font-size: 1.05em;
    font-weight: 700;
    color: var(--heading-color);
}

.note-editor-header .note-modal-close {
    font-size: 1.4em;
    padding: 0 2px;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
}

.note-editor-header .note-modal-close:hover {
    background: rgba(0,0,0,0.05);
}

.pin-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 1.1em;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s;
}

.pin-btn:hover { background: rgba(0,0,0,0.04); }
.pin-btn.pinned { color: var(--tag-important, #e6a23c); border-color: var(--tag-important, #e6a23c); }

.note-editor-article-ref {
    font-size: 0.82em;
    color: var(--primary, #204164);
    background-color: rgba(32, 65, 100, 0.06);
    padding: 8px 16px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid var(--border-color);
}

/* Layer switcher */
#layer-select-container {
    padding: 0 16px;
    margin-top: 12px;
}

.layer-switcher {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.layer-switcher input[type="radio"] { display: none; }

.layer-switcher .switch-btn {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    border-right: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-muted);
    transition: all 0.15s;
}

.layer-switcher .switch-btn:last-child { border-right: none; }

.layer-switcher input[type="radio"]:checked + .switch-btn {
    background: var(--primary, #204164);
    color: #fff;
}

.layer-switcher input[type="radio"]#layer-office:checked + .switch-btn {
    background: var(--primary, #204164);
    color: #fff;
}

.layer-switcher input[type="radio"]#layer-admin:checked + .switch-btn {
    background: #dc2626;
    color: #fff;
}

/* Tags section */
.note-editor-tag-section {
    padding: 12px 16px 0;
    margin-bottom: 0;
}

.note-editor-tag-section label {
    font-size: 0.78em;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-option {
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 0.78em;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-muted);
    transition: all 0.15s;
    user-select: none;
}

.tag-option:hover { transform: scale(1.05); }

.tag-option.selected {
    border-width: 2px;
    font-weight: 700;
}

.tag-option.selected[data-tag="Grievance"] { background-color: var(--tag-grievance-bg); color: var(--tag-grievance); border-color: var(--tag-grievance); }
.tag-option.selected[data-tag="Question"] { background-color: var(--tag-question-bg); color: var(--tag-question); border-color: var(--tag-question); }
.tag-option.selected[data-tag="Action Item"] { background-color: var(--tag-action-bg); color: var(--tag-action); border-color: var(--tag-action); }
.tag-option.selected[data-tag="Reference"] { background-color: var(--tag-reference-bg); color: var(--tag-reference); border-color: var(--tag-reference); }
.tag-option.selected[data-tag="Important"] { background-color: var(--tag-important-bg); color: var(--tag-important); border-color: var(--tag-important); }
.tag-option.selected[data-tag="Follow-up"] { background-color: var(--tag-followup-bg); color: var(--tag-followup); border-color: var(--tag-followup); }

/* Textarea */
.note-editor-textarea {
    width: calc(100% - 32px);
    min-height: 160px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    padding: 12px;
    margin: 12px 16px;
    font-family: inherit;
    font-size: 0.92em;
    line-height: 1.6;
    resize: vertical;
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: var(--text-color);
}

.note-editor-textarea:focus {
    outline: none;
    border-color: var(--primary, #204164);
    box-shadow: 0 0 0 3px rgba(32, 65, 100, 0.08);
}

/* Footer */
.note-editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--row-bg-even, #fafafa);
    border-radius: 0 0 12px 12px;
}

.note-char-count {
    font-size: 0.75em;
    color: var(--text-muted);
}

.note-modal-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-note-save {
    background: linear-gradient(135deg, #022b4d, #204164);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85em;
    font-family: 'Inter', 'Open Sans', sans-serif;
    transition: all 0.15s;
    box-shadow: 0 2px 6px rgba(32, 65, 100, 0.2);
}

.btn-note-save:hover { background: linear-gradient(135deg, #011d36, #183352); box-shadow: 0 4px 12px rgba(32, 65, 100, 0.3); }

.btn-note-delete {
    background-color: transparent;
    color: #dc2626;
    border: 1px solid #fca5a5;
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85em;
    font-family: 'Inter', 'Open Sans', sans-serif;
    transition: all 0.15s;
}

.btn-note-delete:hover { background-color: #fee2e2; }

/* --- Dark mode note editor --- */
body.dark-mode .note-modal.enhanced {
    background: var(--bg-color);
    border-color: #444;
}

body.dark-mode .note-editor-header {
    border-bottom-color: #444;
}

body.dark-mode .note-editor-article-ref {
    background-color: rgba(90, 153, 184, 0.1);
    color: #7ab8d4;
    border-bottom-color: #444;
}

body.dark-mode .pin-btn {
    border-color: #555;
    color: #aaa;
}

body.dark-mode .layer-switcher {
    border-color: #555;
}

body.dark-mode .layer-switcher .switch-btn {
    background: var(--bg-color);
    color: #aaa;
    border-color: #555;
}

body.dark-mode .layer-switcher input[type="radio"]:checked + .switch-btn {
    background: #2d5a82;
    color: #fff;
}

body.dark-mode .note-editor-textarea {
    background-color: #2a2a2a;
    border-color: #555;
    color: #fff;
}

body.dark-mode .note-editor-textarea:focus {
    background-color: #333;
    border-color: #5a99b8;
    box-shadow: 0 0 0 3px rgba(90, 153, 184, 0.1);
}

body.dark-mode .note-editor-footer {
    background: rgba(255,255,255,0.03);
    border-top-color: #444;
}

body.dark-mode .btn-note-save {
    background: #2d5a82;
}

body.dark-mode .btn-note-delete {
    color: #f87171;
    border-color: #7f1d1d;
}

body.dark-mode .btn-note-delete:hover {
    background: rgba(220, 38, 38, 0.1);
}

body.dark-mode .tag-option { background-color: #2a2a2a; border-color: #555; color: #aaa; }

/* --- NOTEBOOK REDESIGN: Dashboard overhaul --- */
.dash-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.dash-stat-card {
    background-color: #253241;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.dash-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dash-stat-number {
    font-size: 2em;
    font-weight: 800;
    color: var(--brand-accent);
    display: block;
    margin-bottom: 4px;
}

.dash-stat-label {
    font-size: 0.85em;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.dash-search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.dash-search-input {
    flex: 1;
    padding: 10px 16px;
    background: #1a2634;
    border: 1px solid #334155;
    color: white;
    border-radius: 8px;
    font-size: 0.95em;
    outline: none;
    transition: border-color 0.2s;
}

.dash-search-input:focus { border-color: var(--brand-accent); }

.dash-search-input::placeholder { color: #64748b; }

.dash-note-card {
    background-color: #253241;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 12px;
    transition: all 0.2s;
    cursor: default;
}

.dash-note-card:hover {
    border-color: var(--brand-accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.dash-note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.dash-note-article {
    font-weight: 700;
    color: var(--brand-accent);
    font-size: 0.95em;
}

.dash-note-date {
    font-size: 0.78em;
    color: #64748b;
    white-space: nowrap;
}

.dash-note-content {
    color: #cbd5e1;
    font-size: 0.9em;
    line-height: 1.5;
    margin-bottom: 8px;
}

.dash-note-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.dash-note-pin {
    color: #fcd34d;
    font-size: 0.85em;
    margin-right: 6px;
}

.dash-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.dash-empty-state svg {
    width: 48px;
    height: 48px;
    stroke: #475569;
    margin-bottom: 12px;
}

.dash-empty-state p {
    font-size: 1em;
    margin: 0;
}

/* Dashboard filter tabs */
.dash-filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.dash-filter-tab {
    padding: 6px 16px;
    border-radius: 20px;
    background: #1a2634;
    border: 1px solid #334155;
    color: #94a3b8;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.dash-filter-tab:hover { border-color: var(--brand-accent); color: #fff; }

.dash-filter-tab.active {
    background-color: var(--brand-blue);
    border-color: var(--brand-blue);
    color: white;
}

/* Dashboard activity timeline */
.dash-timeline {
    position: relative;
    padding-left: 24px;
}

.dash-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #334155;
}

.dash-timeline-item {
    position: relative;
    padding: 12px 0 12px 16px;
    border-bottom: none;
}

.dash-timeline-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 18px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--brand-accent);
    border: 2px solid #1a2634;
}

.dash-timeline-date {
    font-size: 0.75em;
    color: #64748b;
    margin-bottom: 4px;
}

.dash-timeline-content {
    font-size: 0.9em;
    color: #cbd5e1;
}

.dash-timeline-article {
    color: var(--brand-accent);
    font-weight: 600;
}

/* =================================================================
   13. SEARCH
   ================================================================= */
.search-highlight {
    background-color: var(--search-highlight);
    color: var(--text-dark);
    font-weight: bold;
    border-radius: 3px;
    padding: 0 2px;
}

.search-result-item {
    display: block;
    padding: 10px 5px;
    border-bottom: 1px solid #e0e0e0;
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.2s;
}

.search-result-item:hover { background-color: var(--sidebar-hover); }

.search-result-item .result-text {
    font-size: 0.9em;
    line-height: 1.4;
    color: var(--text-light);
}

.search-result-item .result-text strong {
    background-color: var(--search-highlight);
    color: #000000 !important;
    padding: 0 3px;
    border-radius: 3px;
    font-weight: 800;
}

.search-result-item .result-id {
    color: var(--brand-accent);
    margin-right: var(--space-2);
    font-weight: 700;
}

.no-results-message {
    padding: 15px;
    text-align: center;
    color: #777;
    font-style: italic;
}

body.dark-mode .search-result-item .result-text strong {
    background-color: #fdd835;
    color: #000000 !important;
}

body.dark-mode .search-result-item .result-text { color: var(--text-color); }
body.dark-mode .search-result-item .result-id { color: #90caf9; }
body.dark-mode .search-result-item { border-bottom: 1px solid #333; }
body.dark-mode .search-result-item:hover { background-color: var(--row-hover); }

/* Search preview popup */
.search-preview-popup {
    display: none;
    position: fixed;
    width: 420px;
    max-height: 380px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 5000;
    overflow: hidden;
    font-family: 'Inter', 'Open Sans', sans-serif;
    pointer-events: auto;
}

.search-preview-header {
    padding: 14px 18px 10px;
    font-weight: 700;
    font-size: 0.92em;
    color: var(--brand-blue);
    border-bottom: 2px solid var(--brand-accent);
    background: var(--row-bg-even);
    line-height: 1.3;
}

.search-preview-body {
    padding: 10px 18px 14px;
    max-height: 300px;
    overflow-y: auto;
}

.search-preview-clause {
    padding: 6px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.82em;
    line-height: 1.5;
    color: var(--text-color);
}

.search-preview-clause:last-child { border-bottom: none; }

.search-preview-num {
    font-weight: 700;
    color: var(--brand-accent);
    margin-right: 2px;
}

.search-preview-text {
    color: var(--text-light);
}

.search-preview-more {
    padding: 8px 0 2px;
    font-size: 0.78em;
    color: var(--brand-accent);
    font-style: italic;
}

.search-preview-empty {
    color: var(--text-muted);
    font-size: 0.85em;
    font-style: italic;
    padding: 8px 0;
}

body.dark-mode .search-preview-popup {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

body.dark-mode .search-preview-header {
    background: #0f172a;
    color: #38bdf8;
    border-bottom-color: #38bdf8;
}

body.dark-mode .search-preview-clause { border-bottom-color: #334155; }
body.dark-mode .search-preview-text { color: #94a3b8; }

/* Hide preview on mobile */
@media (max-width: 768px) {
    .search-preview-popup { display: none !important; }
}

/* =================================================================
   14. BANNER & SECTION HEADERS
   ================================================================= */
/* (Covered above in section 6 — .section-header, .banner-image-container, .main-banner-image) */

/* =================================================================
   15. UTILITY CLASSES
   ================================================================= */
.heading-centered { text-align: center; }
.loa-section-heading { text-align: center; font-weight: 600; margin: var(--space-5) 0; }
.loa-section-heading-lg { text-align: center; font-weight: 600; font-size: var(--font-xl); margin: var(--space-5) 0; }
.section-spacing-center { text-align: center; margin: var(--space-5) auto; }
.clause-indent-block { margin-left: var(--space-10); }
.table-cell-text { padding: var(--space-2) var(--space-3); }
.pdf-wrapper,
.pdf-wrapper2 { text-align: center; width: 75%; height: 1110px; margin: 0 auto; }
.pdf-canvas { display: block; margin: 0 auto; }
.part-section-title { text-align: center; font-weight: 700; font-size: var(--font-xl); margin: var(--space-5) 0; }
.part-section-subtitle { text-align: center; font-weight: 500; font-size: var(--font-md); margin-bottom: var(--space-5); }
.sidebar-divider { border: none; border-top: 1px solid var(--border-color); margin: var(--space-2) 0; }
.hidden { display: none !important; }
.mt-xs { margin-top: var(--space-1); }
.mt-sm { margin-top: var(--space-2); }
.mt-md { margin-top: var(--space-4); }
.mt-lg { margin-top: var(--space-8); }
.mb-xs { margin-bottom: var(--space-1); }
.pb-xs { padding-bottom: var(--space-1); }
.cell-padding { padding: var(--space-2) var(--space-3); }
.text-underline { text-decoration: underline; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.loa-bullets { list-style: disc; margin-left: var(--space-5); }

/* Detach button */
#detach-notebook { display: none; }

/* Quick jump (hidden on desktop) */
.quick-jump-bar { display: none; }

/* Mobile-only elements (hidden on desktop) */
.mobile-scroll-logo-container,
.mobile-icon-btn,
.mobile-header-controls {
    display: none;
}

/* Default state — hide mobile elements */
.mobile-only-tabs,
.sub-part-selector {
    display: none !important;
}

.desktop-only-tabs {
    display: none !important;
}

/* Header top row */
.header-top-row {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

/* =================================================================
   16. ANIMATIONS
   ================================================================= */
@keyframes popIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes modalSlideUp {
    from { transform: translateY(20px) scale(0.97); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

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

@keyframes flashHighlight {
    0% { background-color: rgba(255, 241, 118, 0); }
    10% { background-color: rgba(255, 241, 118, 1); }
    80% { background-color: rgba(255, 241, 118, 1); }
    100% { background-color: rgba(255, 241, 118, 0); }
}

.highlight-flash {
    animation: flashHighlight 2s ease-out forwards;
    border-radius: 4px;
}

/* =================================================================
   17. PRINT STYLES
   ================================================================= */
@media print {
    .sidebar,
    .hamburger-menu,
    .floating-toolbar,
    .overlay,
    .notebook-panel,
    .note-modal-overlay,
    #article-notes-overlay,
    .confirm-overlay,
    .login-overlay,
    .toc-zoom-controls {
        display: none !important;
    }

    body {
        overflow: visible;
        height: auto;
    }

    .content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 20px !important;
        overflow: visible;
        min-height: auto;
    }

    .container {
        display: block;
    }

    * {
        color: #000 !important;
        background: white !important;
        box-shadow: none !important;
    }

    .table-wrapper,
    .table2-wrapper,
    .table3-wrapper,
    .table4-wrapper,
    .table5-wrapper,
    .table6-wrapper {
        width: 100% !important;
        margin-left: 0 !important;
        box-shadow: none !important;
    }
}

/* =================================================================
   18. MEDIA QUERIES
   ================================================================= */

/* --- DETACHED MODE --- */
/* --- DESKTOP (min-width: 769px) --- */
@media (min-width: 769px) {
    .mobile-only-tabs,
    .sub-part-selector,
    .mobile-header-controls {
        display: none !important;
    }

    .header-top-row {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        width: 100%;
    }

    .desktop-only-tabs {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        width: 100% !important;
        margin: 5px 0 !important;
        gap: 0 !important;
    }

    .desktop-only-tabs .part-tab {
        flex: 1;
        padding: 10px 2px;
        text-align: center;
        background-color: var(--brand-blue);
        color: #fff;
        border: 1px solid #666;
        border-left: none;
        cursor: pointer;
        font-size: var(--font-xs);
        border-radius: 0;
        display: block !important;
    }

    .desktop-only-tabs .part-tab:first-child {
        border-top-left-radius: 5px;
        border-bottom-left-radius: 5px;
        border-left: 1px solid #666;
    }

    .desktop-only-tabs .part-tab:last-child {
        border-top-right-radius: 5px;
        border-bottom-right-radius: 5px;
    }

    .desktop-only-tabs .part-tab.active {
        background-color: var(--brand-active);
        font-weight: 700;
    }

    .desktop-only-tabs .part-tab:hover:not(.active) {
        background-color: var(--brand-accent);
    }
}

/* --- TABLET (max-width: 992px) --- */
@media (max-width: 992px) {
    .table-wrapper,
    .table2-wrapper,
    .table3-wrapper,
    .table4-wrapper,
    .table5-wrapper,
    .table6-wrapper {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-shadow: none;
    }

    .part-selector {
        width: 90%;
        margin-left: auto;
        margin-right: auto;
    }
}

/* --- MOBILE (max-width: 768px) --- */
@media (max-width: 768px) {

    /* Global layout */
    html,
    body {
        overflow-x: hidden;
        width: 100%;
        position: relative;
        height: 100%;
        overflow: hidden;
    }

    body { font-size: 16px; }

    .container {
        flex-direction: column;
        height: 100%;
        width: 100%;
    }

    .content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 10px 15px 20px 15px !important;
        overflow-x: hidden;
        overflow-y: auto;
        height: 100%;
    }

    .text-area {
        margin-left: var(--space-2);
        margin-right: var(--space-3);
    }

    /* Typography resets */
    h2,
    .content h2 {
        font-size: 1.3em !important;
        margin-top: 25px;
    }

    h1,
    .central-terms-section h1 { font-size: 1.4em !important; }
    .central-terms-section h1 { font-size: 1em; padding-bottom: 0; }

    .centralterms h4,
    .content h3,
    .content h4,
    .content h5 {
        margin-left: 0 !important;
        padding-left: 0 !important;
        text-indent: 0 !important;
    }

    .content ul,
    .content ol {
        margin-left: 65px !important;
        padding-left: 0 !important;
        width: calc(100% - 65px) !important;
    }

    .centralterms p,
    .content p,
    .wage-adjustments-list,
    .benefits-funding-adjustments-list {
        margin-left: 45px !important;
        width: calc(100% - 45px) !important;
        padding-left: 0 !important;
        text-align: left;
    }

    .wage-adjustments-list,
    .benefits-funding-adjustments-list {
        margin-left: 45px !important;
        list-style-type: none !important;
    }

    /* Overflow fixes */
    #B-title .B-indent,
    #Appendix_B h2,
    #Appendix_B h3,
    .part-b-header h1,
    .part-b-header h3 {
        width: 100% !important;
        margin-left: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        text-align: center !important;
    }

    /* Hamburger */
    .hamburger-menu {
        display: flex;
        position: fixed;
        top: 18px;
        left: 10px;
        z-index: var(--z-hamburger);
        width: 35px;
        height: 35px;
        background-color: var(--brand-blue) !important;
        border: 2px solid white;
        border-radius: 50%;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: var(--space-1);
        cursor: pointer;
        transition: transform 0.2s ease, background-color 0.2s;
    }

    .hamburger-menu span { background-color: white !important; }

    /* Sidebar */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100vh;
        z-index: var(--z-overlay);
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background-color: #f9f9f9;
        display: flex;
        flex-direction: column;
        border-right: none;
    }

    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open { overflow: hidden; }
    body.sidebar-open .overlay { display: none !important; }
    .overlay { display: none !important; }

    /* Sidebar header */
    .sidebar-header {
        position: relative;
        flex-shrink: 0;
        height: auto !important;
        min-height: 60px !important;
        background-color: var(--brand-blue) !important;
        border-bottom: 1px solid #1a3552 !important;
        padding: 5px 0 !important;
        display: flex;
        flex-direction: column;
        justify-content: center;
        z-index: 2000;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    }

    /* --- Sidebar Brand Bar (mobile) --- */
    .sidebar-brand-bar {
        padding: 10px 16px 8px;
    }

    .sidebar-brand-link {
        gap: 8px;
    }

    .sidebar-logo-sm {
        width: 28px !important;
        height: 28px !important;
    }

    .sidebar-brand-org { font-size: 0.82em; }
    .sidebar-brand-doc { font-size: 0.68em; }

    /* --- Search (mobile) --- */
    .sidebar-search {
        margin: 0 12px 8px;
    }

    #search-input {
        height: 40px;
        font-size: 16px; /* prevent iOS zoom */
        padding: 0 12px 0 32px;
        border-radius: 8px;
    }

    .sidebar-search-icon {
        left: 10px;
        font-size: 0.9em;
    }

    .sidebar-search-clear {
        font-size: 1.2em;
        right: 8px;
    }

    /* Hide mobile-header-controls (old toggle button — search is always visible) */
    .mobile-header-controls { display: none !important; }

    /* --- Part Tabs (mobile) --- */
    .sidebar-tabs {
        padding: 0 12px 8px;
        gap: 6px;
    }

    .sidebar-tab {
        padding: 7px 0;
        font-size: 0.82em;
        min-height: 36px;
    }

    /* --- Nav tree (mobile) --- */
    .sidebar-nav {
        flex-grow: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 4px 0 80px;
    }

    .nav-article-header {
        padding: 10px 16px;
        font-size: 0.88em;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .nav-part-header {
        padding: 10px 16px;
        font-size: 0.72em;
    }

    .nav-sub-item {
        padding: 8px 16px 8px 36px;
        min-height: 40px;
        font-size: 0.82em;
    }

    /* --- Search results (mobile) --- */
    #search-results {
        background: white;
        max-height: calc(100vh - 140px);
        overflow-y: auto;
        z-index: 2500;
        padding: 0;
        display: none;
        flex-grow: 1;
    }

    .sidebar.search-active .sidebar-nav { display: none !important; }
    .sidebar.search-active #search-results { display: block !important; }

    body.dark-mode #search-results { background-color: var(--bg-color); }

    /* --- TOC zoom controls (mobile) --- */
    .toc-zoom-controls { display: none !important; }

    /* Clause rows mobile */
    .clause-number,
    .part-b-row .clause-number {
        flex: 0 0 45px !important;
        padding-right: 5px !important;
        font-size: 1em;
    }

    .clause-number .note-flag {
        margin-right: 2px !important;
        margin-top: 5px;
        font-size: var(--font-sm);
    }

    .clause-number .note-flag.office-flag {
        margin-right: 18px !important;
    }

    .clause-text,
    #B-title .clause-text,
    .part-b-row .clause-text {
        font-size: 1em;
        padding-right: 0 !important;
    }

    .clause-row {
        margin-left: 25px !important;
        width: calc(100% - 25px) !important;
        padding-left: 0 !important;
    }

    .clause-row.level-2 {
        margin-left: 40px !important;
        width: calc(100% - 40px) !important;
    }

    .clause-row.level-3 {
        margin-left: 55px !important;
        width: calc(100% - 55px) !important;
    }

    /* Floating controls */
    .floating-toolbar { z-index: 2999; }

    /* ============================================================
       NOTEBOOK PANEL — MOBILE
       ============================================================ */
    .notebook-panel {
        width: 100% !important;
        right: 0;
        transform: translateX(100%);
    }

    .notebook-panel.open { transform: translateX(0); }
    .notebook-resizer { display: none; }

    /* Header — compact */
    .notebook-header {
        padding: 12px 15px;
    }

    .notebook-header h2 { font-size: var(--font-lg); }

    /* Tabs — horizontal scroll on small screens */
    .notebook-tabs {
        flex-shrink: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .notebook-tabs::-webkit-scrollbar { display: none; }

    .nb-tab {
        padding: 10px 12px;
        font-size: 0.8em;
        min-width: 0;
        white-space: nowrap;
    }

    .nb-tab .tab-count {
        font-size: 0.65em;
        padding: 1px 5px;
    }

    /* Controls — stack vertically */
    .notebook-controls {
        border-bottom: 1px solid var(--border-color);
    }

    .notebook-search-row {
        padding: 8px 10px;
        gap: 6px;
    }

    .notebook-search-row input[type="text"] {
        font-size: 16px; /* prevents iOS zoom */
        padding: 10px 12px;
        min-height: 44px; /* touch target */
    }

    .notebook-controls-right {
        gap: 4px;
        flex-shrink: 0;
    }

    .sort-select {
        font-size: 16px;
        min-height: 36px;
        padding: 4px 6px;
    }

    .view-controls {
        padding: 2px;
        gap: 2px;
    }

    .view-btn {
        padding: 6px 8px;
    }

    /* Filter row — wrap on small screens */
    .notebook-filter-row {
        padding: 8px 10px;
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .layer-controls-inline {
        width: 100%;
        gap: 16px;
    }

    .layer-toggle {
        font-size: 0.85em;
        min-height: 36px;
        display: flex;
        align-items: center;
    }

    .layer-toggle input {
        width: 18px;
        height: 18px;
    }

    /* Tag filter chips — scrollable row */
    .tag-filter-chips {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
        padding-bottom: 2px;
    }

    .tag-filter-chips::-webkit-scrollbar { display: none; }

    .tag-filter-chip {
        font-size: 0.72em;
        padding: 4px 12px;
        min-height: 32px;
        display: flex;
        align-items: center;
        flex-shrink: 0;
    }

    /* Bulk actions row */
    .notebook-bulk-row {
        padding: 8px 10px;
        flex-wrap: wrap;
    }

    .bulk-btn {
        min-width: 40px;
        min-height: 40px;
        padding: 8px;
    }

    /* Auth container */
    #auth-container {
        padding: 8px 10px !important;
    }

    .mini-btn {
        min-height: 36px;
        padding: 6px 12px;
        font-size: 0.85em;
    }

    /* Old toolbar (hidden, but safety) */
    .notebook-toolbar { flex-wrap: wrap; gap: 10px; padding: 10px; }

    /* Notebook list */
    .notebook-list {
        padding: 10px;
    }

    /* Note cards — full width, tighter */
    .note-card {
        padding: 12px;
        margin-bottom: 10px;
        border-radius: 6px;
    }

    .note-card-header-row {
        gap: 6px;
    }

    .note-card-header-row .clickable-article-label {
        font-size: 0.9em;
    }

    /* Always show action buttons on mobile (no hover) */
    .note-card .note-card-actions {
        opacity: 1;
    }

    .note-card-actions .card-action-btn {
        min-width: 32px;
        min-height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1em;
    }

    /* Tag pills — touch friendly */
    .tag-pill {
        font-size: 0.68em;
        padding: 3px 8px;
        min-height: 24px;
        display: inline-flex;
        align-items: center;
    }

    .note-card-tags {
        gap: 4px;
        margin: 4px 0;
    }

    /* Note group rows — larger touch targets */
    .note-group-row {
        padding: 10px;
        min-height: 48px;
    }

    .note-group-check input[type="checkbox"] {
        width: 18px;
        height: 18px;
    }

    .note-group-snippet {
        font-size: 0.85em;
        line-height: 1.4;
    }

    .note-group-date {
        font-size: 0.75em;
    }

    /* Card footer */
    .note-card-footer.grouped {
        padding-top: 8px;
        gap: 12px;
    }

    .card-action-btn {
        font-size: 0.8em;
        min-height: 32px;
        display: inline-flex;
        align-items: center;
        padding: 4px 0;
    }

    /* Pinned divider */
    .pinned-divider {
        font-size: 0.7em;
        padding: 6px 0;
    }

    /* Group header */
    .group-header {
        font-size: 0.85em;
        padding: 8px 10px;
        margin: 10px 0 8px 0;
    }

    /* Table view — compact */
    .notebook-table {
        font-size: 0.8em;
    }

    .notebook-table th:nth-child(2),
    .notebook-table td:nth-child(2) {
        width: 35%;
    }

    .tbl-content {
        font-size: 0.85em;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* ============================================================
       NOTE EDITOR MODAL — MOBILE
       ============================================================ */
    .note-modal {
        width: 95% !important;
        max-width: none !important;
        max-height: 90dvh !important;
        display: flex;
        flex-direction: column;
        padding: 15px !important;
        overflow-y: auto;
        border-radius: 8px;
    }

    .note-modal.enhanced {
        max-width: none !important;
        width: 96% !important;
        border-radius: 10px;
    }

    .note-editor-header {
        padding: 12px 14px;
    }

    .note-editor-article-ref {
        font-size: 0.8em;
        padding: 8px 12px;
    }

    /* Layer switcher — full width */
    #layer-select-container { padding: 0 12px; margin-top: 10px; }

    .layer-switcher .switch-btn {
        padding: 10px 8px;
        font-size: 0.82em;
        min-height: 44px;
    }

    /* Tag selector — scrollable, touch-friendly */
    .note-editor-tag-section {
        padding: 10px 12px 0;
    }

    .tag-selector {
        gap: 6px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }

    .tag-selector::-webkit-scrollbar { display: none; }

    .tag-option {
        padding: 8px 14px;
        font-size: 0.78em;
        min-height: 36px;
        display: flex;
        align-items: center;
        flex-shrink: 0;
        white-space: nowrap;
    }

    /* Textarea */
    .note-editor-textarea,
    .note-modal textarea {
        font-size: 16px; /* prevents iOS zoom */
        min-height: 150px;
        flex-grow: 1;
        margin: 10px 12px;
        width: calc(100% - 24px);
    }

    .note-editor-footer {
        flex-direction: column-reverse;
        gap: 8px;
        padding: 10px 12px;
    }

    .note-char-count { text-align: center; }

    .note-modal-actions {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .note-modal-actions .btn-note-save,
    .note-modal-actions .btn-note-delete {
        flex: 1;
        min-height: 48px;
        font-size: 1em;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .note-modal-overlay { z-index: var(--z-modal) !important; }

    .pin-btn {
        font-size: 1.3em;
        padding: 4px 8px;
        min-width: 40px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* ============================================================
       TABLES — MOBILE (overflow handling)
       ============================================================ */
    .nested-table,
    .nested-table2,
    .nested-table3,
    .nested-table-B {
        width: 100% !important;
        margin-left: 0 !important;
    }

    /* Allow horizontal scroll on complex tables */
    .nested-table td:first-child,
    .nested-table-B td:first-child {
        width: 50px !important;
        min-width: 50px;
        padding-right: 5px !important;
    }

    .nested-table td:nth-child(2),
    .nested-table-B td:nth-child(2) {
        padding-right: 10px !important;
    }

    /* ============================================================
       ARTICLE NOTES MODAL — MOBILE
       ============================================================ */
    .article-notes-modal {
        width: 96% !important;
        max-width: none !important;
        height: 92dvh !important;
        max-height: none !important;
        border-radius: 10px;
    }

    .article-notes-header { padding: 12px 14px; }

    #article-notes-title { font-size: 0.95em; }

    .article-notes-toolbar {
        flex-wrap: wrap;
        gap: 8px !important;
        padding: 10px 12px !important;
    }

    .an-btn-primary { width: 100%; justify-content: center; min-height: 44px; }

    .an-filter-group {
        width: 100%;
        justify-content: center;
        padding: 6px 0;
        background: rgba(0,0,0,0.03);
        border-radius: 6px;
    }

    .an-search-wrap { width: 100%; min-width: 0; }

    #article-notes-search { min-height: 44px; font-size: 16px; }

    .an-bulk-actions { width: 100%; justify-content: space-between; }

    .an-btn-danger { flex: 1; justify-content: center; min-height: 40px; }

    .article-notes-cards { padding: 10px 12px; gap: 8px; }

    .an-card { padding: 10px 12px; }

    .an-card-body { font-size: 0.85em; }

    .an-card-check { width: 18px; height: 18px; }

    /* ============================================================
       NOTE FLAGS — MOBILE (larger touch targets)
       ============================================================ */
    .note-flag {
        font-size: var(--font-sm);
        padding: 4px;
        margin-right: 2px;
    }

    .note-flag.office-flag {
        margin-right: 20px;
    }

    /* ============================================================
       DARK MODE — MOBILE OVERRIDES
       ============================================================ */

    /* Hamburger */
    body.dark-mode .hamburger-menu {
        background-color: rgba(90, 153, 184, 0.3) !important;
        border: 2px solid rgba(255, 255, 255, 0.6) !important;
        backdrop-filter: blur(3px) !important;
        -webkit-backdrop-filter: blur(3px) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    }

    body.dark-mode .hamburger-menu span {
        background-color: #ffffff !important;
        opacity: 1 !important;
    }

    /* Sidebar */
    body.dark-mode .sidebar,
    body.dark-mode .sidebar nav {
        background-color: var(--sidebar-bg) !important;
        border-right: 1px solid #333;
    }

    body.dark-mode .sidebar a,
    body.dark-mode .sidebar .collapsible-header,
    body.dark-mode .sidebar .sidebar-item-text,
    body.dark-mode .sidebar .sidebar-item-number {
        color: #90caf9 !important;
    }

    body.dark-mode .sidebar-header {
        background-color: var(--brand-blue) !important;
        border-bottom: 1px solid #2c3e50 !important;
    }

    body.dark-mode .mobile-only-tabs .part-tab {
        background-color: rgba(255, 255, 255, 0.1) !important;
        border-color: #555 !important;
        color: var(--text-color) !important;
    }

    body.dark-mode .mobile-only-tabs .part-tab.active {
        background-color: var(--brand-accent) !important;
        color: #fff !important;
        border-color: var(--brand-accent) !important;
    }

    /* Notebook dark mode — mobile */
    body.dark-mode .notebook-tabs { background-color: #1a1a1a; }
    body.dark-mode .nb-tab { color: #888; }
    body.dark-mode .nb-tab.active { color: #38bdf8; border-bottom-color: #38bdf8; background-color: var(--bg-color); }

    body.dark-mode .notebook-controls { background-color: var(--bg-color); }
    body.dark-mode .notebook-search-row input[type="text"] { background-color: #2a2a2a; border-color: #555; color: #fff; }
    body.dark-mode .notebook-filter-row { border-top-color: #444; }
    body.dark-mode .notebook-bulk-row { background-color: #1e1e1e; border-top-color: #444; }
    body.dark-mode .tag-filter-chip { background-color: #2a2a2a; border-color: #555; color: #aaa; }
    body.dark-mode .tag-filter-chip.active { background-color: var(--brand-accent); color: #000; }

    body.dark-mode .note-editor-article-ref { background-color: rgba(56, 189, 248, 0.1); color: #38bdf8; }
    body.dark-mode .tag-option { background-color: #2a2a2a; border-color: #555; color: #aaa; }
    body.dark-mode .note-editor-textarea { background-color: #2a2a2a; border-color: #555; color: #fff; }

    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(-5px); }
        to { opacity: 1; transform: translateY(0); }
    }
}

/* --- SMALL MOBILE (< 420px) --- */
@media (max-width: 420px) {
    .bulk-btn span { display: none; }
    .bulk-btn svg { margin: 0 auto; }

    /* floating-toolbar handled by mobile bottom bar styles */

    .note-flag { margin-right: 2px; }

    .clause-row.level-2 { margin-left: 15px; width: calc(100% - 15px); }
    .clause-row.level-3 { margin-left: 30px; width: calc(100% - 30px); }

    /* Notebook — extra compact */
    .nb-tab { padding: 8px 8px; font-size: 0.75em; }
    .notebook-search-row { flex-wrap: wrap; }
    .notebook-controls-right { width: 100%; justify-content: space-between; }
    .sort-select { flex: 1; }

    /* Tag selector in editor — wrap instead of scroll */
    .tag-selector { flex-wrap: wrap; }
    .tag-option { padding: 6px 10px; font-size: 0.72em; }

    /* Note editor — tighter */
    .note-editor-textarea { min-height: 120px; }

    /* View controls hidden on very small — default to list */
    .view-controls { display: none; }
}

/* --- VERY SMALL MOBILE (< 400px) --- */
@media (max-width: 400px) {
    .bulk-btn span { display: none; }

    .layer-controls-inline {
        width: 100%;
        justify-content: center;
        order: -1;
        margin-bottom: 5px;
    }

    /* Stack filter row items */
    .notebook-filter-row {
        padding: 6px 8px;
        gap: 6px;
    }

    .tag-filter-chips { display: none; }
}

/* --- FORMULA MOBILE --- */
@media (max-width: 600px) {
    .gratuity-formula-container {
        flex-direction: column;
        align-items: flex-start;
        margin-left: 0;
    }

    .formula-operator {
        margin-left: 0;
        margin-top: 10px;
        padding-bottom: 0;
    }
}

/* --- TOUCH DEVICES: Prevent sticky hover states --- */
@media (hover: none) {
    /* Floating toolbar: no hover effects on touch */
    .tb-btn:hover { background: transparent; }
    .tb-btn:active { background: #e2e8f0; }

    /* Sidebar & navigation */
    .sidebar a:hover,
    .sidebar .collapsible-header:hover { background-color: transparent; }
    .sidebar a:active,
    .sidebar .collapsible-header:active { background-color: var(--sidebar-hover); }

    .part-tab:not(.active):hover { background-color: inherit; }
    .part-tab:not(.active):active { background-color: var(--brand-accent); }

    /* Notebook elements */
    .note-card:hover { transform: none; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05); }
    .note-card:active { transform: scale(0.99); }

    .nb-tab:hover { background-color: transparent; color: inherit; }
    .nb-tab:active { background-color: rgba(32, 65, 100, 0.1); }

    .note-group-row:hover { background-color: transparent; }
    .note-group-row:active { background-color: var(--row-hover); }

    .card-action-btn:hover { color: inherit; }
    .card-action-btn:active { color: var(--brand-blue); }

    .clickable-article-label:hover { text-decoration: none; color: inherit; }
    .clickable-article-label:active { color: var(--brand-accent); }

    .view-btn:hover { background-color: transparent; }
    .view-btn:active { background-color: rgba(255, 255, 255, 0.5); }

    .bulk-btn:hover:not(:disabled) { background-color: inherit; border-color: inherit; color: inherit; }
    .bulk-btn:active:not(:disabled) { background-color: var(--row-hover); }

    .tag-filter-chip:hover { border-color: inherit; }
    .tag-filter-chip:active { border-color: var(--brand-accent); }

    .tag-pill.clickable:hover { transform: none; opacity: 1; }
    .tag-pill.clickable:active { transform: scale(0.95); }

    .pin-btn:hover { transform: none; }
    .pin-btn:active { transform: scale(1.2); }

    .tag-option:hover { transform: none; }
    .tag-option:active { transform: scale(0.95); }

    /* Buttons */
    .btn-note-save:hover { background-color: var(--brand-blue); }
    .btn-note-save:active { background-color: var(--brand-accent); }

    .btn-note-delete:hover { background-color: transparent; }
    .btn-note-delete:active { background-color: var(--warning-bg); }

    .mini-btn:hover { background-color: inherit; color: inherit; border-color: inherit; }
    .mini-btn:active { background-color: var(--brand-accent); color: white; }

    /* Note flags */
    .note-flag:hover { transform: translateY(-50%); }
    .note-flag:active { transform: translateY(-50%) scale(1.2); }

    /* Search results */
    .search-result-item:hover { background-color: transparent; }
    .search-result-item:active { background-color: var(--sidebar-hover); }

    /* Login modal */
    .login-action-btn:hover { background-color: var(--brand-blue); transform: none; }
    .login-action-btn:active { background-color: var(--brand-accent); transform: scale(0.98); }

    /* Article notes table */
    #article-notes-list tr:hover { background-color: transparent; }
    #article-notes-list tr:active { background-color: var(--row-hover); }

    .sortable-header:hover { background-color: transparent; }

    /* Notebook table */
    .notebook-table tr:hover { background-color: transparent; }
    .notebook-table tr:active { background-color: #f9f9f9; }
}

/* --- SAFE AREA (Notch/Home Bar) --- */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .floating-toolbar {
        padding-bottom: env(safe-area-inset-bottom);
        margin-bottom: 10px;
    }

    .notebook-panel {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}


/* =================================================================
   ANNOUNCEMENT BANNERS
   ================================================================= */

.announcement-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    margin: 0 0 2px 0;
    font-family: 'Inter', 'Open Sans', sans-serif;
    font-size: 0.9em;
    line-height: 1.5;
    animation: annSlideIn 0.3s ease-out;
}

@keyframes annSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.ann-info {
    background: #eff6ff;
    color: #1e40af;
    border-bottom: 1px solid #bfdbfe;
}

.ann-warning {
    background: #fffbeb;
    color: #92400e;
    border-bottom: 1px solid #fde68a;
}

.ann-urgent {
    background: #fef2f2;
    color: #991b1b;
    border-bottom: 1px solid #fecaca;
}

.ann-icon {
    flex-shrink: 0;
    font-size: 1.1em;
}

.ann-message {
    flex: 1;
    font-weight: 500;
}

.ann-dismiss {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 1.3em;
    cursor: pointer;
    opacity: 0.5;
    padding: 0 4px;
    line-height: 1;
    color: inherit;
    transition: opacity 0.15s;
}

.ann-dismiss:hover { opacity: 1; }

/* Dark mode */
body.dark-mode .ann-info {
    background: rgba(30, 64, 175, 0.12);
    color: #93c5fd;
    border-bottom-color: rgba(59, 130, 246, 0.2);
}

body.dark-mode .ann-warning {
    background: rgba(146, 64, 14, 0.12);
    color: #fcd34d;
    border-bottom-color: rgba(253, 230, 138, 0.2);
}

body.dark-mode .ann-urgent {
    background: rgba(153, 27, 27, 0.15);
    color: #fca5a5;
    border-bottom-color: rgba(254, 202, 202, 0.2);
}

/* Mobile */
@media (max-width: 768px) {
    .announcement-banner {
        font-size: 0.85em;
        padding: 10px 12px;
    }
}


/* =================================================================
   SPOT NOTES — Floating Toolbar, Highlights, Quote Block, Custom Tags
   ================================================================= */

/* --- Floating Selection Toolbar --- */
.spot-toolbar {
    position: absolute;
    z-index: 10000;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 1px 4px rgba(0, 0, 0, 0.08);
    padding: 4px;
    display: flex;
    gap: 3px;
    animation: spotToolbarIn 0.15s ease-out;
}

@keyframes spotToolbarIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.spot-toolbar-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13px;
    font-family: 'Inter', 'Open Sans', sans-serif;
    font-weight: 500;
    color: var(--text-primary, #333);
    background: transparent;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.spot-toolbar-btn:hover {
    background: #f0f0f0;
}

.spot-toolbar-btn.spot-note-action {
    color: var(--primary, #204164);
    font-weight: 600;
}

.spot-toolbar-btn.spot-note-action:hover {
    background: rgba(32, 65, 100, 0.08);
}

/* --- Spot Highlight in Agreement Text --- */
.spot-highlight {
    background: rgba(230, 162, 60, 0.2);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    transition: background 0.2s ease;
    border-bottom: 2px solid rgba(230, 162, 60, 0.4);
}

.spot-highlight:hover {
    background: rgba(230, 162, 60, 0.35);
    border-bottom-color: rgba(230, 162, 60, 0.7);
}

/* Pin marker on the first segment — absolutely positioned, zero impact on flow */
.spot-highlight:not(.spot-highlight-continuation)::before {
    content: '\1F4CC';
    font-size: 9px;
    position: absolute;
    top: -10px;
    left: 0;
    line-height: 1;
    pointer-events: none;
}

/* Continuation segments don't get the marker */
.spot-highlight-continuation::before {
    display: none;
}

/* --- Spot Quote Block in Note Editor --- */
.spot-quote {
    border-left: 3px solid var(--note-personal, #e6a23c);
    padding: 10px 14px;
    margin: 8px 16px 4px 16px;
    font-style: italic;
    font-size: 0.88em;
    line-height: 1.5;
    color: var(--text-muted, #666);
    background: rgba(230, 162, 60, 0.06);
    border-radius: 0 6px 6px 0;
    max-height: 120px;
    overflow-y: auto;
    word-break: break-word;
}

/* --- Custom Tag Input --- */
.custom-tag-input-wrap {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    align-items: center;
}

.custom-tag-input-wrap input {
    flex: 1;
    padding: 5px 10px;
    border: 1px solid var(--border, #ddd);
    border-radius: 6px;
    font-size: 12px;
    font-family: 'Inter', 'Open Sans', sans-serif;
    outline: none;
    transition: border-color 0.2s;
    background: var(--bg-primary, #fff);
    color: var(--text-primary, #333);
}

.custom-tag-input-wrap input:focus {
    border-color: var(--primary, #204164);
}

.custom-tag-input-wrap input::placeholder {
    color: var(--text-muted, #999);
}

.custom-tag-input-wrap button {
    padding: 5px 12px;
    border: 1px solid var(--border, #ddd);
    border-radius: 6px;
    background: var(--bg-primary, #fff);
    color: var(--primary, #204164);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1;
}

.custom-tag-input-wrap button:hover {
    background: rgba(32, 65, 100, 0.06);
    border-color: var(--primary, #204164);
}

/* --- Spot Note Indicator in Notebook Panel --- */
.spot-note-quote {
    border-left: 3px solid var(--note-personal, #e6a23c);
    padding: 4px 8px;
    margin-bottom: 4px;
    font-style: italic;
    font-size: 0.82em;
    color: var(--text-muted, #666);
    background: rgba(230, 162, 60, 0.05);
    border-radius: 0 4px 4px 0;
    max-height: 48px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.spot-note-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.75em;
    color: var(--note-personal, #e6a23c);
    font-weight: 600;
    margin-right: 4px;
}

/* --- Dark Mode --- */
body.dark-mode .spot-toolbar {
    background: var(--bg-secondary, #2a2a2a);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 1px 4px rgba(0, 0, 0, 0.2);
}

body.dark-mode .spot-toolbar-btn {
    color: var(--text-primary, #e0e0e0);
}

body.dark-mode .spot-toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .spot-toolbar-btn.spot-note-action {
    color: #7ab8d4;
}

body.dark-mode .spot-toolbar-btn.spot-note-action:hover {
    background: rgba(122, 184, 212, 0.1);
}

body.dark-mode .spot-highlight {
    background: rgba(230, 162, 60, 0.15);
    border-bottom-color: rgba(230, 162, 60, 0.3);
}

body.dark-mode .spot-highlight:hover {
    background: rgba(230, 162, 60, 0.25);
    border-bottom-color: rgba(230, 162, 60, 0.5);
}

body.dark-mode .spot-quote {
    background: rgba(230, 162, 60, 0.08);
    color: var(--text-muted, #aaa);
}

body.dark-mode .spot-note-quote {
    background: rgba(230, 162, 60, 0.06);
    color: var(--text-muted, #aaa);
}

body.dark-mode .custom-tag-input-wrap input {
    background: var(--bg-primary, #1a1a1a);
    border-color: var(--border, #444);
    color: var(--text-primary, #e0e0e0);
}

body.dark-mode .custom-tag-input-wrap button {
    background: var(--bg-primary, #1a1a1a);
    border-color: var(--border, #444);
    color: #7ab8d4;
}

/* --- Mobile --- */
@media (max-width: 768px) {
    .spot-toolbar {
        border-radius: 12px;
        padding: 6px;
        gap: 4px;
    }

    .spot-toolbar-btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .spot-quote {
        margin: 6px 12px 4px 12px;
        padding: 8px 10px;
        font-size: 0.85em;
    }

    .custom-tag-input-wrap input {
        padding: 8px 10px;
        font-size: 13px;
    }

    .custom-tag-input-wrap button {
        padding: 8px 14px;
    }
}

/* --- Touch devices: no sticky hover --- */
@media (hover: none) {
    .spot-toolbar-btn:hover {
        background: transparent;
    }

    .spot-toolbar-btn.spot-note-action:hover {
        background: transparent;
    }

    .spot-toolbar-btn:active {
        background: rgba(0, 0, 0, 0.06);
    }

    .spot-highlight:hover {
        background: rgba(230, 162, 60, 0.2);
        border-bottom-color: rgba(230, 162, 60, 0.4);
    }
}


/* =================================================================
   EMBEDDED MODE — Hides login UI when deployed inside MEP or admin portal
   ================================================================= */

body.embedded-mode .login-overlay,
body.embedded-mode #login-prompt-overlay,
body.embedded-mode #activation-modal,
body.embedded-mode #notebook-signin-prompt {
    display: none !important;
}

/* Hide the large "Hamilton-Wentworth Catholic Teachers" banner when the
 * agreement is embedded in another portal's iframe — the host already
 * provides its own header chrome and the banner just eats vertical space.
 * Standalone agreement.oectahw.com visits keep the banner. */
body.embedded-mode .main-content-header {
    display: none;
}


/* =================================================================
   CLAUSE COMPARISON MODAL
   ================================================================= */

/* ── Compare Workspace ── */
.compare-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 15000;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
}

.compare-workspace {
    background: var(--bg-color, #fff);
    border-radius: 14px;
    width: 96vw; max-width: 1400px;
    height: 90vh;
    display: flex; flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,0.3);
    animation: popIn 0.2s ease-out;
    overflow: hidden;
}

/* Header */
.cw-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 24px;
    background: var(--brand-blue);
    color: #fff; flex-shrink: 0;
}
.cw-header-left h3 { font-family: 'Newsreader', Georgia, serif; font-style: italic; font-size: 1.2em; font-weight: 600; margin: 0; }
.cw-subtitle { font-size: 0.72em; opacity: 0.7; margin-left: 12px; }
.cw-header-actions { display: flex; align-items: center; gap: 6px; }
.cw-action-btn {
    display: flex; align-items: center; gap: 5px;
    background: rgba(255,255,255,0.15); border: none; color: #fff;
    padding: 6px 12px; border-radius: 6px; font-size: 0.78em; font-weight: 600;
    cursor: pointer; transition: background 0.15s;
}
.cw-action-btn:hover { background: rgba(255,255,255,0.25); }
.cw-close-btn {
    background: none; border: none; color: rgba(255,255,255,0.6);
    font-size: 1.6em; cursor: pointer; margin-left: 8px; line-height: 1;
}
.cw-close-btn:hover { color: #fff; }

/* Selectors */
.cw-selectors {
    display: flex; align-items: flex-end; gap: 10px;
    padding: 12px 24px;
    background: var(--row-bg-even); border-bottom: 1px solid var(--border-color);
    flex-shrink: 0; flex-wrap: wrap;
}
.cw-sel { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 200px; }
.cw-sel label { font-size: 0.68em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); }
.cw-select {
    padding: 8px 12px; border: 1px solid var(--border-color); border-radius: 8px;
    font-size: 0.85em; font-family: inherit;
    background: var(--bg-color); color: var(--text-color);
}
.cw-sel-swap { display: flex; align-items: flex-end; padding-bottom: 4px; }
.cw-swap-btn {
    width: 34px; height: 34px; border-radius: 8px;
    background: var(--bg-color); border: 1px solid var(--border-color);
    color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.cw-swap-btn:hover { background: var(--brand-blue); color: #fff; border-color: var(--brand-blue); }
.cw-go-btn {
    padding: 8px 24px; background: var(--brand-blue); color: #fff;
    border: none; border-radius: 8px; font-size: 0.85em; font-weight: 700;
    font-family: inherit; cursor: pointer; transition: background 0.15s;
    align-self: flex-end;
}
.cw-go-btn:hover { background: #183352; }

/* Key Takeaway */
.cw-takeaway {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 24px; background: #eff6ff;
    border-bottom: 1px solid #dbeafe; flex-shrink: 0;
}
.cw-takeaway-icon { color: #3b82f6; margin-top: 2px; flex-shrink: 0; }
.cw-takeaway-content strong { font-size: 0.78em; color: #1e40af; text-transform: uppercase; letter-spacing: 0.5px; }
.cw-takeaway-content p { font-size: 0.88em; color: #1e293b; margin: 4px 0 0; line-height: 1.5; }

/* Body — side by side panes */
.cw-body { display: flex; flex: 1; overflow: hidden; }
.cw-pane {
    flex: 1; overflow-y: auto; padding: 20px 24px;
    font-size: 0.92em; line-height: 1.6;
}
.cw-pane-empty { color: var(--text-muted); text-align: center; padding: 48px 20px; font-size: 0.9em; }
.cw-divider { width: 1px; background: var(--border-color); flex-shrink: 0; }

/* Clause hover in compare panes */
.cw-pane .clause-row { cursor: pointer; transition: background 0.15s; border-radius: 4px; padding: 4px 8px; margin: 0 -8px; }
.cw-pane .clause-row:hover { background: rgba(90,153,184,0.08); }
.cw-pane .clause-row.cw-highlighted { background: rgba(59,130,246,0.1); border-left: 3px solid #3b82f6; }

/* Footer toolbar */
.cw-footer {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 24px; background: var(--row-bg-even);
    border-top: 1px solid var(--border-color); flex-shrink: 0;
}
.cw-footer-btn {
    display: flex; align-items: center; gap: 5px;
    padding: 6px 14px; background: var(--bg-color);
    border: 1px solid var(--border-color); border-radius: 6px;
    font-size: 0.78em; font-weight: 600; color: var(--text-color);
    cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.cw-footer-btn:hover { background: var(--brand-blue); color: #fff; border-color: var(--brand-blue); }
.cw-footer-spacer { flex: 1; }
.cw-footer-hint { font-size: 0.72em; color: var(--text-muted); font-style: italic; }

/* Dark mode */
body.dark-mode .compare-workspace { background: var(--bg-color); }
body.dark-mode .cw-selectors { background: var(--sidebar-bg); }
body.dark-mode .cw-select { background: #2a2a2a; border-color: #555; color: #e0e0e0; }
body.dark-mode .cw-takeaway { background: #1e293b; border-color: #334155; }
body.dark-mode .cw-takeaway-content p { color: #e2e8f0; }
body.dark-mode .cw-footer { background: var(--sidebar-bg); border-color: #444; }
body.dark-mode .cw-footer-btn { background: var(--bg-color); border-color: #555; color: #e0e0e0; }
body.dark-mode .cw-pane .clause-row:hover { background: rgba(90,153,184,0.12); }

/* Mobile */
@media (max-width: 768px) {
    .compare-workspace { width: 98vw; height: 95vh; border-radius: 8px; }
    .cw-body { flex-direction: column; }
    .cw-divider { width: 100%; height: 1px; }
    .cw-pane { padding: 12px; }
    .cw-selectors { flex-direction: column; }
    .cw-sel { min-width: 0; }
    .cw-sel-swap { display: none; }
    .cw-subtitle { display: none; }
}


/* =================================================================
   KEYBOARD SHORTCUTS OVERLAY
   ================================================================= */

#shortcuts-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.shortcuts-modal {
    background: var(--bg-color, #fff);
    border: 1px solid var(--border-color, #ddd);
    border-radius: 12px;
    width: 420px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: popIn 0.2s ease-out;
}

.shortcuts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #ddd);
}

.shortcuts-header h3 {
    font-size: 1em;
    font-weight: 700;
    margin: 0;
}

.shortcuts-close {
    background: none;
    border: none;
    font-size: 1.4em;
    cursor: pointer;
    color: var(--text-muted, #888);
    padding: 0 4px;
}

.shortcuts-body {
    padding: 16px 20px;
}

.shortcut-group {
    margin-bottom: 16px;
}

.shortcut-group:last-child { margin-bottom: 0; }

.shortcut-group h4 {
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted, #888);
    margin-bottom: 8px;
}

.shortcut-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.88em;
}

.shortcut-row span { color: var(--text-color, #333); }

.shortcut-row kbd {
    display: inline-block;
    padding: 2px 8px;
    background: var(--row-bg-even, #f5f5f5);
    border: 1px solid var(--border-color, #ddd);
    border-radius: 4px;
    font-size: 0.82em;
    font-family: 'Open Sans', monospace;
    font-weight: 600;
    color: var(--text-color, #333);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.shortcut-desc { font-size: 0.82em; color: var(--text-muted, #888); }

body.dark-mode .shortcuts-modal {
    background: var(--bg-color);
    border-color: #444;
}

body.dark-mode .shortcut-row kbd {
    background: #2a2a2a;
    border-color: #555;
}


/* =================================================================
   RECENTLY VIEWED
   ================================================================= */

.recently-viewed-section {
    margin-bottom: 8px;
}

.recently-viewed-list {
    display: flex;
    flex-direction: column;
}

.recently-viewed-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    cursor: pointer;
    transition: background 0.12s;
    border-bottom: 1px solid var(--border-light, #f0f0f0);
}

.recently-viewed-item:hover { background: rgba(0, 0, 0, 0.02); }
.recently-viewed-item:last-child { border-bottom: none; }

.rv-label {
    font-size: 0.82em;
    color: var(--text-color, #333);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.rv-jump {
    background: none;
    border: none;
    color: var(--brand-accent, #5a99b8);
    font-size: 1em;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.rv-jump:hover { background: rgba(90, 153, 184, 0.1); }


/* =================================================================
   NOTE SHARE BUTTON
   ================================================================= */

.note-share-btn {
    background: none;
    border: none;
    color: var(--text-muted, #888);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    display: flex;
    align-items: center;
}

.note-group-row:hover .note-share-btn { opacity: 1; }
.note-share-btn:hover { color: var(--brand-accent, #5a99b8); background: rgba(90, 153, 184, 0.08); }

@media (hover: none) {
    .note-share-btn { opacity: 0.6; }
}

@media (max-width: 768px) {
    .note-share-btn { opacity: 0.6; }
}


/* =================================================================
   CROSS-REFERENCE LINKS
   ================================================================= */

.cross-ref-link {
    color: var(--brand-accent, #5a99b8);
    text-decoration: none;
    border-bottom: 1px dotted var(--brand-accent, #5a99b8);
    transition: color 0.15s, border-color 0.15s;
    cursor: pointer;
}

.cross-ref-link:hover {
    color: var(--brand-blue, #204164);
    border-bottom-color: var(--brand-blue, #204164);
    border-bottom-style: solid;
}

body.dark-mode .cross-ref-link {
    color: #7ab8d4;
    border-bottom-color: #7ab8d4;
}

body.dark-mode .cross-ref-link:hover {
    color: #a5d4e8;
    border-bottom-color: #a5d4e8;
}


/* =================================================================
   MOBILE BOTTOM TOOLBAR
   ================================================================= */

@media (max-width: 768px) {
    /* Convert floating toolbar to bottom bar */
    .floating-toolbar {
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        flex-direction: row !important;
        border-radius: 0 !important;
        padding: 6px 12px !important;
        gap: 4px !important;
        background: rgba(255,255,255,0.96) !important;
        box-shadow: 0 -2px 12px rgba(0,0,0,0.08) !important;
        border-top: 1px solid rgba(0,0,0,0.06) !important;
        border-left: none !important;
        justify-content: space-around;
    }

    .tb-divider {
        width: 1px !important; height: 24px !important;
        margin: 0 2px !important;
    }

    .tb-btn { width: 42px; height: 42px; }

    /* Flyouts open upward on mobile */
    .tb-flyout {
        right: auto !important;
        left: 50% !important;
        top: auto !important;
        bottom: calc(100% + 10px) !important;
        transform: translateX(-50%) scale(0.95) !important;
    }
    .tb-flyout.open {
        transform: translateX(-50%) scale(1) !important;
    }

    /* Wide flyout needs constraint */
    .tb-flyout-wide { width: 240px !important; }

    /* Ensure main content doesn't hide behind bottom bar */
    .main-content { padding-bottom: 60px !important; }

    /* Notebook panel full width on mobile */
    .notebook-panel {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Notebook footer stays visible on mobile */
    .notebook-footer { padding: 8px 12px; }
}

body.dark-mode .floating-toolbar {
    background: rgba(30,41,59,0.96) !important;
}

@media (max-width: 768px) {
    body.dark-mode .floating-toolbar {
        box-shadow: 0 -2px 12px rgba(0,0,0,0.3) !important;
        border-top-color: rgba(255,255,255,0.06) !important;
    }
}

/* =================================================================
   NOTEBOOK PANEL — EDITORIAL RESTYLE
   ================================================================= */

/* Panel background: warm parchment tone */
.notebook-panel {
    background-color: #f8f6f4 !important;
}

/* Header: editorial serif with subtle gradient */
.notebook-header {
    background: linear-gradient(135deg, #1a365d 0%, #234e78 100%) !important;
    padding: 16px 18px 14px !important;
}
.notebook-header h2 {
    font-family: 'Newsreader', Georgia, serif !important;
    font-style: italic !important;
    font-size: 1.3em !important;
    font-weight: 600 !important;
    letter-spacing: 0.5px;
}

/* Note count next to title */
#note-count-header {
    font-family: 'Inter', sans-serif;
    font-size: 0.65em !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6 !important;
}

/* Tabs: clean, no heavy borders */
.notebook-tabs {
    background: #f3f0ed !important;
    border-bottom: none !important;
    padding: 4px 8px !important;
    gap: 2px;
}
.nb-tab {
    border-radius: 6px !important;
    border-bottom: none !important;
    padding: 8px 10px !important;
    font-size: 0.8em !important;
}
.nb-tab.active {
    background: #fff !important;
    color: var(--brand-blue) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border-bottom: none !important;
}
.nb-tab:hover:not(.active) {
    background: rgba(255,255,255,0.5) !important;
}

/* Controls area: cleaner */
.notebook-controls {
    background: transparent !important;
    border-bottom: none !important;
    padding: 0 !important;
}
.notebook-search-row {
    padding: 10px 14px 6px !important;
}
.notebook-search-row input[type="text"] {
    background: #fff !important;
    border: 1px solid #e8e5e3 !important;
    border-radius: 8px !important;
    font-size: 0.82em !important;
    padding: 8px 12px !important;
}
.notebook-search-row input[type="text"]:focus {
    border-color: var(--brand-accent) !important;
    box-shadow: 0 0 0 3px rgba(90,153,184,0.1) !important;
}
.notebook-filter-row {
    padding: 4px 14px 8px !important;
    border-top: none !important;
}

/* Note cards: editorial card style */
.notebook-panel .note-card {
    background: #fff !important;
    border: none !important;
    border-left: 3px solid var(--brand-accent) !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 4px rgba(32,65,100,0.04) !important;
    margin-bottom: 10px !important;
    padding: 12px 14px !important;
}
.notebook-panel .note-card:hover {
    box-shadow: 0 3px 10px rgba(32,65,100,0.08) !important;
    transform: translateY(-1px);
}
.notebook-panel .note-card.office-note { border-left-color: #3b82f6 !important; }
.notebook-panel .note-card.admin-note { border-left-color: #ef4444 !important; }
.notebook-panel .note-card.pinned { border-left-color: #f59e0b !important; }

.notebook-panel .note-card-header {
    font-family: 'Manrope', 'Inter', sans-serif !important;
    font-weight: 700 !important;
    font-size: 0.88em !important;
    color: var(--brand-blue) !important;
}
.notebook-panel .note-card-body {
    font-size: 0.84em !important;
    line-height: 1.55 !important;
    color: #4a5568 !important;
}

/* Auth bar: subtle */
.notebook-panel #auth-container {
    background: transparent !important;
    border-bottom: 1px solid #e8e5e3 !important;
    font-size: 0.78em !important;
}

/* Notebook list: transparent, let panel bg show through */
.notebook-list {
    background: transparent !important;
    padding: 10px 12px !important;
}

/* Sign-in prompt: warm animated gradient */
.notebook-signin-prompt {
    background: linear-gradient(-45deg, #f5f0ec, #ede8e4, #f0eae6, #eee8f0, #f2ede8, #eae5e0) !important;
    background-size: 400% 400% !important;
    animation: nb-gradient-shift 15s ease infinite !important;
}

/* Footer: editorial dark bar */
.notebook-footer {
    background: linear-gradient(135deg, #1a365d 0%, #234e78 100%) !important;
    border-top: none !important;
}

/* Empty state */
.notebook-panel .note-card-empty,
.notebook-panel .notebook-list:empty::after {
    color: #a0a0a0;
    font-style: italic;
}

/* Dark mode overrides for editorial notebook */
body.dark-mode .notebook-panel { background-color: #1a1a1e !important; }
body.dark-mode .notebook-tabs { background: #222226 !important; }
body.dark-mode .nb-tab.active { background: #2a2a2e !important; box-shadow: none; }
body.dark-mode .notebook-search-row input[type="text"] { background: #2a2a2e !important; border-color: #3a3a3e !important; color: #e0e0e0 !important; }
body.dark-mode .notebook-panel .note-card { background: #2a2a2e !important; box-shadow: 0 1px 4px rgba(0,0,0,0.15) !important; }
body.dark-mode .notebook-panel .note-card-body { color: #b0b0b0 !important; }
body.dark-mode .notebook-panel #auth-container { border-color: #3a3a3e !important; }
body.dark-mode .notebook-footer { background: #0f172a !important; }
body.dark-mode .notebook-signin-prompt { background: linear-gradient(-45deg, #1a1a1e, #222230, #1e1e28, #252530, #1e1e24, #1a1a1e) !important; }

/* =================================================================
   PRINT-FRIENDLY STYLES
   ================================================================= */

@media print {
    .sidebar, .hamburger-menu, .overlay, .notebook-panel,
    .floating-toolbar, .toc-zoom-controls, .note-flag,
    .spot-toolbar, .note-modal-overlay, .announcement-banner,
    #notebook-btn, .login-overlay, .readaloud-player,
    .ra-article-btn { display: none !important; }

    html {
        overflow: visible !important;
        height: auto !important;
    }

    body {
        display: block !important;
        overflow: visible !important;
        height: auto !important;
        background: #fff !important;
    }

    .content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 20px !important;
        overflow: visible !important;
        min-height: auto !important;
        position: static !important;
    }

    .main-content {
        overflow: visible !important;
        font-size: 12pt !important;
    }

    .clause-row { break-inside: avoid; }
    h2 { break-after: avoid; }

    .cross-ref-link { color: inherit; border: none; text-decoration: underline; }
}

/* =================================================================
   MEMBER-MODE EMBED OVERRIDES (?mode=member)
   When iframed inside members.oectahw.com, slim the chrome to a reader-
   focused view: collapsed sidebar, minimal right-rail, no admin tooling.
   Additions only — no edits to existing rules so the master site
   (mode=public) is unaffected.
   ================================================================= */

/* Right-rail: hide Tools (Compare) + Maggie groups only.
   Keep Notebook, Zoom, Accessibility, Export. (Accessibility was initially
   slated for removal but kept after UX review — members benefit from in-context
   focus mode + contrast + dark-mode toggles.) */
body.mode-member .floating-toolbar [data-flyout="tools-flyout"],
body.mode-member #tools-flyout,
body.mode-member #maggie-btn,
body.mode-member .floating-toolbar .tb-divider:has(+ #maggie-btn) {
    display: none !important;
}

/* Hide the .tb-group wrapper around the dropped Tools flyout so flexbox doesn't
   reserve its slot. :has() has wide support as of 2026. */
body.mode-member .floating-toolbar .tb-group:has([data-flyout="tools-flyout"]) {
    display: none !important;
}

/* Lift the floating-toolbar from bottom-right to mid-right so it sits in the
   reading area, not behind the iframe's bottom edge / portal bottom-nav. */
body.mode-member .floating-toolbar {
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
}

/* Drop the reading-progress bar */
body.mode-member #reading-progress { display: none !important; }

/* Hide admin note rendering as defence-in-depth — the Firestore listener
   is also gated in script2.js, so admin_notes is never even fetched. */
body.mode-member .note-card.admin-note,
body.mode-member #admin-layer-toggle {
    display: none !important;
}

/* Sidebar collapsed by default on desktop too. Reuses the mobile slide-out
   pattern (existing hamburger click handler toggles body.sidebar-open). */
body.mode-member .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: var(--z-overlay);
}
body.mode-member.sidebar-open .sidebar {
    transform: translateX(0);
}

/* Content uses full width when sidebar is collapsed (sidebar is overlayed
   when open, not pushed-in, so margin stays 0 in either state). */
body.mode-member .content {
    margin-left: 0;
    width: 100%;
}

/* Hamburger toggle visible on desktop in member mode (existing JS click
   handler at script2.js:1689 already toggles body.sidebar-open).
   Solid brand-blue background + white border so it stands out against the
   light agreement content (the default desktop styling is translucent white,
   which disappears against the white reading column). */
body.mode-member .hamburger-menu {
    display: flex;
    background-color: var(--brand-blue) !important;
    border: 2px solid #ffffff !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
body.mode-member .hamburger-menu span {
    background-color: #ffffff !important;
}
body.mode-member .hamburger-menu:hover {
    transform: scale(1.05);
}

/* Overlay shown when sidebar is open — click outside closes it */
body.mode-member.sidebar-open .overlay {
    display: block;
}

/* Member-mode Focus Mode chip — bottom-left floating pill.
   Hidden by default; only visible when the embed sets body.mode-member. */
.member-focus-toggle { display: none; }
body.mode-member .member-focus-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: fixed;
    bottom: 16px;
    left: 16px;
    z-index: 1100;
    padding: 8px 14px 8px 12px;
    background-color: var(--brand-blue, #204164);
    color: #ffffff;
    border: 2px solid #ffffff;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: background-color 0.15s ease, transform 0.15s ease;
}
body.mode-member .member-focus-toggle:hover {
    transform: translateY(-1px);
    background-color: #2c5a8a;
}
body.mode-member .member-focus-toggle.is-on {
    background-color: var(--brand-accent, #f39c12);
    color: #1a1a1a;
}
body.mode-member .member-focus-toggle.is-on:hover {
    background-color: #ffb02e;
}
body.mode-member .member-focus-toggle .member-focus-label {
    line-height: 1;
}
@media (max-width: 480px) {
    body.mode-member .member-focus-toggle .member-focus-label { display: none; }
    body.mode-member .member-focus-toggle { padding: 8px 10px; }
}

/* Member-mode Read Aloud chip — bottom-right counterpart to the focus chip
   (which sits bottom-left). Same visual language: navy default, amber when on. */
.member-readaloud-toggle { display: none; }
body.mode-member .member-readaloud-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 1100;
    padding: 8px 14px 8px 12px;
    background-color: var(--brand-blue, #204164);
    color: #ffffff;
    border: 2px solid #ffffff;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: background-color 0.15s ease, transform 0.15s ease;
}
body.mode-member .member-readaloud-toggle:hover {
    transform: translateY(-1px);
    background-color: #2c5a8a;
}
body.mode-member .member-readaloud-toggle.is-on {
    background-color: var(--brand-accent, #f39c12);
    color: #1a1a1a;
}
body.mode-member .member-readaloud-toggle.is-on:hover {
    background-color: #ffb02e;
}
body.mode-member .member-readaloud-toggle .member-readaloud-label {
    line-height: 1;
}
@media (max-width: 480px) {
    body.mode-member .member-readaloud-toggle .member-readaloud-label { display: none; }
    body.mode-member .member-readaloud-toggle { padding: 8px 10px; }
}

/* In member mode, lift the readaloud-player above the chips so users can
   still reach the chip while the player is showing. */
body.mode-member #readaloud-player {
    bottom: 60px;
}

/* ═══════════════════════════════════════════════════════════════════
   COMMENT LOG AUDITOR (admin-only notebook tab)
   Visible only when isAdmin === true. Replaces the standard notebook
   list when its tab is active.
   ═══════════════════════════════════════════════════════════════════ */

.nb-tab.nb-tab-admin {
    color: #c0392b;
}
.nb-tab.nb-tab-admin.active {
    color: #c0392b;
    border-bottom-color: #c0392b;
}
.nb-tab.nb-tab-admin .tab-count {
    background-color: #c0392b;
}

.auditor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg-color);
}

.auditor-controls {
    flex-shrink: 0;
    background-color: var(--row-bg-even);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auditor-search-row,
.auditor-filter-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.auditor-search-row input[type="text"] {
    flex: 1;
    min-width: 180px;
    padding: 7px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: var(--font-sm);
    background-color: var(--bg-color);
    color: var(--text-color);
    outline: none;
}
.auditor-search-row input[type="text"]:focus {
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 2px rgba(90, 153, 184, 0.15);
}

.auditor-select {
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: var(--font-sm);
    cursor: pointer;
    max-width: 180px;
}

.auditor-orphan-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: var(--font-sm);
    color: var(--text-color);
    cursor: pointer;
}

.auditor-stat-strip {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    padding: 6px 0;
    font-size: var(--font-sm);
    color: var(--text-muted);
}
.auditor-stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.auditor-stat strong {
    color: var(--text-color);
    font-variant-numeric: tabular-nums;
}
.auditor-stat .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.auditor-stat .dot.yellow { background: #f1c40f; }
.auditor-stat .dot.blue   { background: #3498db; }
.auditor-stat .dot.red    { background: #c0392b; }
.auditor-stat .dot.grey   { background: #95a5a6; }
.auditor-stat.shown { margin-left: auto; }

.auditor-view-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    margin: 0 -12px;
    padding: 0 12px;
}
.auditor-view-tab {
    background: none;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: var(--font-sm);
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
}
.auditor-view-tab:hover { color: var(--brand-blue); }
.auditor-view-tab.active {
    color: var(--brand-blue);
    border-bottom-color: var(--brand-blue);
}

.auditor-action-row {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 4px;
}
.auditor-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: var(--font-sm);
    transition: background-color 0.15s ease;
}
.auditor-action-btn:hover { background-color: var(--row-bg-even); }
.auditor-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.auditor-action-btn.danger {
    color: #c0392b;
    border-color: rgba(192, 57, 43, 0.4);
}
.auditor-action-btn.danger:hover:not(:disabled) {
    background-color: rgba(192, 57, 43, 0.08);
}
.auditor-selection-count {
    font-size: var(--font-sm);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.auditor-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px 24px;
}

.auditor-loading,
.auditor-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 32px 12px;
    font-size: var(--font-sm);
}

/* Notes view — flat table */
.auditor-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-sm);
}
.auditor-table thead th {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
    font-weight: 600;
    background-color: var(--row-bg-even);
    position: sticky;
    top: 0;
    z-index: 1;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.auditor-table tbody tr {
    border-bottom: 1px solid var(--border-color);
}
.auditor-table tbody tr:hover {
    background-color: var(--row-bg-even);
}
.auditor-table tbody tr.is-orphan {
    background-color: rgba(149, 165, 166, 0.10);
}
.auditor-table td {
    padding: 6px 8px;
    vertical-align: top;
}
.auditor-table td.col-content {
    max-width: 360px;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.auditor-table td.col-author {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.auditor-table td.col-article {
    font-family: var(--font-mono, monospace);
    font-size: 0.85em;
    color: var(--text-muted);
    white-space: nowrap;
}
.auditor-layer-pill {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 0.7em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
}
.auditor-layer-pill.personal { background-color: #f1c40f; color: #4d3800; }
.auditor-layer-pill.office   { background-color: #3498db; }
.auditor-layer-pill.admin    { background-color: #c0392b; }
.auditor-orphan-flag {
    display: inline-block;
    padding: 1px 6px;
    margin-left: 6px;
    background-color: #95a5a6;
    color: white;
    border-radius: 10px;
    font-size: 0.7em;
    font-weight: 700;
}
.auditor-row-actions {
    display: inline-flex;
    gap: 4px;
}
.auditor-row-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
}
.auditor-row-btn:hover {
    color: var(--brand-blue);
    border-color: var(--border-color);
}
.auditor-row-btn.danger:hover { color: #c0392b; }

/* Group views — by article / by author / tags */
.auditor-group {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}
.auditor-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background-color: var(--row-bg-even);
    cursor: pointer;
    font-weight: 600;
    color: var(--text-color);
}
.auditor-group-header:hover { background-color: var(--bg-color); }
.auditor-group-header .auditor-group-count {
    background-color: var(--brand-blue);
    color: white;
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 0.75em;
}
.auditor-group-body {
    padding: 0;
}
.auditor-group-body .auditor-table thead { display: none; }

.auditor-tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.auditor-tag-cloud .tag-pill {
    cursor: pointer;
}

@media (max-width: 768px) {
    .auditor-search-row,
    .auditor-filter-row { gap: 6px; }
    .auditor-search-row input[type="text"] { min-width: 100%; }
    .auditor-table td.col-content { max-width: 200px; }
}

/* Print stylesheet — Save as PDF from the Auditor */
@media print {
    body * { visibility: hidden; }
    #auditor-panel, #auditor-panel * { visibility: visible; }
    #auditor-panel {
        position: absolute;
        left: 0; top: 0;
        width: 100%;
        background: white !important;
        color: #000 !important;
        font-size: 10pt;
        display: block !important;
    }
    .auditor-controls .auditor-action-row,
    .auditor-controls .auditor-view-tabs,
    .auditor-controls .auditor-search-row,
    .auditor-controls .auditor-filter-row,
    .auditor-row-actions,
    .auditor-row-btn,
    .note-check { display: none !important; }
    .auditor-table thead th { background: #eee !important; color: #000 !important; }
    .auditor-table tbody tr { page-break-inside: avoid; }
    .auditor-content { overflow: visible !important; padding: 0 !important; }
}
