.ubuntu-light {
    font-family: "Ubuntu", sans-serif;
    font-weight: 300;
    font-style: normal;
}

.ubuntu-regular {
    font-family: "Ubuntu", sans-serif;
    font-weight: 400;
    font-style: normal;
}

.ubuntu-medium {
    font-family: "Ubuntu", sans-serif;
    font-weight: 500;
    font-style: normal;
}

.ubuntu-bold {
    font-family: "Ubuntu", sans-serif;
    font-weight: 700;
    font-style: normal;
}

.ubuntu-light-italic {
    font-family: "Ubuntu", sans-serif;
    font-weight: 300;
    font-style: italic;
}

.ubuntu-regular-italic {
    font-family: "Ubuntu", sans-serif;
    font-weight: 400;
    font-style: italic;
}

.ubuntu-medium-italic {
    font-family: "Ubuntu", sans-serif;
    font-weight: 500;
    font-style: italic;
}

.ubuntu-bold-italic {
    font-family: "Ubuntu", sans-serif;
    font-weight: 700;
    font-style: italic;
}


body {
    font-family: "Lexend Deca", sans-serif;
}
.navbar-brand {
    background-color: rgb(24, 10, 42);
}

.navbar {
    /*background-color: rgb(39, 26, 57);*/
    background-color: rgb(24, 10, 42);
}

#sidebarMenu{ 
    z-index: 1010;

}

#cy {
    width: 100%;
    height: 100%;
    display: block;
  }

.ui-front {
    z-index: 1050;
}

/* Autocomplete dropdowns must clear the map sidebars (#sidebarLayers /
   #sidebarAttributes, z-index 9999) and the feature popup (10000) */
.ui-autocomplete.ui-front {
    z-index: 10500;
}


.btn-xs, .btn-group-xs > .btn {
    --bs-btn-padding-y: 0.0625rem;
    --bs-btn-padding-x: 0.25rem;
    --bs-btn-font-size: 0.875rem;
    --bs-btn-border-radius: 0.25rem;
}

.btn-xs + .dropdown-toggle-split, .btn-group-xs > .btn + .dropdown-toggle-split {
    padding-right: 0.375rem;
    padding-left: 0.375rem;
}

.bg-geolynx-dark {
    --bs-bg-opacity: 1;
    background-color: rgba(24, 10, 42,1) !important;
}

.text-bg-geolynx-dark {
    color: #fff !important;
    background-color: RGBA(25, 135, 84, 1) !important;
}


.input-group-clear {
    position: relative;
}

.clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    z-index: 10;
    padding: 4px;
    border-radius: 3px;
}

.clear-btn:hover {
    color: #495057;
    background-color: #f8f9fa;
}

.clear-btn:focus {
    outline: 2px solid var(--gl-accent);
    outline-offset: 2px;
}



/* new layout */

:root {
    --header-height: 48px;
    --project-bar-height: 60px;
    --nav-height: 42px;
    --drawer-width: 280px;

    /* ── GeoLynx colour scheme ──────────────────────────────────────────────
       docs/2026-07-27-field-safe-colour-scheme.md. Replaced the --purple-*
       ramp (Tailwind's purple-700 and neighbours) on 2026-07-28.

       Accent: the brand hue at roughly a third of the chroma, so it reads as
       chosen rather than as a framework default.

       Status: chosen by simulating protanopia/deuteranopia (Machado 2009) and
       maximising worst-case CIE76 separation — 20.7 ΔE, against 14.0 for
       Bootstrap's — with every colour clearing AA on white. These are not
       arbitrary; don't round them to tidier values. Note --gl-warn takes
       *white* text, unlike Bootstrap's #ffc107.
       ────────────────────────────────────────────────────────────────────── */
    --gl-brand:       #180A2A;   /* header / navbar */
    --gl-brand-2:     #2A1A44;   /* raised surface on dark chrome */
    --gl-accent:      #5A3D8A;   /* 8.50:1 on white */
    --gl-accent-hi:   #452C6E;   /* hover / active */
    --gl-accent-200:  #D8CDE8;   /* borders */
    --gl-accent-100:  #EAE3F3;   /* selected rows, tints */
    --gl-accent-50:   #F5F2F9;   /* hover rows, panel heads */
    --gl-accent-pale: #CDBCE8;   /* accent ON the dark header (10.71:1) */
    --gl-accent-rgb:  90, 61, 138;

    --gl-ok:       #0E6B62;      /* 6.37:1 on white */
    --gl-ok-50:    #E6F3F1;
    --gl-ok-ink:   #0A544D;
    --gl-ok-rgb:   14, 107, 98;
    --gl-warn:     #A2620E;      /* 4.90:1 on white — white text */
    --gl-warn-50:  #FBF2E3;
    --gl-warn-ink: #834E08;
    --gl-warn-rgb: 162, 98, 14;
    --gl-bad:      #9E2A2B;      /* 7.45:1 on white */
    --gl-bad-50:   #FBECEC;
    --gl-bad-ink:  #7F2122;
    --gl-bad-rgb:  158, 42, 43;

    /* Neutral — added 2026-08-03 for the status style registry, which needed a
       "no particular signal" token. The scheme had ok/warn/bad/accent but nothing
       for a status that is simply inert (Draft, Cancelled, On Hold). Carries
       white text like the other four, and sits in the same contrast band as
       --gl-ok (6.37) and --gl-bad (7.45). */
    --gl-neutral:     #4B5563;   /* 7.56:1 on white */
    --gl-neutral-50:  #F1F2F4;
    --gl-neutral-rgb: 75, 85, 99;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    /*font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;*/
    font-size: 14px;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Top Header */
.top-header {
    background: var(--gl-brand);
    color: white;
    padding: 0 1rem;
    height: var(--header-height);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    z-index: 100;
}

.top-header .brand {
    font-weight: 600;
    font-size: 1.1rem;
    white-space: nowrap;
}

.top-header .search-container {
    flex: 1;
    max-width: 600px;
    margin: 0 2rem;
}

.top-header .search-input {
    width: 100%;
    padding: 0.4rem 0.75rem;
    border: none;
    border-radius: 4px;
    background: var(--gl-brand-2);
    color: white;
    font-size: 0.875rem;
}

.top-header .search-input::placeholder {
    color: rgba(255,255,255,0.5);
}

.top-header .search-input:focus {
    outline: none;
    background: var(--gl-accent);
}

/* Project Header Bar */
.project-header-bar {
    background: white;
    /*background: linear-gradient(#ffffff 0%, #e6e6e6 100%);*/
    border-bottom: 1px solid #e5e7eb;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    margin-left: 0;
    margin-right: 0;
}

.project-nav-bar {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.project-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.project-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.project-title h1 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.project-badge {
    padding: 0.2rem 0.5rem;
    background: #22c55e;
    color: white;
    font-size: 0.7rem;
    border-radius: 3px;
    text-transform: uppercase;
    font-weight: 500;
}

.project-stats {
    font-size: 0.8rem;
    color: #6b7280;
}

.project-actions {
    display: flex;
    gap: 0.5rem;
}
/*
.project-actions .btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
}*/

/* Horizontal Navigation */
/* Wrapper for horizontal scrolling */
/* Wrapper for horizontal scrolling */
/* Horizontal Navigation */
.horizontal-nav {
    background: linear-gradient(#f0f0f0 0%, #f6f6f6 100%);
    border-bottom: 1px solid #e5e7eb;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    overflow-x: auto;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.horizontal-nav::-webkit-scrollbar {
    height: 0;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.5rem;
    border: none;
    background: none;
    color: #4b5563;
    font-size: 0.875rem;
    white-space: nowrap;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.nav-tab:hover {
    color: var(--gl-accent);
    background: #f9fafb;
}

.nav-tab.active {
    color: rgb(24, 10, 42);
    border-bottom-color: rgb(24, 10, 42);
    background: var(--gl-accent-50);
}

.nav-tab i {
    font-size: 1rem;
}

/* Dropdown specific styles */
.nav-dropdown {
    position: relative; /* Keep relative, not static */
    display: flex;
    align-items: center;
}

.nav-dropdown > span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    /*padding: 0.25rem 0.5rem;*/
    color: #4b5563;
    font-size: 0.875rem;
    white-space: nowrap;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.nav-dropdown:hover > span {
    color: var(--gl-accent);
    background: #f9fafb;
}

.nav-dropdown-menu {
    display: none;
    position: fixed; /* Fixed positioning to escape overflow */
    background-color: #ffffff;
    min-width: 200px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    z-index: 99999;
    border: 1px solid #e5e7eb;
}

.nav-dropdown:hover .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-item {
    display: block;
    padding: 5px 8px;
    color: #333;
    text-decoration: none;
    transition: background-color 0.2s;
}

.nav-dropdown-item:first-child {
    border-radius: 4px 4px 0 0;
}

.nav-dropdown-item:last-child {
    border-radius: 0 0 4px 4px;
}

.nav-dropdown-item:hover {
    background-color: #f8f9fa;
    color: var(--gl-accent);
}

.nav-dropdown-item i,
.nav-dropdown-item svg {
    margin-right: 8px;
    width: 16px;
    text-align: center;
}

.nav-dropdown-item.active {
    background-color: var(--gl-accent-50);
    color: rgb(24, 10, 42);
    font-weight: 500;
}

.nav-dropdown-item.active:hover {
    background-color: var(--gl-accent-100);
}





/* Main Content Area */
.main-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #f3f4f6;
}

/* Map Container */
.map-container {
    position: absolute;
    inset: 0;
}

.map-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #d1fae5 0%, #dbeafe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
}

/* Map Controls - Top Right */
.map-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 50;
}

.map-controls .btn {
    font-size: 0.8rem;
    white-space: nowrap;
}

/* Floating Layers Button */
.layers-toggle-btn {
    position: absolute;
    bottom: 1.5rem;
    left: 1.5rem;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 50;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.layers-toggle-btn.closed {
    background: white;
    color: #374151;
}

.layers-toggle-btn.closed:hover {
    background: #f9fafb;
}

.layers-toggle-btn.open {
    background: var(--gl-accent);
    color: white;
}

.layer-count-badge {
    padding: 0.15rem 0.4rem;
    background: var(--gl-accent-100);
    color: var(--gl-accent);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.layers-toggle-btn.open .layer-count-badge {
    background: rgba(255,255,255,0.2);
    color: white;
}

/* Layer Drawer */
.layer-drawer {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--drawer-width);
    height: 100%;
    background: white;
    box-shadow: 4px 0 16px rgba(0,0,0,0.1);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 60;
    display: flex;
    flex-direction: column;
}

.layer-drawer.open {
    transform: translateX(0);
}

.drawer-header {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.drawer-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.drawer-close-btn {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.drawer-close-btn:hover {
    color: #4b5563;
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 5rem;
}
/*
.layer-section {
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.layer-section:last-child {
    border-bottom: none;
}

.layer-section-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.35rem;
    margin: 0 -0.35rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.layer-item:hover {
    background: #f3f4f6;
}

.layer-item input[type="checkbox"],
.layer-item input[type="radio"] {
    width: 15px;
    height: 15px;
    accent-color: var(--gl-accent);
    cursor: pointer;
    flex-shrink: 0;
}

.layer-item label {
    font-size: 0.85rem;
    color: #374151;
    cursor: pointer;
    flex: 1;
    margin: 0;
}

.layer-item .layer-settings {
    opacity: 0;
    color: #9ca3af;
    transition: opacity 0.15s;
    font-size: 0.8rem;
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
}

.layer-item:hover .layer-settings {
    opacity: 1;
}*/

/* Form Container */
.form-container {
    display: none;
    padding: 1.5rem;
    overflow-y: auto;
    height: 100%;
}

.form-container.visible {
    display: block;
}

.form-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 1.5rem;
    max-width: 1200px;
}

.form-card h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

.form-section {
    margin-bottom: 1.5rem;
}

.form-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--gl-accent);
    box-shadow: 0 0 0 2px var(--gl-accent-100);
}

/* ── GeoLynx Spinner ── */
.gl-spinner {
    /* --pulse is now darker than --node, inverting the old lightness order:
       the scheme has no mid-light saturated tone, and --gl-accent-pale is
       built for the dark header, so it all but vanishes on a white card. */
    --node:  var(--gl-accent);
    --pulse: var(--gl-accent-hi);
    --line:  rgba(var(--gl-accent-rgb), 0.2);
    position: relative;
    width: 64px;
    height: 64px;
}

/* Outer ring – rotating dashed network circle */
.gl-spinner::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px dashed var(--line);
    animation: gl-rotate 8s linear infinite;
}

/* Inner glowing core */
.gl-spinner::after {
    content: '';
    position: absolute;
    inset: 22px;
    border-radius: 50%;
    background: var(--node);
    box-shadow: 0 0 12px rgba(var(--gl-accent-rgb), 0.5), 0 0 24px rgba(var(--gl-accent-rgb), 0.2);
    animation: gl-core-pulse 1.6s ease-in-out infinite;
}

/* Orbiting pulse nodes */
.gl-spinner .orbit {
    position: absolute;
    inset: 0;
    animation: gl-rotate 2.4s linear infinite;
}
.gl-spinner .orbit:nth-child(2) {
    animation-duration: 3.2s;
    animation-direction: reverse;
}
.gl-spinner .orbit:nth-child(3) {
    animation-duration: 4.8s;
}

.gl-spinner .orbit::before {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--pulse);
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.7);
    top: -3px;
    left: 50%;
    transform: translateX(-50%);
    animation: gl-node-fade 1.6s ease-in-out infinite;
}
.gl-spinner .orbit:nth-child(2)::before {
    width: 4px; height: 4px; top: -2px;
    animation-delay: -0.5s;
}
.gl-spinner .orbit:nth-child(3)::before {
    width: 5px; height: 5px; top: -2.5px;
    animation-delay: -1s;
}

@keyframes gl-rotate {
    to { transform: rotate(360deg); }
}
@keyframes gl-core-pulse {
    0%, 100% { transform: scale(1);   opacity: 1; }
    50%       { transform: scale(1.3); opacity: 0.7; }
}
@keyframes gl-node-fade {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}


#mapButtons {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(2px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 5px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.2),
    inset 0 4px 20px rgba(255, 255, 255, 0.3);
    padding: 3px;
    display: grid !important;
    gap: 3px;
}

#mapButtons > p {
    margin: 0 !important; /* override m-1 */
}

#mapButtons .btn {
    width: 100%;
}

#mapButtons .dropdown .dropdown-toggle {
    width: 100%;
}


/*
#mapButtons {
    padding: 3px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(2px) saturate(180%);
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.2),
    inset 0 4px 20px rgba(255, 255, 255, 0.3);
}
*/
/*
#sidebarLayers {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 80%; /* Example width; adjust as needed or use media queries *
    max-width: 300px; /* Optional max-width *
    background-color: rgba(248, 249, 250, 0.4);
    transform: translateX(-100%); /* Start hidden *
    transition: transform 0.3s ease;
    z-index: 9999;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    /* Other styles like overflow, z-index, etc. *
}*/

#map {
    width: 100%;
    height: 100%;
    position: relative;
}

#sidebarLayers {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 80%; /* Example width; adjust as needed or use media queries */
    max-width: 300px; /* Optional max-width */
    transform: translateX(-100%); /* Start hidden */
    transition: transform 0.3s ease;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(2px) saturate(180%);
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.2),
    inset 0 4px 20px rgba(255, 255, 255, 0.3);
    /* Other styles like overflow, z-index, etc. */
    display: flex;
    flex-direction: column;
}

/* Open state */
#sidebarLayers.open {
    transform: translateX(0);
}

/* Scrollable content wrapper */
#sidebarLayers .sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0; /* <-- add this */
    padding: 1rem 1rem 0 1rem;

    /* Hide scrollbar for Chrome, Safari and Opera */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
}


/* ══════════════════════════════════════════════════════════════════════════
   Parent/child hierarchy panel — rendered by renderHierarchyPanel() in
   js/main.js at the top of Main Details in the project, account and stocklist
   editors. Accent ramp only: being part of a hierarchy is context, and the
   alert amber/blue this replaced read as a problem to fix.
   ══════════════════════════════════════════════════════════════════════════ */
.hx-panel {
    --hx-ink:    var(--gl-brand);
    --hx-line:   var(--gl-accent-200);
    --hx-border: #e5e7eb;
    --hx-muted:  #6b7280;
    --hx-quiet:  #9ca3af;
    --hx-accent: var(--gl-accent);
    --hx-tint:   var(--gl-accent-50);
    --hx-tint-2: var(--gl-accent-100);

    border: 1px solid var(--hx-border);
    border-radius: 6px;
    background: #fff;
    font-size: 0.8125rem;
}

.hx-panel-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid var(--hx-border);
    background: linear-gradient(#fbfaff, #f7f5fd);
    border-radius: 6px 6px 0 0;
}

.hx-panel-head > .bi { color: var(--hx-accent); }

.hx-panel-title {
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--hx-ink);
}

.hx-panel-count {
    font-size: 0.74rem;
    color: var(--hx-muted);
}

.hx-collapse {
    margin-left: auto;
    background: none;
    border: 0;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.72rem;
    color: var(--hx-muted);
    cursor: pointer;
}

.hx-collapse:hover {
    background: var(--hx-tint);
    color: var(--hx-accent);
}

.hx-panel-body { padding: 0.5rem 0.7rem 0.55rem; }
.hx-panel-body.is-collapsed { display: none; }

/* Tree scaffolding. Nested lists give the connector lines for free: each item
   draws the elbow into itself, and every item but the last draws the line on
   down to its next sibling. */
.hx-tree,
.hx-tree ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hx-tree ul { padding-left: 1.05rem; }

.hx-tree li {
    position: relative;
    padding-left: 1.15rem;
}

.hx-tree li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 0.72rem;
    height: 0.82rem;
    border-left: 1px solid var(--hx-line);
    border-bottom: 1px solid var(--hx-line);
    border-bottom-left-radius: 4px;
}

.hx-tree li:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0.82rem;
    bottom: 0;
    border-left: 1px solid var(--hx-line);
}

/* The outermost node is the root of the whole tree — nothing sits above it.
   Declared after the rules above so it wins on equal specificity. */
.hx-tree > li { padding-left: 0; }
.hx-tree > li::before,
.hx-tree > li::after { content: none; }

.hx-node {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 1.55rem;
    min-width: 0;
    padding: 0.12rem 0.35rem;
    border-radius: 4px;
}

.hx-node:hover { background: var(--hx-tint); }

.hx-node .hx-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

a.hx-name { color: var(--hx-accent); text-decoration: none; }
a.hx-name:hover { text-decoration: underline; }
a.hx-name:focus-visible {
    outline: 2px solid var(--hx-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Pushes the distance to the right without letting it collapse the name. */
.hx-node .hx-fill { margin-left: auto; flex: 1 1 auto; }

/* Direction reads from the glyph as well as from position, so up and down
   never depend on colour alone. */
.hx-dir {
    flex: 0 0 auto;
    font-size: 0.72rem;
    color: var(--hx-quiet);
}

.hx-here {
    flex: 0 0 auto;
    font-size: 0.7rem;
    color: var(--hx-accent);
}

.hx-node.is-self {
    background: var(--hx-tint-2);
    box-shadow: inset 2px 0 0 var(--hx-accent);
}

.hx-node.is-self:hover { background: var(--hx-tint-2); }

.hx-node.is-self .hx-name {
    font-weight: 600;
    color: var(--hx-ink);
}

.hx-you {
    flex: 0 0 auto;
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    background: #fff;
    color: var(--hx-accent);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.hx-tag,
.hx-dist {
    flex: 0 0 auto;
    font-size: 0.72rem;
    color: var(--hx-quiet);
    white-space: nowrap;
}

.hx-dist { font-variant-numeric: tabular-nums; }

/* Per-child annotation in the hierarchy panel - projects put each descendant's
   premise count here. Same quiet treatment as .hx-tag, with tabular numerals so a
   column of counts lines up. */
.hx-note {
    flex: 0 0 auto;
    font-size: 0.72rem;
    color: var(--hx-quiet);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.hx-overflow { display: none; }

.hx-more {
    background: none;
    border: 0;
    margin: 0;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.74rem;
    color: var(--hx-accent);
    cursor: pointer;
}

.hx-more:hover {
    background: var(--hx-tint);
    text-decoration: underline;
}

/* ── Facts variant ─────────────────────────────────────────────────────────
   Same chrome, flat label/value body — renderFactsPanel() in js/main.js, used
   for the account fields a project inherits. One pair per line: a multi-column
   grid packed the pairs against each other and left the panel half empty. */
.hx-panel-src {
    font-size: 0.74rem;
    color: var(--hx-accent);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

a.hx-panel-src:hover { text-decoration: underline; }

.hx-facts { margin: 0; }

.hx-fact {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    min-width: 0;
    padding: 0.12rem 0.35rem;
    border-radius: 4px;
}

.hx-fact:hover { background: var(--hx-tint); }

.hx-fact dt {
    flex: 0 0 auto;
    font-weight: 600;
    color: var(--hx-muted);
}

/* Colon in CSS, not in the markup: the label is the field's own name and
   shouldn't carry punctuation into anything that reads it. */
.hx-fact dt::after { content: ':'; }

.hx-fact dd {
    margin: 0;
    min-width: 0;
    color: var(--hx-ink);
    overflow-wrap: anywhere;
}

.hx-fact dd.is-unset {
    color: var(--hx-quiet);
    font-style: italic;
}


/* ══════════════════════════════════════════════════════════════════════════
   Bootstrap semantic colours — docs/2026-07-27-field-safe-colour-scheme.md
   Phase 3. custom.css is loaded last (index.php, end of <body>), so these
   win over bootstrap.min.css at equal specificity.

   This build is Bootstrap 5.2.3, which splits into two groups:

     - Utilities (.text-*, .bg-*, .border-*) compose from --bs-*-rgb, so
       overriding the base tokens below reaches them for free.
     - Components (.btn-*, .alert-*, .text-bg-*, form focus, checkboxes,
       pagination, progress) compile *literal hexes* into their own
       --bs-<component>-* properties. Overriding --bs-primary does NOT touch
       them — hence the per-component blocks. That is ~170 of the ~280 call
       sites, so a base-token-only override would have looked like a no-op.

   Still zero call-site edits: every rule here is a variable override.
   ══════════════════════════════════════════════════════════════════════════ */

:root {
    --bs-primary: #5A3D8A;
    --bs-primary-rgb: 90, 61, 138;
    --bs-success: #0E6B62;
    --bs-success-rgb: 14, 107, 98;
    --bs-warning: #A2620E;
    --bs-warning-rgb: 162, 98, 14;
    --bs-danger: #9E2A2B;
    --bs-danger-rgb: 158, 42, 43;

    --bs-link-color: var(--gl-accent);
    --bs-link-hover-color: var(--gl-accent-hi);
}

/* -- Solid buttons ------------------------------------------------------- */
.btn-primary {
    --bs-btn-bg: var(--gl-accent);
    --bs-btn-border-color: var(--gl-accent);
    --bs-btn-hover-bg: var(--gl-accent-hi);
    --bs-btn-hover-border-color: var(--gl-accent-hi);
    --bs-btn-active-bg: var(--gl-accent-hi);
    --bs-btn-active-border-color: var(--gl-accent-hi);
    --bs-btn-disabled-bg: var(--gl-accent);
    --bs-btn-disabled-border-color: var(--gl-accent);
    --bs-btn-focus-shadow-rgb: var(--gl-accent-rgb);
}

.btn-success {
    --bs-btn-bg: var(--gl-ok);
    --bs-btn-border-color: var(--gl-ok);
    --bs-btn-hover-bg: var(--gl-ok-ink);
    --bs-btn-hover-border-color: var(--gl-ok-ink);
    --bs-btn-active-bg: var(--gl-ok-ink);
    --bs-btn-active-border-color: var(--gl-ok-ink);
    --bs-btn-disabled-bg: var(--gl-ok);
    --bs-btn-disabled-border-color: var(--gl-ok);
    --bs-btn-focus-shadow-rgb: var(--gl-ok-rgb);
}

/* Warning flips to white text — #A2620E is dark where #ffc107 was not. */
.btn-warning {
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
    --bs-btn-disabled-color: #fff;
    --bs-btn-bg: var(--gl-warn);
    --bs-btn-border-color: var(--gl-warn);
    --bs-btn-hover-bg: var(--gl-warn-ink);
    --bs-btn-hover-border-color: var(--gl-warn-ink);
    --bs-btn-active-bg: var(--gl-warn-ink);
    --bs-btn-active-border-color: var(--gl-warn-ink);
    --bs-btn-disabled-bg: var(--gl-warn);
    --bs-btn-disabled-border-color: var(--gl-warn);
    --bs-btn-focus-shadow-rgb: var(--gl-warn-rgb);
}

.btn-danger {
    --bs-btn-bg: var(--gl-bad);
    --bs-btn-border-color: var(--gl-bad);
    --bs-btn-hover-bg: var(--gl-bad-ink);
    --bs-btn-hover-border-color: var(--gl-bad-ink);
    --bs-btn-active-bg: var(--gl-bad-ink);
    --bs-btn-active-border-color: var(--gl-bad-ink);
    --bs-btn-disabled-bg: var(--gl-bad);
    --bs-btn-disabled-border-color: var(--gl-bad);
    --bs-btn-focus-shadow-rgb: var(--gl-bad-rgb);
}

/* -- Outline buttons ----------------------------------------------------- */
.btn-outline-primary {
    --bs-btn-color: var(--gl-accent);
    --bs-btn-border-color: var(--gl-accent);
    --bs-btn-hover-bg: var(--gl-accent);
    --bs-btn-hover-border-color: var(--gl-accent);
    --bs-btn-active-bg: var(--gl-accent-hi);
    --bs-btn-active-border-color: var(--gl-accent-hi);
    --bs-btn-disabled-color: var(--gl-accent);
    --bs-btn-focus-shadow-rgb: var(--gl-accent-rgb);
}

.btn-outline-success {
    --bs-btn-color: var(--gl-ok);
    --bs-btn-border-color: var(--gl-ok);
    --bs-btn-hover-bg: var(--gl-ok);
    --bs-btn-hover-border-color: var(--gl-ok);
    --bs-btn-active-bg: var(--gl-ok-ink);
    --bs-btn-active-border-color: var(--gl-ok-ink);
    --bs-btn-disabled-color: var(--gl-ok);
    --bs-btn-focus-shadow-rgb: var(--gl-ok-rgb);
}

.btn-outline-warning {
    --bs-btn-color: var(--gl-warn);
    --bs-btn-border-color: var(--gl-warn);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--gl-warn);
    --bs-btn-hover-border-color: var(--gl-warn);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--gl-warn-ink);
    --bs-btn-active-border-color: var(--gl-warn-ink);
    --bs-btn-disabled-color: var(--gl-warn);
    --bs-btn-focus-shadow-rgb: var(--gl-warn-rgb);
}

.btn-outline-danger {
    --bs-btn-color: var(--gl-bad);
    --bs-btn-border-color: var(--gl-bad);
    --bs-btn-hover-bg: var(--gl-bad);
    --bs-btn-hover-border-color: var(--gl-bad);
    --bs-btn-active-bg: var(--gl-bad-ink);
    --bs-btn-active-border-color: var(--gl-bad-ink);
    --bs-btn-disabled-color: var(--gl-bad);
    --bs-btn-focus-shadow-rgb: var(--gl-bad-rgb);
}

/* -- Alerts -------------------------------------------------------------- */
.alert-primary {
    --bs-alert-color: var(--gl-accent-hi);
    --bs-alert-bg: var(--gl-accent-50);
    --bs-alert-border-color: var(--gl-accent-200);
}

.alert-success {
    --bs-alert-color: var(--gl-ok-ink);
    --bs-alert-bg: var(--gl-ok-50);
    --bs-alert-border-color: rgba(var(--gl-ok-rgb), 0.3);
}

.alert-warning {
    --bs-alert-color: var(--gl-warn-ink);
    --bs-alert-bg: var(--gl-warn-50);
    --bs-alert-border-color: rgba(var(--gl-warn-rgb), 0.3);
}

.alert-danger {
    --bs-alert-color: var(--gl-bad-ink);
    --bs-alert-bg: var(--gl-bad-50);
    --bs-alert-border-color: rgba(var(--gl-bad-rgb), 0.3);
}

/* -- text-bg-* (badges and pills) — literal RGBA in 5.2.3 ---------------- */
.text-bg-primary {
    color: #fff !important;
    background-color: rgba(var(--gl-accent-rgb), var(--bs-bg-opacity, 1)) !important;
}

.text-bg-success {
    color: #fff !important;
    background-color: rgba(var(--gl-ok-rgb), var(--bs-bg-opacity, 1)) !important;
}

/* Was dark text on #ffc107; the new warning needs white. */
.text-bg-warning {
    color: #fff !important;
    background-color: rgba(var(--gl-warn-rgb), var(--bs-bg-opacity, 1)) !important;
}

.text-bg-danger {
    color: #fff !important;
    background-color: rgba(var(--gl-bad-rgb), var(--bs-bg-opacity, 1)) !important;
}

/* -- Form focus and checkboxes ------------------------------------------- */
.form-control:focus,
.form-select:focus {
    border-color: var(--gl-accent);
    box-shadow: 0 0 0 0.25rem rgba(var(--gl-accent-rgb), 0.25);
}

.form-check-input:focus {
    border-color: var(--gl-accent);
    box-shadow: 0 0 0 0.25rem rgba(var(--gl-accent-rgb), 0.25);
}

.form-check-input:checked {
    background-color: var(--gl-accent);
    border-color: var(--gl-accent);
}

.form-check-input[type=checkbox]:indeterminate {
    background-color: var(--gl-accent);
    border-color: var(--gl-accent);
}

/* -- Remaining components carrying a literal primary --------------------- */
.pagination {
    --bs-pagination-color: var(--gl-accent);
    --bs-pagination-hover-color: var(--gl-accent-hi);
    --bs-pagination-focus-color: var(--gl-accent-hi);
    --bs-pagination-focus-bg: var(--gl-accent-50);
    --bs-pagination-active-bg: var(--gl-accent);
    --bs-pagination-active-border-color: var(--gl-accent);
}

.progress {
    --bs-progress-bar-bg: var(--gl-accent);
}

.dropdown-menu {
    --bs-dropdown-link-active-bg: var(--gl-accent);
}

.list-group {
    --bs-list-group-active-bg: var(--gl-accent);
    --bs-list-group-active-border-color: var(--gl-accent);
}

.nav-pills {
    --bs-nav-pills-link-active-bg: var(--gl-accent);
}


/* ── Links ──────────────────────────────────────────────────────────────────
   Setting --bs-link-color above should be enough: Reboot is
   `a { color: var(--bs-link-color) }`. In practice links still rendered
   Bootstrap blue, so the tag is set directly here — same specificity as
   Reboot's rule, later file, so this wins outright and doesn't depend on how
   Bootstrap happens to wire link colour in a future version.

   Tag-level (0,0,1) is deliberately the weakest useful selector: every
   Bootstrap component that colours its own links — .nav-link, .dropdown-item,
   .btn, .navbar-brand, .page-link — is class-based and still beats this, so
   buttons and nav items are unaffected.
   ────────────────────────────────────────────────────────────────────────── */
a {
    color: var(--gl-accent);
}

a:hover,
a:focus {
    color: var(--gl-accent-hi);
}

/* ── Tabulator ──────────────────────────────────────────────────────────────
   tabulator_bootstrap5.css is a vendored theme with Bootstrap blue baked in
   as literal hexes, and it uses its own .tabulator-page markup rather than
   Bootstrap's .pagination — so neither the --bs-* overrides nor the
   .pagination block above reach it. Selectors below match the vendor file's
   own specificity (0,3,0); custom.css loads after it, so these win.
   ────────────────────────────────────────────────────────────────────────── */
.tabulator .tabulator-footer .tabulator-page.active {
    border-color: var(--gl-accent);
    background-color: var(--gl-accent);
    color: #fff;
}

@media (hover: hover) and (pointer: fine) {
    .tabulator .tabulator-footer .tabulator-page:not(.disabled):hover {
        border-color: var(--gl-accent-200);
        background: var(--gl-accent-50);
        color: var(--gl-accent-hi);
    }
}

.tabulator .tabulator-footer .tabulator-spreadsheet-tabs .tabulator-spreadsheet-tab.tabulator-spreadsheet-tab-active {
    background-color: var(--gl-accent);
    color: #fff;
}


/* Header filters sit on one line across the table, whatever height the title above
   each one wrapped to.

   The structure, from the DOM (Dave, 2026-08-28):

     .tabulator-col            inline-flex column, explicit equal height (e.g. 82px)
       .tabulator-col-content  plain block, sized to its own content
         .tabulator-col-title-holder
         .tabulator-header-filter

   So the spare height is on .tabulator-col, but the filter lives one level further in,
   inside .tabulator-col-content - which is content-height and not a flex container, so
   an auto margin on the filter has nothing to push against. A two-line title therefore
   carries its own filter down with it and the row of inputs staircases.

   The fix is to hand that spare height down: let the content fill the column, make it
   a flex column in turn, and the auto margin then has slack to take. Do NOT try this by
   flexing .tabulator-headers instead - the columns carry explicit inline widths and
   turning the header row into a flex container overflows it to the right (tried,
   2026-08-28). */
.tabulator .tabulator-header .tabulator-col .tabulator-col-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-header-filter {
    margin-top: auto;
}
