/* ==========================================================================
   ci-theme.css — ConcreteInfo design tokens (cams2 port)
   --------------------------------------------------------------------------
   Single source of truth for the cams2 design tokens in the classic app.
   Colour/gray/radius/font values are copied verbatim from cams2-web
   src/index.css @theme (do not drift — update both together).
   - Task 2: Tailwind @theme aliases these --ci-* vars.
   - Task 4: hand-written shell classes consume them.
   Self-hosted brand font (Plus Jakarta Sans 400-800, body + display) is
   served from assets/vendor/fonts/fonts.css — the Google Fonts CDN was
   removed, and the condensed display face was retired for the single
   Plus Jakarta Sans family.
   ========================================================================== */

:root {
    /* Brand */
    --ci-brand-primary: #e5461f;
    --ci-brand-dark: #c93a18;
    --ci-brand-light: #ff6b47;

    /* Status */
    --ci-success: #1a7a56;
    --ci-warning: hsl(45, 93%, 47%);
    --ci-danger: hsl(0, 84%, 60%);
    --ci-info: hsl(199, 89%, 48%);

    /* Gray ramp (cams2 values; 400-600 are AA-text-dark in light mode) */
    --ci-gray-50: #fafbfc;
    --ci-gray-100: #f5f5f5;
    --ci-gray-200: #e3e3e3;
    --ci-gray-300: #d1d1d1;
    --ci-gray-400: #6e6c6c;
    --ci-gray-500: #666464;
    --ci-gray-600: #5e5c5c;
    --ci-gray-700: #565454;
    --ci-gray-800: #4e4e4e;
    --ci-gray-900: #464646;
    --ci-gray-950: #0d0b09;

    /* Radii */
    --ci-radius-sm: 4px;
    --ci-radius-md: 8px;
    --ci-radius-lg: 12px;
    --ci-radius-xl: 16px;

    /* Type */
    --ci-font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    /* Display face: Plus Jakarta Sans (700/800) — same family as body, so
       headings and values read as one system. (Retuned from the condensed
       face: non-condensed glyphs run wider, so sizes/tracking are tighter.) */
    --ci-font-display: 'Plus Jakarta Sans', var(--ci-font-sans);
    --ci-font-mono: 'SF Mono', 'Fira Code', Consolas, monospace;

    /* Derived surfaces/text (this port's design calls, not cams2 literals) */
    --ci-surface: var(--ci-gray-50);
    --ci-surface-raised: #ffffff;
    --ci-text: var(--ci-gray-900);
    --ci-text-muted: var(--ci-gray-500);
    --ci-border: var(--ci-gray-200);

    /* Hover surface (cams2 hover:bg-gray-100 / dark:hover:bg-gray-800) */
    --ci-surface-hover: var(--ci-gray-100);

    /* Sidebar: light = raised surface (white), dark = gray-900-equivalent
       raised (#1a1815) — parity with cams2's bg-white dark:bg-gray-900. */
    --ci-sidebar-bg: var(--ci-surface-raised);
}

/* Dark mode: cams2 restores the lighter mid-grays muted for light-mode AA
   text; the derived-surface overrides below are this port's design calls. */
.dark {
    --ci-gray-400: #b0b0b0;
    --ci-gray-500: #9a9696;
    --ci-gray-600: #828080;

    /* Port design calls (dark surfaces sit on warm near-black, not gray) */
    --ci-surface: var(--ci-gray-950);
    --ci-surface-raised: #1a1815;
    --ci-text: var(--ci-gray-100);
    --ci-text-muted: var(--ci-gray-400);
    --ci-border: #2a2724;
    --ci-surface-hover: #262320;
    --ci-sidebar-bg: #1a1815;
}

/* ── Opt-in body baseline ──────────────────────────────────────────────────
   Shell pages opt in via <body class="ci-body"> until the shell rewrite
   (Task 4) lands. The :has() guard means pages that have NOT opted in keep
   their current Bootstrap sizing/typography untouched. */
html:has(body.ci-body) {
    font-size: 15px;
}

body.ci-body {
    font-family: var(--ci-font-sans);
    color: var(--ci-text);
    background: var(--ci-surface);
}

/* ── data-font fallback map ────────────────────────────────────────────────
   themes.css offers font choices (data-font on <html>) that historically
   resolved via the Google Fonts CDN. The CDN was removed, so every offered
   key maps here to a local stack: the named family first (honours users
   who have it installed locally), then legible system fallbacks. No
   network fetch in any case. */
html[data-font="system"] body.ci-body,
html[data-font="inter"] body.ci-body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

html[data-font="poppins"] body.ci-body {
    font-family: 'Poppins', 'Segoe UI', 'Plus Jakarta Sans', sans-serif;
}

html[data-font="roboto"] body.ci-body {
    font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

html[data-font="opensans"] body.ci-body {
    font-family: 'Open Sans', 'Segoe UI', Arial, sans-serif;
}

html[data-font="lato"] body.ci-body {
    font-family: 'Lato', 'Segoe UI', Arial, sans-serif;
}

html[data-font="nunito"] body.ci-body {
    font-family: 'Nunito', 'Trebuchet MS', 'Segoe UI', sans-serif;
}

html[data-font="sourcesans"] body.ci-body {
    font-family: 'Source Sans 3', 'Source Sans Pro', 'Segoe UI', Arial, sans-serif;
}

html[data-font="montserrat"] body.ci-body {
    font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
}

html[data-font="raleway"] body.ci-body {
    font-family: 'Raleway', 'Segoe UI', Arial, sans-serif;
}

html[data-font="ubuntu"] body.ci-body {
    font-family: 'Ubuntu', 'Segoe UI', Arial, sans-serif;
}

/* ==========================================================================
   Shell (cams2 look) — sidebar, topbar, content, footer, nav, login card
   --------------------------------------------------------------------------
   Colours resolve ONLY through --ci-* tokens (plus the --theme-primary
   fallback chain) so every rule below is correct in BOTH modes and the
   25-theme data-theme primary still tints active states. */
/* themes.css paints body + legacy internals (.card/.table/inputs) via
   --theme-* properties with !important; html.dark (0,1,1) outranks its
   [data-theme] blocks (0,1,0), so .dark flips the whole page by re-pointing
   the same variables the legacy sheets already consume — mirroring what the
   5 legacy dark themes define, mapped onto the ci token ramp. */
html.dark {
    --theme-bg-body: var(--ci-gray-950);
    --theme-text-primary: var(--ci-gray-100);
    --theme-text-secondary: var(--ci-gray-400);
    --theme-text-muted: var(--ci-gray-500);
    --theme-text-inverse: var(--ci-gray-950);
    --theme-bg-card: var(--ci-surface-raised);
    --theme-bg-header: var(--ci-surface-raised);
    --theme-bg-input: color-mix(in srgb, var(--ci-surface-raised) 88%, var(--ci-gray-100) 12%);
    --theme-bg-hover: color-mix(in srgb, var(--theme-primary, var(--ci-brand-primary)) 15%, transparent);
    --theme-border: var(--ci-border);
    --theme-border-light: color-mix(in srgb, var(--ci-border) 70%, var(--ci-gray-400));
    --theme-table-header-bg: color-mix(in srgb, var(--ci-surface-raised) 88%, var(--ci-gray-100) 12%);
    --theme-table-header-text: var(--ci-gray-100);
    --theme-table-row-hover: color-mix(in srgb, var(--theme-primary, var(--ci-brand-primary)) 10%, transparent);
    --theme-table-border: var(--ci-border);
    --theme-input-bg: color-mix(in srgb, var(--ci-surface-raised) 88%, var(--ci-gray-100) 12%);
    --theme-input-border: var(--ci-border);
    --theme-input-text: var(--ci-gray-100);
    --theme-input-placeholder: var(--ci-text-muted);
    --theme-dropdown-bg: var(--ci-surface-raised);
    --theme-dropdown-text: var(--ci-gray-100);
    --theme-dropdown-hover: color-mix(in srgb, var(--ci-surface-raised) 88%, var(--ci-gray-100) 12%);
    --theme-dropdown-border: var(--ci-border);
}

/* Same trick for the body font: themes.css applies
   font-family: var(--theme-font-family) !important. For the default/system
   font choice re-point the variable at the PJS stack (other data-font
   choices keep their themes.css families). */
html:not([data-font]) body.ci-body,
html[data-font="system"] body.ci-body {
    --theme-font-family: var(--ci-font-sans);
}

/* ── Layout frames (cams2 geometry: fixed 264px sidebar, fixed h-16 topbar,
      main offset by both — see AppLayout.tsx) ─────────────────────────────
   The collapse state lives on <html> as .ci-collapsed (applied pre-paint in
   header.php from localStorage `ci_nav_collapsed`); the rail is 72px then.
   Collapse rules are scoped to >=1024px so the mobile drawer always opens
   at full width. */
.ci-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    height: 100vh;
    width: 264px;
    display: flex;
    flex-direction: column;
    background: var(--ci-sidebar-bg);
    border-right: 1px solid var(--ci-border);
    transition: width 0.3s ease, transform 0.3s ease;
}

.ci-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
}

.ci-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1rem;
    background: var(--ci-surface-raised);
    border-bottom: 1px solid var(--ci-border);
    transition: left 0.3s ease;
}

.ci-main {
    margin-left: 264px;
    min-height: 100vh;
    padding-top: 64px; /* clears the fixed topbar (cams2 pt-16) */
    background: var(--ci-surface);
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.ci-content {
    flex: 1;
    max-width: none;
    padding: 1rem 1rem 5rem; /* cams2 p-4 pb-20 */
}

.ci-footer {
    border-top: 1px solid var(--ci-border);
    color: var(--ci-text-muted);
    font-size: 0.8rem;
    text-align: center;
    padding: 0.9rem 1.5rem;
}

/* ── Topbar internals (cams2 Header.tsx) ─────────────────────────────────── */
.ci-topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    flex: 1;
}

.ci-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Wordmark: plain semibold text (NOT the old uppercase display page-title —
   cams2's header carries a wordmark, pages own their headings). */
.ci-topbar-title {
    display: none; /* hidden below lg, like cams2's hidden lg:inline */
    margin: 0;
    font-family: var(--ci-font-sans);
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--ci-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Menu button (mobile drawer) — p-2 rounded-lg ghost */
.ci-topbar-menu {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border: none;
    border-radius: var(--ci-radius-md);
    background: transparent;
    color: var(--ci-text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.ci-topbar-menu:hover {
    background: var(--ci-surface-hover);
    color: var(--ci-text);
}

/* Dark toggle — p-2 rounded-lg ghost */
.ci-dark-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border: none;
    border-radius: var(--ci-radius-md);
    background: transparent;
    color: var(--ci-text-muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.ci-dark-toggle:hover {
    background: var(--ci-surface-hover);
    color: var(--ci-text);
}

/* Icon swap is CSS-driven: moon shown in light mode, sun in dark mode. */
.ci-dark-toggle .ci-dark-icon-sun { display: none; }
.dark .ci-dark-toggle .ci-dark-icon-sun { display: block; }
.dark .ci-dark-toggle .ci-dark-icon-moon { display: none; }

/* User cluster: left-border separator + avatar chip + name (cams2 Header) */
.ci-topbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: 0.5rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--ci-border);
}

.ci-userbtn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
    border-radius: var(--ci-radius-md);
    background: transparent;
    color: var(--ci-text) !important;
    text-decoration: none;
    font-size: 0.875rem;
}

.ci-userbtn:hover .ci-username {
    color: var(--theme-primary, var(--ci-brand-primary));
}

/* Bootstrap dropdown caret removed — cams2 shows none */
.ci-userbtn.dropdown-toggle::after {
    display: none;
}

.ci-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--theme-primary, var(--ci-brand-primary)) 10%, transparent);
    color: var(--theme-primary, var(--ci-brand-primary));
    flex-shrink: 0;
}

.ci-username {
    display: none; /* hidden below sm, like cams2's hidden sm:inline */
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    transition: color 0.15s ease;
}

/* Dark-aware Bootstrap dropdown (topbar user menu) */
.dark .dropdown-menu {
    background: var(--ci-surface-raised);
    border-color: var(--ci-border);
}
.dark .dropdown-item { color: var(--ci-gray-100); }
.dark .dropdown-item:hover,
.dark .dropdown-item:focus { background: color-mix(in srgb, var(--ci-gray-100) 8%, transparent); color: #fff; }
.dark .dropdown-header { color: var(--ci-text-muted); }
.dark .dropdown-divider { border-color: var(--ci-border); }

/* ── Sidebar header (h-16 lockup, cams2 Sidebar.tsx) ─────────────────────── */
.ci-sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    height: 64px;
    padding: 0 1rem;
    border-bottom: 1px solid var(--ci-border);
    flex-shrink: 0;
}

.ci-sidebar-header img {
    height: 32px;
    width: auto;
}

/* ConcreteInfo brand rule: the logo never sits directly on dark — wrap it in
   a white chip (rounded-lg p-1) which only paints in dark mode. */
.ci-logo-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--ci-radius-lg);
    flex-shrink: 0;
}

.dark .ci-logo-chip {
    background: #fff;
    padding: 4px;
}

.ci-sidebar-lockup {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    line-height: 1.25;
}

.ci-lockup-title {
    font-family: var(--ci-font-display);
    font-size: 0.9375rem; /* text-sm at html 15px */
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ci-text);
    white-space: nowrap;
}

.ci-lockup-sub {
    font-family: var(--ci-font-display);
    font-size: 0.75rem; /* text-xs */
    font-weight: 400;
    color: var(--ci-text-muted);
    white-space: nowrap;
}

/* ── Nav area (flex-1 px-3 py-4 space-y-1, cams2) ────────────────────────── */
.ci-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem 0.75rem;
}

/* space-y-1 between the nav's direct children */
.ci-nav > * + * {
    margin-top: 0.25rem;
}

/* Group accordion header: text-xs font-semibold uppercase tracking-wider */
.ci-nav-group {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem;
    margin: 1rem 0 0.25rem; /* cams2 mt-4 mb-1 (first group too) */
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ci-gray-400);
    cursor: pointer;
    transition: color 0.15s ease;
}

.ci-nav-group:hover {
    color: var(--ci-gray-600);
}

.dark .ci-nav-group {
    color: var(--ci-gray-500);
}

.dark .ci-nav-group:hover {
    color: var(--ci-gray-400);
}

/* Group holding the active route — brand label + forced open (server side) */
.ci-nav-group.is-active {
    color: var(--theme-primary, var(--ci-brand-primary));
}

.ci-nav-group .ci-chevron {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.ci-nav-group[aria-expanded="false"] .ci-chevron {
    transform: rotate(-90deg);
}

/* Group body (space-y-0.5 inside) */
.ci-group-body {
    padding: 0;
}

.ci-group-body.is-closed {
    display: none;
}

.ci-group-body > * + * {
    margin-top: 0.125rem;
}

/* Item colours — layout (flex/gap/rounded/px/py/text-sm) comes from Tailwind
   utilities on the element; these rules own the colour states only. */
.ci-nav-item {
    color: var(--ci-text-muted);
    text-decoration: none;
}

.ci-nav-item:hover {
    background: var(--ci-surface-hover);
    color: var(--ci-text);
}

.ci-nav-item.active {
    background: color-mix(in srgb, var(--theme-primary, var(--ci-brand-primary)) 10%, transparent);
    color: var(--theme-primary, var(--ci-brand-primary));
}

.ci-nav-item .ci-icon { flex-shrink: 0; }

/* Badge pill (cams2: px-2 py-0.5 rounded-full text-xs font-medium
   bg-brand-primary/10 text-brand-primary) — offline-sync pending count etc. */
.ci-nav-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: color-mix(in srgb, var(--theme-primary, var(--ci-brand-primary)) 10%, transparent);
    color: var(--theme-primary, var(--ci-brand-primary));
    flex-shrink: 0;
}

/* ── Sidebar bottom rail (px-3 py-3 border-t + collapse button) ──────────── */
.ci-sidebar-foot {
    flex-shrink: 0;
    padding: 0.75rem;
    border-top: 1px solid var(--ci-border);
}

.ci-nav-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    color: var(--ci-text-muted);
    white-space: nowrap;
    overflow: hidden;
}

/* Collapse toggle — display flipped on at lg+ in the media block below
   (cams2: hidden lg:flex, visible in BOTH rail states). */
.ci-collapse-btn {
    display: none;
    width: 100%;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0;
    border: none;
    border-radius: var(--ci-radius-md);
    background: transparent;
    color: var(--ci-gray-400);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.ci-collapse-btn:hover {
    background: var(--ci-surface-hover);
    color: var(--ci-gray-600);
}

.dark .ci-collapse-btn:hover {
    color: var(--ci-gray-400);
}

/* Chevron swap is CSS-driven off the html-level collapse class. */
.ci-collapse-btn .ci-collapse-icon-right { display: none; }
html.ci-collapsed .ci-collapse-btn .ci-collapse-icon-right { display: block; }
html.ci-collapsed .ci-collapse-btn .ci-collapse-icon-left { display: none; }

/* ── Collapsed rail (>=1024px): 72px, no group headers, icon-only items ──── */
@media (min-width: 1024px) {
    html.ci-collapsed .ci-sidebar {
        width: 72px;
    }

    html.ci-collapsed .ci-main {
        margin-left: 72px;
    }

    html.ci-collapsed .ci-nav-group,
    html.ci-collapsed .ci-nav-meta {
        display: none;
    }

    /* All groups render open as an icon rail (cams2 collapsed behaviour) */
    html.ci-collapsed .ci-group-body {
        display: block;
    }

    html.ci-collapsed .ci-group-body > * + * {
        margin-top: 0.25rem; /* match top-item rhythm in rail mode */
    }

    html.ci-collapsed .ci-nav-item {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    html.ci-collapsed .ci-nav-label,
    html.ci-collapsed .ci-nav-badge {
        display: none;
    }

    html.ci-collapsed .ci-sidebar-header {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    html.ci-collapsed .ci-sidebar-lockup {
        display: none;
    }

    /* The 200x56 wordmark is ~114px wide at h-8 — too wide for the 72px
       rail. cams2 constrains the collapsed logo to h-8 max-w-[40px]
       object-contain; do the same so the chip centers cleanly. */
    html.ci-collapsed .ci-logo-chip img {
        max-width: 40px;
        object-fit: contain;
    }

    .ci-collapse-btn {
        display: flex;
    }

    .ci-topbar-title {
        display: block;
    }
}

@media (min-width: 1024px) {
    html:not(.ci-collapsed) .ci-topbar { left: 264px; }
    html.ci-collapsed .ci-topbar { left: 72px; }
}

@media (min-width: 640px) {
    .ci-username {
        display: inline;
    }

    .ci-content {
        padding: 1.5rem 1.5rem 5rem; /* sm:p-6 keeps pb-20 */
    }

    .ci-topbar {
        padding: 0 1.5rem; /* sm:px-6 */
    }
}

@media (min-width: 1024px) {
    .ci-content {
        padding-bottom: 1.5rem; /* lg:pb-6 */
    }
}

/* ── Mobile drawer (<1024px) ─────────────────────────────────────────────── */
@media (max-width: 1023.98px) {
    .ci-sidebar {
        transform: translateX(-100%);
    }

    .ci-sidebar.show {
        transform: none;
    }

    .ci-sidebar-backdrop.show {
        display: block;
    }

    .ci-main {
        margin-left: 0;
    }

    .ci-topbar {
        left: 0;
    }

    .ci-topbar-menu {
        display: inline-flex;
    }
}

/* ── Phone bottom navigation (<768px) ────────────────────────────────────────
   Rendered by includes/footer.php on every page. z-index 35 sits above page
   content and the fixed topbar (30) but below the drawer backdrop (40), so an
   open sidebar covers the bar. Desktop never sees it. */
.ci-bottom-nav {
    display: none;
}

@media (max-width: 767.98px) {
    .ci-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 35;
        display: flex;
        background: var(--ci-surface-raised);
        border-top: 1px solid var(--ci-border);
        padding-bottom: env(safe-area-inset-bottom);
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
    }

    .ci-bottom-nav-item {
        flex: 1 1 0;
        min-height: 56px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        font-size: 0.68rem;
        font-weight: 600;
        color: var(--ci-text-muted);
        text-decoration: none;
        background: none;
        border: 0;
    }

    .ci-bottom-nav-item.active {
        color: var(--theme-primary, var(--ci-brand-primary));
    }

    .ci-bottom-nav-item.active .ci-icon {
        stroke-width: 2.25;
    }

    /* Reserve the bar's height so page content and the footer never hide
       behind it (footer sits inside .ci-main). */
    .ci-main {
        padding-bottom: calc(64px + env(safe-area-inset-bottom));
    }

    /* Topbar compaction — reclaim horizontal room on phones */
    .ci-topbar {
        padding: 0 0.75rem;
    }

    .ci-topbar-title {
        font-size: 0.95rem;
    }

    .ci-topbar-user .ci-username {
        display: none;
    }

    /* iOS zoom guard: controls under 16px trigger focus auto-zoom. The
       compound selectors outrank the component layer (ci-components.css
       loads after this file) and its 1rem/0.875rem sizes — with the 15px
       root, plain single-class rules here would lose the cascade. */
    .ci-form-control,
    .ci-form-select,
    .ci-form-control--sm,
    .ci-form-control.ci-form-control,
    .ci-form-select.ci-form-select,
    .ci-form-control--sm.ci-form-control--sm,
    textarea.ci-form-control {
        font-size: 16px;
    }
}

@media (max-width: 479.98px) {
    .ci-topbar-title {
        display: none;
    }
}

@media print {
    .ci-bottom-nav {
        display: none !important;
    }
}

/* ── Phone sticky action bar (<768px) ───────────────────────────────────────
   A duplicate of a form's primary actions (same <form>, type="submit"
   buttons), fixed directly above the bottom navigation so Save/Create stays
   in reach on long pages. Hidden ≥768px — the page's inline button row is the
   desktop control. Place .ci-action-bar-spacer right after the form so the
   last fields scroll clear of the fixed bar. */
.ci-action-bar { display: none; }
.ci-action-bar-spacer { display: none; }

@media (max-width: 767.98px) {
    .ci-action-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: calc(57px + env(safe-area-inset-bottom));
        z-index: 34;
        display: flex;
        gap: 0.5rem;
        align-items: center;
        padding: 0.65rem 0.9rem;
        background: var(--ci-surface-raised);
        border-top: 1px solid var(--ci-border);
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
    }

    .ci-action-bar .ci-btn {
        flex: 1 1 0;
        min-height: 44px;
        justify-content: center;
    }

    .ci-action-bar-spacer {
        display: block;
        height: 64px;
    }
}

/* ── Audit pages on phones (<768px) ────────────────────────────────────────
   Page-scoped helpers; desktop rendering is untouched. */
@media (max-width: 767.98px) {
    /* Audit list: icon actions and pagination get 44px touch targets and wrap
       instead of squeezing into one row. */
    .ci-audit-list .ci-btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .ci-audit-list .ci-btn-group > .ci-btn,
    /* Row actions submitted through a form (schedules activate/deactivate). */
    .ci-audit-list .ci-btn-group > form > .ci-btn {
        min-width: 44px;
        min-height: 44px;
        margin-left: 0;
        border-radius: var(--ci-radius-md);
    }

    .ci-audit-list .ci-pagination {
        flex-wrap: wrap;
        justify-content: center;
    }

    .ci-audit-list .ci-page-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
    }

    /* Audit form: the category selector (up to 22 rows) must not push the
       checklist form off-screen. Cap it and scroll it internally (momentum
       scrolling on iOS). */
    .ci-category-panel {
        max-height: 45vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Active category row: the brand background must carry white text at every
   width — the item-count line's .text-gray-500 must not win over it. */
.ci-category-panel .ci-list-group-item.active,
.ci-category-panel .ci-list-group-item.active small {
    color: #fff;
}

/* Create audit: the category checklist fits one column on phones. The shared
   12-column grid already collapses below md; this guarantees it below 640px
   regardless of future utility changes. Doubled class outranks the utility
   layer (tailwind-output.css loads last). */
@media (max-width: 639.98px) {
    .ci-category-grid.ci-category-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .ci-category-grid > .category-item {
        grid-column: auto;
    }
}

/* ── Page header ──────────────────────────────────────────────────────────
   Title + description opposite the page's primary action. On phones it
   stacks, so a wide button never squeezes the title into a narrow column. */
.ci-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.ci-page-header > :first-child {
    flex: 1 1 auto;
    min-width: 0;
}

/* Variant used inside a card header — no extra bottom margin. */
.ci-page-header--inline {
    margin-bottom: 0;
}

@media (max-width: 767.98px) {
    .ci-page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .ci-page-header > :first-child {
        flex: 1 1 100%;
    }

    /* Header actions are the page's primary controls — full touch targets. */
    .ci-page-header .ci-btn {
        min-height: 44px;
    }
}

/* ── Inline form action row ───────────────────────────────────────────────
   A form that ends with .ci-form-actions (Cancel + Save/Create) wraps its
   buttons on phones instead of overflowing; the fixed .ci-action-bar, where
   present, remains the thumb-zone copy of the primary action. Desktop is
   untouched. */
@media (max-width: 767.98px) {
    .ci-form-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .ci-form-actions .ci-btn {
        min-height: 44px;
    }
}

/* Settings hub cards: the Configure/Manage link inside each tile is the whole
   call to action, so give it a 44px target on phones. */
@media (max-width: 767.98px) {
    .ci-settings-grid .ci-btn,
    .ci-card-body .ci-btn {
        min-height: 44px;
    }
}

/* ── Checkbox / radio lists ───────────────────────────────────────────────
   Toggle grids (organisation module and domain enablement) get a 44px row
   target and a larger control on phones. Desktop is untouched. */
@media (max-width: 767.98px) {
    .ci-check-list .ci-form-check {
        display: flex;
        align-items: flex-start;
        min-height: 44px;
        padding-left: 2.25em;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .ci-check-list .ci-form-check-input {
        width: 1.35rem;
        height: 1.35rem;
        margin-left: -2.25em;
        margin-top: 0.1rem;
    }
}

/* ── Content components (dashboard; reusable on later ci pages) ──────────── */

/* Stat tiles: label row (icon + uppercase label) over a big display number. */
.ci-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* auto-fit kicks in once tiles fit: 2 cols mobile → fluid row on wider viewports */
@media (min-width: 640px) {
    .ci-stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

.ci-stat {
    background: var(--ci-surface-raised);
    border: 1px solid var(--ci-border);
    border-radius: var(--ci-radius-lg);
    padding: 1rem 1.25rem;
}

.ci-stat-label-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.ci-stat .ci-icon { color: var(--ci-brand-primary); }
.ci-stat.ci-stat--success .ci-icon { color: var(--ci-success); }
.ci-stat.ci-stat--warning .ci-icon { color: var(--ci-warning); }
.ci-stat.ci-stat--danger .ci-icon { color: var(--ci-danger); }

.ci-stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ci-text-muted);
}

.ci-stat-value {
    font-family: var(--ci-font-display);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.15;
    color: var(--ci-text);
}

.ci-stat-sub {
    margin-top: 0.15rem;
    font-size: 0.75rem;
    color: var(--ci-text-muted);
}

/* Chart canvases get a fixed-height box: Chart.js runs with
   maintainAspectRatio:false so a doughnut cannot grow to card width. */
.ci-chart-box {
    position: relative;
    width: 100%;
    height: 260px;
}

@media (max-width: 767.98px) {
    .ci-chart-box { height: 220px; }
}

.ci-chart-box > canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Cards: quiet surface + border, no heavy shadows. */
.ci-card {
    background: var(--ci-surface-raised);
    border: 1px solid var(--ci-border);
    border-radius: var(--ci-radius-lg);
}

.ci-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--ci-border);
}

/*
 * A coloured header/footer is a flush child painting its own background, so
 * it must carry the card's corner radius itself. The card does not clip its
 * children (overflow: hidden there would cut dropdown menus inside card
 * bodies), so the radius is applied to the first header and last footer,
 * inset by the card's 1px border.
 */
.ci-card > .ci-card-header:first-child {
    border-top-left-radius: calc(var(--ci-radius-lg) - 1px);
    border-top-right-radius: calc(var(--ci-radius-lg) - 1px);
}

.ci-card > .ci-card-footer:last-child {
    border-bottom-left-radius: calc(var(--ci-radius-lg) - 1px);
    border-bottom-right-radius: calc(var(--ci-radius-lg) - 1px);
}

.ci-card-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-family: var(--ci-font-display);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    /* Direct token: flips with .dark — no theme-name indirection left. */
    color: var(--ci-text);
}

.ci-card-title .ci-icon { color: var(--theme-primary, var(--ci-brand-primary)); }

/*
 * A coloured card header (bg-brand-primary / bg-ci-* / inline background) sets
 * text-white on the header element, but the title carried its own
 * `color: var(--ci-text)` and so rendered dark-on-dark; its icon stayed brand
 * orange, invisible on a brand-coloured band.
 *
 * :where() keeps this rule at the specificity of the class inside it (0,1,0),
 * so a title that sets its own text-* utility still wins — only the header's
 * inherited colour is picked up.
 */
.ci-card-header :where(.ci-card-title) { color: inherit; }

.ci-card-header.text-white .ci-card-title .ci-icon,
.ci-card-header[style*="background"] .ci-card-title .ci-icon {
    color: inherit;
}

.ci-card-body {
    padding: 1.25rem;
}

/* Flush variant for full-bleed content (tables) inside a card. */
.ci-card-body--flush {
    padding: 0;
}

/* Tables: borderless rows, hairline row separators, quiet uppercase header. */
.ci-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    color: var(--ci-text);
}

.ci-table th {
    padding: 0.75rem 1.25rem;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ci-text-muted);
    border-bottom: 1px solid var(--ci-border);
    white-space: nowrap;
}

.ci-table td {
    padding: 0.8rem 1.25rem;
    border-bottom: 1px solid var(--ci-border);
    vertical-align: middle;
}

.ci-table tbody tr:last-child td { border-bottom: none; }

.ci-table tbody tr:hover {
    background: color-mix(in srgb, var(--ci-text) 4%, transparent);
}

/* Muted empty-state blocks (tables with no rows, panels with no data). */
.ci-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--ci-text-muted);
}

.ci-empty .ci-icon {
    display: block;
    margin: 0 auto 0.75rem;
    opacity: 0.6;
}

.ci-empty-note {
    margin: 0;
    padding: 1.25rem 0;
    font-size: 0.85rem;
    text-align: center;
    color: var(--ci-text-muted);
}

/* ── Login card (index.php / login.php twins) ────────────────────────────── */
.ci-login-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.ci-login-card {
    width: 100%;
    max-width: 420px;
    background: var(--ci-surface-raised);
    border: 1px solid var(--ci-border);
    border-radius: var(--ci-radius-lg);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 10px 30px rgba(0, 0, 0, 0.1);
}

.dark .ci-login-card {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.ci-login-accent {
    height: 4px;
    background: var(--theme-primary, var(--ci-brand-primary));
}

.ci-login-head {
    padding: 2.25rem 2rem 1.5rem;
    text-align: center;
}

.ci-login-head img {
    max-width: 190px;
    height: auto;
    margin-bottom: 0.9rem;
}

.ci-login-title {
    font-family: var(--ci-font-display);
    font-size: 1.35rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--ci-text);
    margin: 0;
}

.ci-login-sub {
    font-family: var(--ci-font-sans);
    font-size: 0.9rem;
    color: var(--ci-text-muted);
    margin: 0.35rem 0 0;
}

.ci-login-body {
    padding: 0 2rem 2rem;
}

.ci-login-body .form-label {
    color: var(--ci-text);
    font-size: 0.85rem;
    font-weight: 600;
}

.ci-login-body .input-group-text {
    background: var(--ci-gray-100);
    border-color: var(--ci-border);
    color: var(--ci-text-muted);
}

.dark .ci-login-body .input-group-text {
    background: var(--ci-surface-raised);
}

.ci-login-body .form-control {
    background: var(--ci-surface-raised);
    border-color: var(--ci-border);
    color: var(--ci-text);
}

.ci-login-body .form-control::placeholder {
    color: var(--ci-text-muted);
}

.ci-login-body .form-control:focus {
    background: var(--ci-surface-raised);
    border-color: var(--theme-primary, var(--ci-brand-primary));
    color: var(--ci-text);
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--theme-primary, var(--ci-brand-primary)) 25%, transparent);
}

.ci-login-body .form-check-label {
    color: var(--ci-text-muted);
}

/* Chrome autofill paints its own light background over dark inputs. */
.ci-login-body .form-control:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px var(--ci-surface-raised) inset;
    -webkit-text-fill-color: var(--ci-text);
    transition: background-color 9999s ease-out;
}

.ci-login-btn {
    display: block;
    width: 100%;
    padding: 0.7rem 1rem;
    border: none;
    border-radius: var(--ci-radius-md);
    background: var(--theme-primary, var(--ci-brand-primary));
    color: #fff;
    font-family: var(--ci-font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.ci-login-btn:hover {
    background: var(--ci-brand-dark);
    color: #fff;
}

.ci-login-btn:active { transform: translateY(1px); }

.ci-login-footnote {
    margin-top: 1.25rem;
    font-size: 0.8rem;
    color: var(--ci-text-muted);
}

/* ==========================================================================
   Audit Notes panel (modules/audits/edit.php + assets/js/audit-notes.js)
   --------------------------------------------------------------------------
   cams2-shell restyle of the Quill notes card. Every colour resolves
   through --ci-* / --theme-* tokens so the panel is correct in light and
   dark. Quill's snow theme is white-by-default — the .dark block below
   re-skins toolbar strokes, pickers, placeholder and code chips.
   ========================================================================== */

/* Header: saved-note count pill */
.ci-notes-count {
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--ci-border);
    font-family: var(--ci-font-sans);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--ci-text-muted);
}

/* Header: collapse trigger (ghost icon button; Bootstrap's collapse plugin
   toggles .collapsed on it, which rotates the chevron) */
.ci-notes-collapse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--ci-border);
    border-radius: var(--ci-radius-md);
    background: transparent;
    color: var(--ci-text-muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.ci-notes-collapse:hover {
    color: var(--ci-text);
    background: color-mix(in srgb, var(--ci-text) 8%, transparent);
}

.ci-notes-collapse .ci-icon {
    transition: transform 0.2s ease;
}

.ci-notes-collapse.collapsed .ci-icon {
    transform: rotate(-90deg);
}

/* Rail: saved-notes list */
.ci-notes-rail {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 30rem;
    overflow-y: auto;
}

.ci-notes-empty {
    padding: 0.75rem 0.25rem;
    font-size: 0.8rem;
    color: var(--ci-text-muted);
}

.ci-notes-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--ci-border);
    border-radius: var(--ci-radius-md);
    background: transparent;
    color: var(--ci-text);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.ci-notes-item:hover {
    background: color-mix(in srgb, var(--ci-text) 5%, transparent);
}

.ci-notes-item.is-active {
    border-color: color-mix(in srgb, var(--theme-primary, var(--ci-brand-primary)) 45%, transparent);
    background: color-mix(in srgb, var(--theme-primary, var(--ci-brand-primary)) 9%, transparent);
}

.ci-notes-item-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ci-notes-item-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85rem;
    font-weight: 600;
}

.ci-notes-pinmark {
    color: var(--ci-text-muted);
    flex-shrink: 0;
}

.ci-notes-item.is-active .ci-notes-pinmark {
    color: var(--theme-primary, var(--ci-brand-primary));
}

.ci-notes-item-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.2rem;
    font-size: 0.72rem;
    color: var(--ci-text-muted);
}

.ci-notes-chip {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.62rem;
    font-weight: 600;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--ci-text-muted) 40%, transparent);
}

/* Note colour dots (colour names come from the note API enum) */
.ci-notes-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ci-notes-dot--primary { background: var(--theme-primary, var(--ci-brand-primary)); }
.ci-notes-dot--success { background: var(--ci-success); }
.ci-notes-dot--warning { background: var(--ci-warning); }
.ci-notes-dot--danger  { background: var(--ci-danger); }
.ci-notes-dot--info    { background: var(--ci-info); }
.ci-notes-dot--secondary { background: var(--ci-gray-400); }

/* Editor area */
.ci-notes-titlebar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ci-notes-titlebar .form-control {
    min-width: 0;
}

/* Shared ghost icon button (pin toggle) */
.ci-notes-iconbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border: 1px solid var(--ci-border);
    border-radius: var(--ci-radius-md);
    background: transparent;
    color: var(--ci-text-muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.ci-notes-iconbtn:hover {
    color: var(--ci-text);
    background: color-mix(in srgb, var(--ci-text) 8%, transparent);
}

.ci-notes-iconbtn.is-on {
    color: var(--theme-primary, var(--ci-brand-primary));
    border-color: color-mix(in srgb, var(--theme-primary, var(--ci-brand-primary)) 45%, transparent);
    background: color-mix(in srgb, var(--theme-primary, var(--ci-brand-primary)) 9%, transparent);
}

.ci-notes-iconbtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ci-notes-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.6rem;
}

.ci-notes-field .form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ci-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ci-notes-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.6rem;
}

.ci-notes-footer .form-check-label {
    display: inline-flex;
    align-items: center;
    color: var(--ci-text-muted);
    font-size: 0.85rem;
    cursor: pointer;
}

/* Save-state indicator (footer): Saving… / Saved · HH:MM / Save failed — retry */
.ci-notes-status {
    font-size: 0.8rem;
    color: var(--ci-text-muted);
}

.ci-notes-status--saved {
    color: var(--ci-success);
}

.ci-notes-status--error {
    color: var(--ci-danger);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.ci-notes-status--error:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--ci-danger) 50%, transparent);
    outline-offset: 2px;
    border-radius: var(--ci-radius-sm);
}

/* Inline alert (ci tokens; kind set by JS: info | warning | danger) */
.ci-notes-alert {
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.6rem;
    border-radius: var(--ci-radius-md);
    border: 1px solid;
    font-size: 0.85rem;
}

.ci-notes-alert[hidden] {
    display: none;
}

.ci-notes-alert--info {
    color: var(--ci-info);
    border-color: color-mix(in srgb, var(--ci-info) 35%, transparent);
    background: color-mix(in srgb, var(--ci-info) 8%, transparent);
}

.ci-notes-alert--warning {
    color: var(--ci-warning);
    border-color: color-mix(in srgb, var(--ci-warning) 35%, transparent);
    background: color-mix(in srgb, var(--ci-warning) 8%, transparent);
}

.ci-notes-alert--danger {
    color: var(--ci-danger);
    border-color: color-mix(in srgb, var(--ci-danger) 35%, transparent);
    background: color-mix(in srgb, var(--ci-danger) 8%, transparent);
}

/* ── Quill (snow) panel polish ────────────────────────────────────────────
   Light mode only needs border/radius harmony; the snow theme's defaults
   are otherwise fine on the card surface. */
.ci-notes-editor .ql-toolbar.ql-snow {
    border-color: var(--ci-border);
    border-radius: var(--ci-radius-md) var(--ci-radius-md) 0 0;
}

.ci-notes-editor .ql-container.ql-snow {
    border-color: var(--ci-border);
    border-radius: 0 0 var(--ci-radius-md) var(--ci-radius-md);
}

.ci-notes-editor .ql-editor {
    font-family: var(--ci-font-sans);
    font-size: 0.9rem;
}

/* Dark mode: snow is white-by-default — re-skin strokes, fills, pickers,
   placeholder and inline code chips onto the ci dark surfaces. */
.dark .ci-notes-editor .ql-toolbar.ql-snow,
.dark .ci-notes-editor .ql-container.ql-snow {
    border-color: var(--ci-border);
}

.dark .ci-notes-editor .ql-snow .ql-stroke {
    stroke: var(--ci-gray-400);
}

.dark .ci-notes-editor .ql-snow .ql-stroke-miter {
    stroke: var(--ci-gray-400);
}

.dark .ci-notes-editor .ql-snow .ql-fill,
.dark .ci-notes-editor .ql-snow .ql-stroke.ql-fill {
    fill: var(--ci-gray-400);
}

.dark .ci-notes-editor .ql-snow .ql-picker {
    color: var(--ci-gray-400);
}

/* Hover/active accent: brand-light reads better than the snow #06c on dark */
.dark .ci-notes-editor .ql-snow.ql-toolbar button:hover,
.dark .ci-notes-editor .ql-snow.ql-toolbar button:focus,
.dark .ci-notes-editor .ql-snow.ql-toolbar button.ql-active,
.dark .ci-notes-editor .ql-snow.ql-toolbar .ql-picker-label:hover,
.dark .ci-notes-editor .ql-snow.ql-toolbar .ql-picker-label.ql-active,
.dark .ci-notes-editor .ql-snow.ql-toolbar .ql-picker-item:hover,
.dark .ci-notes-editor .ql-snow.ql-toolbar .ql-picker-item.ql-selected {
    color: var(--ci-brand-light);
}

.dark .ci-notes-editor .ql-snow.ql-toolbar button:hover .ql-stroke,
.dark .ci-notes-editor .ql-snow.ql-toolbar button:focus .ql-stroke,
.dark .ci-notes-editor .ql-snow.ql-toolbar button.ql-active .ql-stroke,
.dark .ci-notes-editor .ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke,
.dark .ci-notes-editor .ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke,
.dark .ci-notes-editor .ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke,
.dark .ci-notes-editor .ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke,
.dark .ci-notes-editor .ql-snow.ql-toolbar button:hover .ql-stroke-miter,
.dark .ci-notes-editor .ql-snow.ql-toolbar button:focus .ql-stroke-miter,
.dark .ci-notes-editor .ql-snow.ql-toolbar button.ql-active .ql-stroke-miter,
.dark .ci-notes-editor .ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke-miter,
.dark .ci-notes-editor .ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke-miter,
.dark .ci-notes-editor .ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke-miter,
.dark .ci-notes-editor .ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke-miter {
    stroke: var(--ci-brand-light);
}

.dark .ci-notes-editor .ql-snow.ql-toolbar button:hover .ql-fill,
.dark .ci-notes-editor .ql-snow.ql-toolbar button:focus .ql-fill,
.dark .ci-notes-editor .ql-snow.ql-toolbar button.ql-active .ql-fill,
.dark .ci-notes-editor .ql-snow.ql-toolbar .ql-picker-label:hover .ql-fill,
.dark .ci-notes-editor .ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-fill,
.dark .ci-notes-editor .ql-snow.ql-toolbar .ql-picker-item:hover .ql-fill,
.dark .ci-notes-editor .ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-fill,
.dark .ci-notes-editor .ql-snow.ql-toolbar button:hover .ql-stroke.ql-fill,
.dark .ci-notes-editor .ql-snow.ql-toolbar button:focus .ql-stroke.ql-fill,
.dark .ci-notes-editor .ql-snow.ql-toolbar button.ql-active .ql-stroke.ql-fill,
.dark .ci-notes-editor .ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke.ql-fill,
.dark .ci-notes-editor .ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke.ql-fill,
.dark .ci-notes-editor .ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke.ql-fill,
.dark .ci-notes-editor .ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke.ql-fill {
    fill: var(--ci-brand-light);
}

/* Header-picker dropdown panel */
.dark .ci-notes-editor .ql-toolbar.ql-snow .ql-picker-options {
    background-color: var(--ci-surface-raised);
    border-color: var(--ci-border);
    color: var(--ci-text);
}

.dark .ci-notes-editor .ql-snow .ql-picker.ql-expanded .ql-picker-label {
    color: var(--ci-gray-400);
    border-color: var(--ci-border);
}

.dark .ci-notes-editor .ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-stroke {
    stroke: var(--ci-gray-400);
}

/* Editor text + placeholder */
.dark .ci-notes-editor .ql-editor {
    color: var(--ci-text);
}

.dark .ci-notes-editor .ql-editor.ql-blank::before {
    color: var(--ci-text-muted);
}

.dark .ci-notes-editor .ql-snow .ql-editor code {
    background-color: color-mix(in srgb, var(--ci-gray-100) 12%, transparent);
    color: var(--ci-text);
}

.dark .ci-notes-editor .ql-snow .ql-editor blockquote {
    border-left-color: var(--ci-border);
}

