﻿/* ==========================================================================
   LDAR SERVER 2 - INDUSTRIAL CONTROL ROOM HIGH-DENSITY STYLESHEET
   ========================================================================== */

/* One small corner for every outer edge (panels, cards, dialogs, toasts, menus, buttons, inputs); Bootstrap reads it through
   its own radius variables, so input groups and button groups still join square. Rows, cells and badges stay square. */
:root {
    --ldar-radius: 3px;
    --bs-border-radius: var(--ldar-radius);
    --bs-border-radius-sm: var(--ldar-radius);
    --bs-border-radius-lg: var(--ldar-radius);
    --bs-border-radius-xl: var(--ldar-radius);
    --bs-border-radius-xxl: var(--ldar-radius);
    --bs-border-radius-pill: var(--ldar-radius);
}

/* 1. Global Reset & Layout Strategy */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-size: 1rem; /* The root (html, below) sets the dense 0.85 size; rem here is that root, so 0.85rem would shrink it twice */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f3f4f6;
    color: #1f2937;
    overflow: hidden; /* Prevents whole-page scrolling; panes scroll individually */
}

/* Font size picker in the top toolbar (font-size.js) scales every rem through the root */
html {
    font-size: calc(0.85rem * var(--font-scale, 1));
}

/* 2. Strict Utility Stripping (Anti-Fluff) */
.btn, .form-control, .form-select, .card, .modal-content, .nav-link, .badge, .alert {
    box-shadow: none !important; /* Strip SaaS gradients/shadows */
}

.nav-link, .badge {
    border-radius: 0 !important; /* Square: a rounded badge reads as a pill, a rounded nav link as a button */
}

/* Instant-snap transitions for quick data evaluation */
.collapsing, .fade, .modal, .dropdown-menu {
    transition: none !important;
    animation: none !important;
}

/* 3. Specialized Typography for Industrial Data */
.component-tag, .loop-id, .ppm-value {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-weight: 600;
}

/* 4. Table Density Overrides */
.table-sm th, .table-sm td {
    padding: 0.25rem 0.4rem !important; /* Ultra-tight padding */
    vertical-align: middle;
}

/* Column headers: the same size as the rows, semi-bold and black on a light band */
.table > thead th {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    background-color: #f9fafb;
}

/* Ensure wide tables don't wrap and bloat vertical height */
.table-nowrap th, .table-nowrap td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* A cell holding a sentence (the conditions a run was calculated with) wraps, so it doesn't stretch the table */
.table-nowrap td.cell-wrap {
    white-space: normal;
    overflow-wrap: break-word;
    text-overflow: clip;
    min-width: 16rem;
}

/* High-contrast row hover for cross-screen data scanning */
.table-hover tbody tr:hover {
    background-color: #e2e8f0 !important;
    color: #000000 !important;
    cursor: pointer;
}

/* Active Row Selection State */
.table-active-row {
    background-color: #dbeafe !important;
    border-left: 4px solid #2563eb !important;
}

/* 5. Minimalist Regulatory Telemetry Colors */
/* Clean, non-distracting backgrounds. Saturated colors are ONLY for leaks. */
.status-safe {
    color: #6b7280; /* Muted gray. No leak means nothing to look at. */
}

.status-warning {
    background-color: #fef3c7 !important; /* Soft yellow for First Attempt / 5-Day window */
    color: #92400e !important;
    font-weight: bold;
}

.status-critical {
    background-color: #fee2e2 !important; /* High-visibility soft red for active leaks */
    color: #991b1b !important;
    font-weight: bold;
    border-left: 4px solid #dc2626;
}

.status-dor {
    background-color: #f3e8ff !important; /* Light purple for Delay of Repair */
    color: #6b21a8 !important;
    font-weight: bold;
}

/* Every table body is regular weight, status rows, component tags, readings and bold cells included: the status tint
   says it. Group header rows (sections over units) stay semi-bold, as headers */
.table tbody,
.table tbody *:not(.table-group-row):not(.table-group-row *) {
    font-weight: normal !important;
}

/* Except the labels of a detail page's label/value table (component, leak details): semi-bold, as the <dt> labels of the
   other detail pages are bold. Two classes on .table so it outranks the rule above. Detail labels are black, never the
   muted grey their markup asks for (td/dt.text-muted) */
.table.table-borderless tbody td.text-muted {
    font-weight: 600 !important;
}

.table.table-borderless tbody td.text-muted,
dl dt,
dl dt.text-muted {
    color: #111827 !important;
}

/* 6. High-Density Layout Panes */
.pane-sidebar {
    width: 240px;
    min-width: 240px;
    background-color: #111827;
    height: 100vh;
}

.pane-content {
    flex-grow: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.pane-grid {
    flex-grow: 1;
    overflow: auto; /* Independent scrolling for the main data grid */
}

/* Annotation canvas: CSS sets the on-screen size and the script matches the drawing size to it (no CSS scaling,
   so mouse maths stay exact); the photo is fitted whole inside */
.annotation-canvas {
    display: block;
    width: 100%;
}

.annotation-canvas-edit {
    height: calc(100vh - 230px);
    min-height: 360px;
}

/* Component Management: groups | canvas | component & group forms; each pane scrolls on its own */
.cm-workspace {
    height: calc(100vh - 110px);
}

.cm-groups {
    width: 210px;
    min-width: 210px;
}

.cm-canvas-pane {
    min-width: 0;
}

.cm-canvas {
    flex: 1 1 0;
    min-height: 0;
}

.cm-detail {
    width: 300px;
    min-width: 300px;
}

.cm-list .list-group-item {
    cursor: grab;
}

.cm-list .list-group-item:active {
    cursor: grabbing;
}

.cm-order {
    width: 2.5em;
}

.pane-drawer {
    width: 400px;
    min-width: 400px;
    background-color: #ffffff;
    border-left: 1px solid #d1d5db;
    height: 100vh;
    overflow-y: auto;
}



/* Custom popover styling */
.popover{
    max-width: 600px; /* Set the desired width */
    width: 100%; /* Ensure responsiveness */
}
.popover-header {
    border-bottom: none; /* Removes the horizontal line */
}

/* Custom context menu*/
/* Row/canvas action menu: flat and dense like the rest of the UI (small corner, no shadow) */
.context-menu {
    position: absolute;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: var(--ldar-radius);
    padding: 2px 0;
    z-index: 1060;
    min-width: 140px;
}

.context-menu-item {
    padding: 0.2rem 0.75rem;
    cursor: pointer;
    color: #111827;
    font-size: 0.8rem;
    white-space: nowrap;
}

    .context-menu-item:hover {
        background-color: #dbeafe;
    }

    .context-menu-item:active {
        background-color: #bfdbfe;
    }

.context-menu-divider {
    border-bottom: 1px solid #e5e7eb;
    margin: 2px 0;
}

/* The annotation canvas is focusable (keyboard shortcuts); no focus ring around the photo */
.annotation-canvas:focus {
    outline: none;
}

/* remove flag from map*/
.leaflet-attribution-flag {
    display: none !important;
}

/* loading */
.loading-message {
    padding: 20px;
    text-align: center;
    color: #666;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #333;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* select2*/
/* Add to your site.css */
.offcanvas {
    z-index: 1050 !important;
}

/* Location dashboards (Sections, Units, Areas, SubAreas Details): a text-only banner, the level and where it sits, the name and
   its status chips on white, no picture (the photos are under Attachments) */
.location-banner { background-color: #ffffff; border-bottom: 1px solid #d1d5db; }
.location-banner-title { padding: 0.6rem 1rem; color: #1f2937; }
.location-banner-title h1 { font-size: 1.6rem; font-weight: 600; margin: 0; }
.location-banner-level { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: #6b7280; }
.location-type-table { min-width: 18rem; flex: 1 1 18rem; max-width: 34rem; }
/* What it holds: a block per kind (the KPI block, a button: the one whose tiles show has the dark outline, kpi-block-active), the
   linked records after a hairline; its list as small fixed-width tiles (names wider than numbers) in a scrolling box */
.loc-blocks { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0.5rem; }
.loc-blocks-divider { width: 1px; align-self: stretch; background-color: #d1d5db; margin: 0 0.25rem; }
.loc-block { cursor: pointer; font: inherit; }
.loc-block:disabled { cursor: default; color: #9ca3af; background-color: #f9fafb; }
.loc-block .loc-block-action { color: #2563eb; }
.loc-block:disabled .loc-block-action { color: #9ca3af; }
.loc-list-box { border: 1px solid #e5e7eb; border-radius: var(--ldar-radius); padding: 0.5rem; background-color: #f9fafb; }
.loc-tiles { display: grid; gap: 4px; max-height: 16rem; overflow-y: auto; }
.loc-tiles-names { grid-template-columns: repeat(auto-fill, 11rem); }
.loc-tiles-numbers { grid-template-columns: repeat(auto-fill, 6.5rem); }
.loc-tile { display: block; min-width: 0; padding: 0.2rem 0.4rem; border: 1px solid #d1d5db; border-radius: var(--ldar-radius); background-color: #ffffff; color: #111827; text-decoration: none; line-height: 1.25; }
.loc-tile:hover, .loc-tile:focus-visible { border-color: #374151; color: #111827; outline: none; }
.loc-tile-name, .loc-tile-sub { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loc-tile-name { font-size: 0.85rem; font-weight: 600; }
.loc-tile-sub { font-size: 0.75rem; color: #6b7280; font-weight: normal; }
.loc-tile.status-critical .loc-tile-sub { color: #991b1b; }
.loc-tile-key { display: inline-block; width: 0.8rem; height: 0.8rem; vertical-align: -0.1rem; border-left-width: 3px; }
/* The page in three groups (needs attention, performance, the location's information), each under a plain heading */
.loc-group-title { font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #4b5563; margin: 1rem 0 0.4rem; }
.loc-group-title:first-child { margin-top: 0.25rem; }
/* The banner's chips under the name: classification, and in service or out of service since (amber) */
.location-banner-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.3rem; }
.location-chip { font-size: 0.8rem; padding: 0.1rem 0.5rem; background-color: #f9fafb; color: #1f2937; border: 1px solid #d1d5db; }
.location-chip-warning { background-color: #fef3c7; color: #92400e; border-color: #f59e0b; }
/* Leaks: four cards for the day's work (each opens its list), then the rest as one line of figures */
.loc-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.5rem; }
.loc-card { min-width: 0; padding: 0.5rem 0.75rem; }
.loc-card .kpi-value { font-size: 2rem; }
.loc-figures-row { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; font-size: 0.85rem; }
.loc-figures-row > span { padding: 0 0.3rem; }
/* Details as label and value; attachments as a strip of small thumbnails and file links */
.loc-facts { display: grid; grid-template-columns: 8rem 1fr; gap: 0.3rem 0.75rem; font-size: 0.9rem; }
.loc-facts dt { font-weight: 600; color: #4b5563; }
.loc-facts dd { margin: 0; }
.loc-attachments { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: flex-start; }
.loc-attachment-primary { width: 13rem; max-width: 100%; }
.loc-attachment-thumbs { display: grid; grid-template-columns: repeat(auto-fill, 4.5rem); gap: 0.4rem; flex: 1 1 9.5rem; align-content: start; }
.loc-attachment-photo { width: 4.5rem; }
/* Performance cards (repairs, inspections, survey progress): their figures as an even 2-by-2 grid of equal cells, hairline
   between them; a cell's status class tints it as anywhere else */
.loc-stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background-color: #e5e7eb; border-top: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; }
.loc-stat-grid > div { background-color: #ffffff; padding: 0.5rem 0.75rem; min-width: 0; }
.loc-stat-grid .kpi-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #4b5563; }
.loc-stat-grid .kpi-value { font-size: 1.5rem; line-height: 1.2; }
.loc-stat-grid .loc-stat-of { font-size: 1rem; color: #6b7280; }
.loc-stat-grid .kpi-sub { font-size: 0.8rem; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loc-stat-grid .loc-kpi-date { font-size: 1.1rem; line-height: 1.65; }

/* Details' boundary, drawn in place at a fixed height; the whole map is a link to the edit page (a layer over Leaflet's panes) */
.loc-map { position: relative; flex: 1 1 auto; min-height: 120px; border: 1px solid #d1d5db; }
.loc-map.loc-map-tall { min-height: 200px; }
.loc-map-canvas { position: absolute; inset: 0; }
.loc-map-link { position: absolute; inset: 0; z-index: 1000; cursor: pointer; }
.loc-map-link:hover, .loc-map-link:focus-visible { outline: 2px solid #2563eb; outline-offset: -2px; }
.loc-files { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; font-size: 0.85rem; }
.loc-file { max-width: 14rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loc-kpi-date { font-size: 1.05rem; line-height: 1.9; }
/* Emissions trend legend: the chart's own colours (TOC grey, VOC dark blue, as the Emissions page) */
.chart-legend-swatch.loc-swatch-toc { background-color: #94a3b8; }
.chart-legend-swatch.loc-swatch-voc { background-color: #1e3a8a; }
.location-figures { max-width: 24rem; }

/* A dashboard card reloading in place (Monitoring overview's pace cards): faded, not clickable, until it arrives */
[data-overview-card].is-loading { opacity: 0.5; pointer-events: none; }

/* Out of Service dashboard: every list keeps a fixed height and scrolls, its header row in view */
.oos-table-pane { max-height: 300px; overflow: auto; }
.oos-table-pane > .table > thead th { position: sticky; top: 0; z-index: 2; }
.oos-affected .spinner { width: 0.8rem; height: 0.8rem; border-width: 2px; vertical-align: -0.1rem; }

/* Sections, Units, Areas and Sub Areas lists: count cells and the note line while their counts load (place-counts.js) */
[data-count] .spinner { width: 0.8rem; height: 0.8rem; border-width: 2px; vertical-align: -0.1rem; }
.place-counts-notes .loading-message { padding: 0.25rem 0; text-align: start; font-size: 0.8rem; }

/* Out of Service: the Carry over panel lists a year's open periods in a table, wider than a form */
.offcanvas.offcanvas-carryover { width: 640px; max-width: 100vw; }

/* Shared/_Layout: the Ask AI toolbar button, the one decorated control in the app (owner's choice): an orange-to-red
   gradient with a softly glowing icon. The glow is on the icon, as .btn strips shadows; reduced motion keeps it steady.
   Its two colours are set here only, so the hue can be changed in one place */
:root {
    --ask-ai-from: #f97316;
    --ask-ai-to: #dc2626;
}

.btn.btn-ask-ai {
    background: linear-gradient(135deg, var(--ask-ai-from), var(--ask-ai-to));
    border: 1px solid var(--ask-ai-to);
    color: #ffffff;
    font-weight: 600;
}

.btn.btn-ask-ai:hover,
.btn.btn-ask-ai:focus-visible,
.btn.btn-ask-ai:active {
    background: linear-gradient(135deg, var(--ask-ai-from), var(--ask-ai-to));
    border-color: var(--ask-ai-to);
    color: #ffffff;
    filter: brightness(1.08);
}

.btn.btn-ask-ai .bi-stars {
    display: inline-block;
    animation: ask-ai-glow 2.4s ease-in-out infinite;
}

@keyframes ask-ai-glow {
    0%, 100% { filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.6)); }
    50% { filter: drop-shadow(0 0 4px #ffffff) drop-shadow(0 0 8px #fde68a); }
}

@media (prefers-reduced-motion: reduce) {
    .btn.btn-ask-ai .bi-stars {
        animation: none;
        filter: drop-shadow(0 0 3px #ffffff);
    }
}

/* "Ask AI" panel (_AssistantPanel): a chat column, full width on a narrow screen; an open report widens it to fit its
   table (never narrower than the chat, never wider than the screen; a wider table scrolls inside). The chat width
   grows with the toolbar's font size (--font-scale) so a larger text size keeps the same words per line */
.offcanvas.assistant-panel {
    width: min(calc(480px * var(--font-scale, 1)), 100vw);
}

.offcanvas.assistant-panel.assistant-panel-report {
    width: fit-content;
    min-width: min(calc(480px * var(--font-scale, 1)), 100vw);
    max-width: 100vw;
}

/* Dragged by its title bar, the panel docks full height on the left, in the centre or on the right (default) of the screen */
.assistant-panel .assistant-drag-handle {
    cursor: move;
    user-select: none;
}

.offcanvas.assistant-panel.assistant-dock-left {
    left: 0;
    right: auto;
    border-left: 0;
    border-right: 1px solid #9ca3af;
}

.offcanvas.assistant-panel.assistant-dock-center {
    left: 0;
    right: 0;
    margin-inline: auto;
    border-left: 1px solid #9ca3af;
    border-right: 1px solid #9ca3af;
}

.offcanvas.assistant-panel.assistant-dragging {
    right: auto;
    transform: none;
    opacity: 0.85;
}

/* A help topic folded under a short answer (e.g. leak threshold → how leaks work): the title reads as a link */
.assistant-more {
    margin-top: 0.4rem;
}

.assistant-more > summary {
    color: var(--bs-link-color);
    cursor: pointer;
}

.assistant-more[open] > summary {
    margin-bottom: 0.4rem;
}

/* Answer tables are as wide as their contents, not Bootstrap's 100%: a two-column count doesn't stretch across the panel */
.assistant-panel .table {
    width: auto;
}

/* The query line and the chart take the width the table gives the panel; they never widen it themselves */
.assistant-panel-report #askReportQuery,
.assistant-report-chart {
    contain: inline-size;
}

/* Chat view and report view: each fills the panel below its header; only the thread / report body scrolls */
.assistant-view {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.assistant-thread-wrap {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
}

.assistant-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    background-color: var(--assistant-bg, #ffffff);
}

/* Colour in the panel header: 8 soft preset colours for the conversation's background (--assistant-bg, set by
   assistant.js); the chosen one is outlined, and its name is its tooltip */
.assistant-color-grid {
    display: grid;
    grid-template-columns: repeat(8, 1.5rem);
    gap: 3px;
}

.assistant-color-swatch {
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: 1px solid #d1d5db;
}

.assistant-color-swatch:hover,
.assistant-color-swatch:focus-visible {
    border-color: #374151;
}

.assistant-color-swatch.active {
    outline: 2px solid #111827;
    outline-offset: 1px;
}

.assistant-thread {
    padding: 0.75rem 1rem;
}

/* The user's question: compact, right-aligned, a soft green (no status meaning: status colours are yellow, red,
   purple and grey). Rounded on purpose, the one exception to the square-corner rule, so it reads as a chat bubble;
   the corner by the panel edge stays tight like a speech tail */
.assistant-msg-user {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.6rem;
}

.assistant-bubble {
    max-width: 80%;
    background-color: #ecfdf3;
    border: 1px solid #bbe5cc;
    color: #14532d;
    border-radius: 12px 12px 3px 12px;
    padding: 0.3rem 0.7rem;
    font-size: 0.85rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* The answer: full width plain text */
.assistant-msg-ai {
    margin-bottom: 1.1rem;
    font-size: 0.875rem;
}

/* One result behind an answer: what it is, the query, and Open report */
.assistant-report-chip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
    border: 1px solid #e5e7eb;
    padding: 0.25rem 0.5rem;
    margin-top: 0.4rem;
    font-size: 0.8rem;
}

.assistant-report-chip .assistant-report-query {
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 auto;
}

.assistant-new-response {
    position: absolute;
    bottom: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
}

/* Grows with the question up to about four lines, then scrolls */
.assistant-input {
    resize: none;
    max-height: 6.5rem;
    overflow-y: auto;
}
.assistant-report-body {
    flex: 1 1 auto;
    overflow: auto;
    scrollbar-gutter: stable; /* the fitted width includes the vertical scrollbar, so a long table doesn't scroll sideways */
}

.assistant-report-body .chart,
.assistant-report-body .chart-yaxis {
    height: 300px;
}

/* The page title: the breadcrumb's current page as the page's h1, a little larger than the links, in the one-line header bar */
.breadcrumb:has(.page-title) { align-items: baseline; }
.page-title { display: inline; margin: 0; font-size: 1.05rem; font-weight: 600; line-height: 1.3; color: #111827; }
/* My Shortcuts (Shortcuts/Index): each task a flat card in a wrapping grid, its title the button that runs it in a pop-up;
   an answer's reports in full under it (title, tools, table) */
.shortcut-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(20rem, 100%), 1fr)); gap: 1rem; min-height: 3rem; }
.shortcut-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto 1fr auto; gap: 0.5rem 0.75rem; min-height: 8rem; border: 1px solid #d1d5db; border-radius: var(--ldar-radius); background-color: #ffffff; padding: 1.25rem 1.5rem; min-width: 0; cursor: pointer; }
.shortcut-card.shortcut-dragging { opacity: 0.45; outline: 2px dashed #2563eb; }
.shortcut-grid.shortcut-drop-target { background-color: #f9fafb; outline: 1px dashed #9ca3af; }
.shortcut-card.shortcut-color-none:hover { background-color: #f9fafb; }
.shortcut-swatch { width: 1.75rem; height: 1.75rem; margin: 0; border: 1px solid #d1d5db; cursor: pointer; background-color: #ffffff; }
/* A card's own colour (owner's choice, the user's tiles only; UserShortcut.Colors): a soft tint and a coloured left edge */
.shortcut-color-grey { background-color: #f3f4f6; border-left: 4px solid #6b7280; }
.shortcut-color-blue { background-color: #eff6ff; border-left: 4px solid #3b82f6; }
.shortcut-color-teal { background-color: #f0fdfa; border-left: 4px solid #14b8a6; }
.shortcut-color-green { background-color: #f0fdf4; border-left: 4px solid #22c55e; }
.shortcut-color-yellow { background-color: #fefce8; border-left: 4px solid #eab308; }
.shortcut-color-orange { background-color: #fff7ed; border-left: 4px solid #f97316; }
.shortcut-color-red { background-color: #fef2f2; border-left: 4px solid #ef4444; }
.shortcut-color-purple { background-color: #faf5ff; border-left: 4px solid #a855f7; }
.shortcut-card[class*="shortcut-color-"]:not(.shortcut-color-none):hover { filter: brightness(0.98); }
.shortcut-swatches { display: flex; gap: 0.25rem; flex-wrap: wrap; }
/* An icon choice (UserShortcut.Icons): the icon itself in a white square, as the colour swatches */
.shortcut-icon-swatch { display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; color: #374151; }
.btn-check:checked + .shortcut-swatch { outline: 2px solid #111827; outline-offset: 1px; }
.btn-check:focus-visible + .shortcut-swatch { outline: 2px dashed #2563eb; outline-offset: 1px; }
/* The whole card runs the task: the title button stretches over it; edit and delete sit above */
.shortcut-open { border: 0; background: none; padding: 0; color: inherit; text-align: left; min-width: 0; font-size: 1.05rem; font-weight: 600; line-height: 1.3; }
.shortcut-open::after { content: ""; position: absolute; inset: 0; }
.shortcut-open:focus-visible { outline: none; }
.shortcut-card:has(.shortcut-open:focus-visible) { outline: 2px solid #2563eb; outline-offset: 1px; }
.shortcut-card-tools { position: relative; z-index: 1; display: flex; gap: 0.25rem; align-self: start; }
.shortcut-card-from { grid-column: 1 / -1; }
.shortcut-share-list { max-height: 16rem; overflow-y: auto; border: 1px solid #d1d5db; padding: 0.35rem 0.5rem; }
.shortcut-card-question { grid-column: 1 / -1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; line-height: 1.35; }
.shortcut-card:hover .shortcut-open { text-decoration: underline; }
.shortcut-preview { border-top: 1px solid #e5e7eb; padding-top: 0.3rem; }
.shortcut-report { border: 1px solid #e5e7eb; margin-top: 0.5rem; overflow-x: auto; }
.shortcut-report-line { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.4rem; font-size: 0.85rem; background-color: #f9fafb; border-bottom: 1px solid #e5e7eb; }

/* The model's Markdown answer: no extra paragraph gaps; any table it writes looks like a data table */
.assistant-answer > :last-child {
    margin-bottom: 0;
}

.assistant-answer p, .assistant-answer ul, .assistant-answer ol {
    margin-bottom: 0.4rem;
}

.assistant-answer table {
    border-collapse: collapse;
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
}

.assistant-answer th, .assistant-answer td {
    border: 1px solid #d1d5db;
    padding: 0.15rem 0.4rem;
}

.assistant-answer th {
    background-color: #e5e7eb;
}

.select2-container {
    z-index: 1060 !important;
}

.select2-dropdown {
    z-index: 1061 !important;
}

.select2-search__field {
    width: 100% !important;
}

/* Auth page tweaks */
body.bg-light {
    background-color: #f5f6f8 !important;
}

.card .form-floating > label {
    color: #6c757d;
}

.card .form-control:focus {
    box-shadow: none;
}

/* remove Ukrainian flag from map*/
.leaflet-attribution-flag {
    display: none !important;
}


/* Site Management's link lists (the Plant Admin section and the others) */
.admin-block-links a {
    display: block;
    padding: 0.2rem 0;
    color: #1f2937;
    text-decoration: none;
}

.admin-block-links a:hover {
    color: #2563eb;
    text-decoration: underline;
}

.admin-block-links .bi {
    color: #6b7280;
    width: 1.25rem;
}

/* Site Management: each panel's links one per row (hairline between), the page's name left and what it holds muted right */
.site-links li {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-bottom: 1px solid #f0f1f3;
}

.site-links li:last-child {
    border-bottom: 0;
}

.site-links a {
    color: #1f2937;
    text-decoration: none;
    white-space: nowrap;
}

.site-links a:hover {
    color: #2563eb;
    text-decoration: underline;
}

.site-links a .bi {
    color: #6b7280;
    width: 1.5rem;
    display: inline-block;
}

.site-links li:hover {
    background: #f8fafc;
}

.site-links-hint {
    margin-left: auto;
    color: #6b7280;
    font-size: 0.8125rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Plant Admin: its links in columns across the wide panel */
.site-admin-links {
    columns: 4 14rem;
    column-gap: 1.5rem;
}

.site-admin-links li {
    break-inside: avoid;
}

/* Page scrolling: html/body never scroll (see section 1), so the area below the top nav does.
   Header stays fixed; long pages (forms, details) scroll here instead of being clipped. */
body {
    display: flex;
    flex-direction: column;
}

.app-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* The page footer (_Layout) sits at the bottom of the scroll area: under the content on a long page, at the window's foot on a
   short one */
.app-scroll > main { flex: 1 0 auto; width: 100%; } /* full width: a record page's auto margins would otherwise shrink it */
.app-scroll > .footer { flex-shrink: 0; padding: 0.35rem 0; font-size: 0.8rem; background-color: #ffffff; }

/* Single-record pages (Details / Create / Edit / Delete, set in _Layout): a centered container, so a label and its
   value or field stay together on wide monitors. Index, hub, dashboard and work pages keep the full width. */
main.page-record {
    max-width: 1140px;
    margin-left: auto;
    margin-right: auto;
}


/* Inspection Results: a from / to number in the filter bar (ppm, drops per minute), as narrow as its figures */
.filter-num { width: 6rem; }
/* Monitoring Hub: flat tab strip, KPI strip, SVG meters and charts (sized by SVG attributes, never inline styles) */
.hub-tabs {
    display: flex;
    background-color: #ffffff;
    border-bottom: 1px solid #d1d5db;
    padding: 0 1rem;
}

.hub-tabs a {
    padding: 0.4rem 0.9rem;
    color: #4b5563;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.hub-tabs a:hover {
    color: #111827;
    background-color: #f3f4f6;
}

.hub-tabs a.active {
    color: #111827;
    font-weight: 600;
    border-bottom-color: #2563eb;
}

.hub-tabs a:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: -2px;
}

.kpi-strip > div {
    padding: 0.4rem 1rem;
    border-right: 1px solid #d1d5db;
}

/* Home dashboard status strip: separate blocks on the light band, each a link that filters the leak table. Colour is
   telemetry only, and white at zero: active leaks take the soft red of the active table rows (status-critical), overdue
   steps up to solid red, the most serious state, and due soon / flagged / awaiting retest take amber (status-warning);
   no attempt and repaired are always white. The block the table shows has a dark grey outline, so blue stays the colour of the one
   action (Log Repair) */
.leak-status-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
}

.kpi-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-width: 6.75rem;
    padding: 0.3rem 0.6rem 0.25rem;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-top: 3px solid #d1d5db;
    border-radius: var(--ldar-radius);
    color: #111827;
    text-decoration: none;
}

.kpi-block:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.kpi-block .kpi-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kpi-block .kpi-value {
    font-size: 1.6rem;
    line-height: 1.2;
    text-align: center;
}

.kpi-block .kpi-sub {
    text-align: center;
    font-size: 0.8rem;
}

.kpi-block.kpi-critical {
    background-color: #fee2e2;
    border-color: #fca5a5;
    border-top-color: #dc2626;
}

.kpi-block.kpi-critical:hover {
    background-color: #fecaca;
}

.kpi-block.kpi-critical .kpi-label,
.kpi-block.kpi-critical .kpi-value,
.kpi-block.kpi-critical .kpi-sub {
    color: #991b1b;
}

.kpi-block.kpi-alarm {
    background-color: #dc2626;
    border-color: #b91c1c;
    border-top-color: #7f1d1d;
}

.kpi-block.kpi-alarm:hover {
    background-color: #b91c1c;
}

.kpi-block.kpi-alarm .kpi-label,
.kpi-block.kpi-alarm .kpi-value,
.kpi-block.kpi-alarm .kpi-sub {
    color: #ffffff;
}

.kpi-block.kpi-warning {
    background-color: #fef3c7;
    border-color: #fcd34d;
    border-top-color: #d97706;
}

.kpi-block.kpi-warning:hover {
    background-color: #fde68a;
}

.kpi-block.kpi-warning .kpi-label,
.kpi-block.kpi-warning .kpi-value,
.kpi-block.kpi-warning .kpi-sub {
    color: #92400e;
}

/* Selected: dark grey sides and a thick bottom edge; the background and top edge keep their status colour */
.kpi-block.kpi-block-active:not(.kpi-critical):not(.kpi-alarm):not(.kpi-warning) {
    background-color: #f3f4f6;
}

.kpi-block.kpi-block-active {
    border-left-color: #374151;
    border-right-color: #374151;
    border-bottom: 3px solid #374151;
}

/* Log Repair as the strip's last block, at the right end: the page's main action, in the primary button colour */
.kpi-block.kpi-action {
    font: inherit;
    cursor: pointer;
    min-width: 7.5rem;
    background-color: #2563eb;
    border-color: #1d4ed8;
    color: #ffffff;
}

.kpi-block.kpi-action:hover {
    background-color: #1d4ed8;
    color: #ffffff;
}

.kpi-block.kpi-action:disabled {
    cursor: default;
    opacity: 0.55;
}

.kpi-action-icon {
    font-size: 1.25rem;
    line-height: 1.2;
}

.kpi-block.kpi-action .kpi-label {
    color: #ffffff;
}

.kpi-block.kpi-action .kpi-sub {
    color: #dbeafe;
}

/* The 12-month trend at the strip's right end: small, fixed width */
.kpi-trend {
    width: 300px;
    margin-left: auto;
    padding: 0.25rem 0.6rem;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: var(--ldar-radius);
}

.chart-pane-trend {
    position: relative;
    height: 80px;
}

/* Small icon buttons on a chart: show its data as a table, copy it */
.chart-tool {
    color: #4b5563;
    line-height: 1;
}

.chart-tool:hover {
    color: #111827;
}


/* Home dashboard: the leak list beside the unit / type charts; the list never runs under the charts */
.leak-dashboard {
    display: flex;
    align-items: flex-start;
}

.leak-dashboard-main {
    flex: 1 1 auto;
    min-width: 0;
}

.leak-dashboard-side {
    flex: 0 0 320px;
    width: 320px;
    padding: 0.5rem;
    border-left: 1px solid #d1d5db;
    background-color: #f9fafb;
}

/* Closed with the Charts button or the panel's close button: the leak list takes the full width */
.leak-dashboard.charts-hidden .leak-dashboard-side {
    display: none;
}

/* Unit / type bar charts (Chart.js): every unit / type gets a bar, so dashboard-charts.js sets the height from their number */
.chart-pane-bars {
    position: relative;
    height: 230px;
}

@media (max-width: 991.98px) {
    .leak-dashboard {
        flex-direction: column;
        align-items: stretch;
    }

    .leak-dashboard-side {
        width: auto;
        flex-basis: auto;
        border-left: 0;
        border-top: 1px solid #d1d5db;
    }

    .kpi-trend {
        width: 100%;
        margin-left: 0;
    }
}

/* Leak list filters (Leaks/Index and Home; one row on Recurring Components): the everyday fields in the first row (search,
   status, place, type, detected), then the filter buttons and, at the right end, the count and the table's tools; More
   filters opens a second row under a hairline (closed, installed and decommissioned dates, recurring leaks, control
   valves), open on load when one is set */
.leak-filters-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.4rem 0.75rem;
}

.leak-filters-more {
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid #d1d5db;
}

.filter-field {
    display: flex;
    flex-direction: column;
}

.filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 2px;
}

.filter-field .form-select {
    min-width: 10rem;
}

.filter-field .input-group {
    flex-wrap: nowrap;
}

.filter-field input[type="date"] {
    width: 8.5rem;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* A condition set on another page and kept in the list (the recurring-leak one): a small grey label with its own remove x */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1rem 0.1rem 0.1rem 0.5rem;
    font-size: 0.8rem;
    background-color: #e5e7eb;
    border: 1px solid #d1d5db;
    border-radius: var(--ldar-radius);
    color: #111827;
}

.filter-chip .filter-chip-remove {
    padding: 0 0.25rem;
    line-height: 1;
    color: #4b5563;
}

.leak-search {
    width: 17rem;
    flex-wrap: nowrap;
}

/* The search box's help popover: one example per line */
.search-help {
    font-size: 0.75rem;
}

.search-help > div + div {
    margin-top: 0.2rem;
}

.search-help .component-tag {
    display: inline-block;
    min-width: 4.5rem;
}

/* While the leak list reloads (leak-list.js): the message above a faded, inert table */
.leak-loading .loading-message {
    padding: 0.4rem;
    font-size: 0.8rem;
}

.leak-table-pane.is-loading {
    opacity: 0.4;
    pointer-events: none;
}

/* Tablets: the leak list keeps its essential columns; the trailing ones (work order, section, fluid, repair dates, days)
   are still copied and exported */
@media (max-width: 991.98px) {
    .leak-table-pane .col-extra {
        display: none;
    }
}

/* Leak list table: scrolls both ways inside its pane, which leak-list.js fits to the browser window (a short list keeps
   its own height); the header row stays in view */
.leak-table-pane {
    overflow: auto;
}

.leak-table-pane > .table > thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

/* Annual Emissions: the years table beside the trend chart keeps the chart's height (its plot and year labels) and
   scrolls, header in view, however many years are stored */
.annual-years-pane {
    max-height: 200px;
    overflow: auto;
}

.annual-years-pane > .table > thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.kpi-label {
    font-size: 0.75rem;
    color: #6b7280;
}

.kpi-strip .status-warning .kpi-label,
.kpi-strip .status-critical .kpi-label {
    color: inherit;
}

.kpi-value {
    font-size: 1.15rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.kpi-sub {
    font-size: 0.75rem;
    color: #6b7280;
    text-align: right;
}

/* Section headings: the one heading style for every block on a page (Monitoring panels, card headers).
   Quiet for a professional data tool: a light-to-mid grey band, clearly darker than both the page
   background (#f3f4f6) and white content, with hairline rules and a small semi-bold title. Never a dark
   bar and never coloured: colour is reserved for status. */
.section-title,
.card > .card-header {
    background-color: #e5e7eb;
    border-top: 1px solid #d1d5db;
    border-bottom: 1px solid #d1d5db;
    color: #111827;
    padding: 0.3rem 0.75rem;
    font-weight: 700;
    font-size: 1rem;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

/* The first band of a page column needs no rule above it; later ones get a small gap (the page
   background shows through) so stacked sections read as separate blocks */
.section-title:first-child {
    border-top-color: transparent;
}

.section-title:not(:first-child) {
    margin-top: 0.5rem;
}

/* Panels: the standard page section. A section-title heading plus its content, boxed with a hairline
   outline, white inside, small corners, no shadow; panels sit on the grey page with a small gap. */
.panel {
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: var(--ldar-radius);
    margin: 0.5rem;
}

/* The heading band and the last block follow the panel's corners (no overflow: hidden, which would clip dropdowns) */
.panel > :first-child {
    border-top-left-radius: calc(var(--ldar-radius) - 1px);
    border-top-right-radius: calc(var(--ldar-radius) - 1px);
}

.panel > :last-child {
    border-bottom-left-radius: calc(var(--ldar-radius) - 1px);
    border-bottom-right-radius: calc(var(--ldar-radius) - 1px);
}

.panel > .section-title,
.card > .card-header {
    border-top: 0;
}

.panel > :last-child {
    border-bottom: 0 !important;
}

/* Existing Bootstrap cards render as panels: hairline outline, white, small corners (see .panel) */
.card {
    border: 1px solid #d1d5db;
    background-color: #ffffff;
}

/* Decorative header colours become the neutral band (Bootstrap's bg-* utilities are !important).
   bg-danger / bg-warning headers keep their colour: they may signal a status. */
.card > .card-header.bg-primary,
.card > .card-header.bg-info,
.card > .card-header.bg-secondary,
.card > .card-header.bg-dark,
.card > .card-header.bg-success,
.card > .card-header.bg-light {
    background-color: #e5e7eb !important;
    color: #111827 !important;
}

.card > .card-header .card-title,
.card > .card-header h5,
.card > .card-header h6 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0;
}

.meter {
    display: block;
    width: 100%;
    height: 8px;
}

.meter-lg {
    height: 14px;
}

.meter-track {
    fill: #e5e7eb;
}

.meter-fill {
    fill: #475569;
}

.meter-mark {
    stroke: #111827;
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

/* Progress ring (pass overview strip); sized here, drawn by _Ring.cshtml */
.ring {
    display: block;
    width: 3.5rem;
    height: 3.5rem;
}

.ring-track,
.ring-fill {
    fill: none;
    stroke-width: 3.5;
}

.ring-track {
    stroke: #e5e7eb;
}

.ring-fill {
    stroke: #15803d; /* inspected share: green by request, muted to suit the flat style */
}

.ring-text {
    font-size: 9px;
    font-weight: 700;
    fill: #111827;
    text-anchor: middle;
    dominant-baseline: central;
    font-variant-numeric: tabular-nums;
}

.td-meter {
    width: 30%;
    min-width: 120px;
}

/* Group header rows inside a data table (e.g. sections over their units): a neutral band, not a status colour.
   Bootstrap 5.3 paints stripes through --bs-table-bg-type, so set it to keep the band on every stripe. */
.table > tbody > tr.table-group-row > * {
    --bs-table-bg-type: #f3f4f6;
    border-top: 2px solid #d1d5db;
}

/* Compact per-category progress cell: numbers over a thin bar */
.td-meter-sm {
    min-width: 110px;
    font-variant-numeric: tabular-nums;
}

.td-meter-sm .meter {
    height: 4px;
    margin-top: 2px;
}

/* "Ask AI" periods side by side: a grey ramp, latest darkest (mirrored as SHADES in assistant.js for Copy chart) */
.chart-shade-0 { fill: #cbd5e1; background-color: #cbd5e1; }
/* A pie's categories (charts.js pie, its legend's swatches): a neutral slate ramp, mid to light (owner: not too dark), as the slices are ordered */
.chart-pie-0 { background-color: #64748b; } .chart-pie-1 { background-color: #6f7f95; } .chart-pie-2 { background-color: #7a899f; }
.chart-pie-3 { background-color: #8593a8; } .chart-pie-4 { background-color: #909db1; } .chart-pie-5 { background-color: #9ba7ba; }
.chart-pie-6 { background-color: #a6b1c3; } .chart-pie-7 { background-color: #b1bbcc; } .chart-pie-8 { background-color: #bcc5d4; }
.chart-pie-9 { background-color: #c7cfdc; } .chart-pie-10 { background-color: #d2d9e4; } .chart-pie-11 { background-color: #dde3eb; }
.chart-shade-1 { fill: #94a3b8; background-color: #94a3b8; }
.chart-shade-2 { fill: #64748b; background-color: #64748b; }
.chart-shade-3 { fill: #334155; background-color: #334155; }

/* "Ask AI" counts of different things side by side (leaks vs repaired, inspections vs leaks): each keeps one meaningful
   colour, leaks red and repaired green as in the status colours (mirrored as SERIES_COLORS in assistant.js) */
.chart-series-leaks { fill: #dc2626; background-color: #dc2626; }
.chart-series-repaired { fill: #16a34a; background-color: #16a34a; }
.chart-series-closed { fill: #15803d; background-color: #15803d; }
.chart-series-outstanding { fill: #d97706; background-color: #d97706; }
.chart-series-inspections { fill: #2563eb; background-color: #2563eb; }
.chart-series-components { fill: #0d9488; background-color: #0d9488; }
.chart-series-component_groups { fill: #0891b2; background-color: #0891b2; }
.chart-series-pipes { fill: #a16207; background-color: #a16207; }
.chart-series-fluids { fill: #7c3aed; background-color: #7c3aed; }
/* Emissions: total organic compounds (TOC) light, its VOC part dark (Annual Emissions trend, Lara's emissions trend) */
.chart-series-toc { fill: #94a3b8; background-color: #94a3b8; }
.chart-series-voc { fill: #1e3a8a; background-color: #1e3a8a; }

.chart-legend-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    vertical-align: middle;
}

/* Days of the pass not reached yet, and the line after today's bar */
.chart-future {
    fill: #f3f4f6;
}

/* Emissions rate chart: hours with no usable rate (amber, a warning), the neutral swatch, out of service in the legend */
.chart-unresolved { fill: #d97706; fill-opacity: 0.35; background-color: rgba(217, 119, 6, 0.35); }
.chart-swatch-neutral { background-color: #94a3b8; }
.chart-legend-swatch.chart-future { background-color: #e5e7eb; }

.chart-legend-ref {
    display: inline-block;
    width: 18px;
    border-top: 2px dashed #b45309;
    vertical-align: middle;
}

.check-list > div {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.check-list .check-value {
    font-variant-numeric: tabular-nums;
}

.form-section {
    background-color: #ffffff;
    border-bottom: 1px solid #d1d5db;
    padding: 0.5rem 1rem 0.75rem;
}

.form-section-title {
    font-weight: 700;
    font-size: 1rem;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 0.4rem;
    padding-bottom: 0.2rem;
}

.form-section .form-label {
    font-size: 0.75rem;
    color: #4b5563;
    margin-bottom: 0.1rem;
}

/* A chart showing a window of a longer series (Annual Emissions: 12 years): arrows over its plot's left and right edges */
.chart-paged { position: relative; }
.chart-page-arrow {
    position: absolute;
    top: 70px;
    padding: 0.1rem 0.35rem;
    background-color: rgba(255, 255, 255, 0.85);
    border: 1px solid #cbd5e1;
    color: #334155;
    line-height: 1;
    z-index: 1;
}
.chart-page-arrow:hover { background-color: #f1f5f9; color: #111827; }
.chart-page-prev { left: 2.5rem; }
.chart-page-next { right: 0; }

/* A small pie of shares (run page: monitored vs not monitored, component types; Views/EmissionRuns/_SharePie, drawn by Chart.js in share-pie.js) */
.chart-pie { width: 6rem; height: 6rem; flex: none; position: relative; }

/* A Chart.js chart's box (wwwroot/js/charts.js): the canvas fills it; the height is the chart's, as the SVG charts had */
.chart-box { position: relative; height: 200px; }
.chart-pie-key { width: 0.7rem; height: 0.7rem; vertical-align: -0.05rem; }

.td-select {
    width: 2rem;
    cursor: pointer;
}

/* Click-to-sort column header: a bare button filling the cell; the arrow follows aria-sort on the <th> */
.th-sort {
    all: unset;
    cursor: pointer;
    display: block;
    width: 100%;
    font-weight: inherit;
    text-align: inherit;
}

.th-sort:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

th[aria-sort="ascending"] .th-sort::after {
    content: " \25B2";
    font-size: 0.7em;
}

th[aria-sort="descending"] .th-sort::after {
    content: " \25BC";
    font-size: 0.7em;
}

/* Monitoring/OgiMedia: the drop zone for a group's camera files (keyboard focus and a drag over it show a grey band) */
.ogi-drop {
    display: block;
    border: 1px dashed currentColor;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
}
.ogi-drop:focus-visible, .ogi-drop.is-over {
    background: rgba(127, 127, 127, 0.12);
}

/* Video poster frame thumbnail: one table row tall in lists, larger on detail pages */
.ogi-poster {
    height: 1.5rem;
    width: auto;
    vertical-align: middle;
}

.ogi-poster-lg {
    height: 4.5rem;
}

/* An OGI inspection's Picture and Video cells in inspection tables (_InspectionMediaCell): photo thumbnails one row tall, the whole picture
   at its own aspect ratio; photos open the shared viewer, videos the shared player */
.inspection-media {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.media-cell-thumb {
    display: block;
    height: 1.5rem;
    width: 2rem;
    object-fit: contain;
    border: 1px solid #d1d5db;
    background: #f3f4f6;
    cursor: zoom-in;
}

/* Rejection reason in the review list: truncated, full text in the title tooltip */
.td-reason {
    max-width: 20rem;
}

/* Report Settings: logo in the header preview */
.report-logo-preview {
    max-height: 24px;
    max-width: 96px;
    vertical-align: middle;
}

/* Report Settings live PDF preview: stays in view while the form scrolls */
.report-preview-pane {
    position: sticky;
    top: 0.5rem;
}

.report-preview-frame {
    display: block;
    width: 100%;
    height: calc(100vh - 9rem);
    border: 0;
}

/* Bootstrap modals in the panel look (same as .ldar-dialog for SweetAlert2): grey title band, dense body/footer */
.modal-content {
    border: 1px solid #d1d5db;
}

.modal-header {
    background-color: #e5e7eb;
    border-bottom: 1px solid #d1d5db;
    padding: 0.35rem 0.75rem;
}

.modal-header .modal-title {
    color: #111827;
    font-size: 1rem;
    font-weight: 700;
}

.modal-header .btn-close {
    padding: 0.25rem;
    font-size: 0.65rem;
}

.modal-body {
    padding: 0.75rem;
    font-size: 0.85rem;
}

.modal-footer {
    gap: 0.25rem;
    padding: 0.4rem 0.75rem;
    border-top: 1px solid #e5e7eb;
}

.modal-footer > * {
    margin: 0;
}

.modal-backdrop.show {
    opacity: 0.35;
}

/* Long modal content (e.g. audit log changes) scrolls inside the body */
.modal-body-scroll {
    max-height: 600px;
    overflow-y: auto;
}

/* Blocks the page while a long server action runs (e.g. System Settings backup); content is a .loading-message */
.busy-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 24, 39, 0.35);
}

/* Notification dropdown (_Layout): clickable rows, one-line preview */
.notification-item {
    cursor: pointer;
}

.notification-preview {
    max-width: 300px;
}

/* Media viewer (_MediaManagementPartial): black stage under the standard title band */
.media-view-body {
    max-height: 80vh;
    overflow: auto;
    background-color: #000;
}

/* Full-screen photo viewer (component Details): black stage, image fitted, dragged to pan */
.image-zoom-body {
    overflow: auto;
    background-color: #000;
}

.image-zoom-img {
    max-width: 100%;
    max-height: calc(100vh - 60px);
    object-fit: contain;
    cursor: grab;
}

/* SweetAlert2 in the control-room look: flat, small corners, dense, no animation (pairs with the Swal.mixin in js/ui-feedback.js) */
.ldar-dialog {
    width: 26rem !important;
    padding: 0 !important;
    border: 1px solid #d1d5db;
    border-radius: var(--ldar-radius) !important;
    overflow: hidden; /* the title band and the button row follow the corners */
    font-size: 0.85rem;
    text-align: left;
}
.ldar-dialog .swal2-icon { display: none !important; }
.ldar-dialog-title {
    background-color: #e5e7eb;
    border-bottom: 1px solid #d1d5db;
    color: #111827;
    font-size: 1rem !important;
    font-weight: 700;
    padding: 0.35rem 0.75rem !important;
    margin: 0 !important;
    text-align: left !important;
}
.ldar-dialog-body {
    margin: 0 !important;
    padding: 0.75rem 0.75rem 0 !important;
    color: #374151 !important;
    font-size: 0.85rem !important;
    text-align: left !important;
}
.ldar-dialog .swal2-input-label { justify-content: flex-start; margin: 0.5rem 0.75rem 0 !important; }
.ldar-dialog .swal2-input { width: auto !important; height: auto !important; margin: 0.2rem 0.75rem 0 !important; box-shadow: none !important; }
.ldar-dialog-validation {
    justify-content: flex-start !important;
    margin: 0.5rem 0.75rem 0 !important;
    padding: 0.25rem 0.5rem !important;
    background: #fee2e2 !important;
    color: #991b1b !important;
    font-size: 0.8rem !important;
}
.ldar-dialog-validation::before { display: none !important; }
.ldar-dialog-actions {
    justify-content: flex-end !important;
    gap: 0.25rem;
    width: 100%;
    box-sizing: border-box;
    margin: 0.75rem 0 0 !important;
    padding: 0.5rem 0.75rem !important;
    border-top: 1px solid #e5e7eb;
}
.ldar-dialog-actions .btn { margin: 0 !important; }
.ldar-dialog .swal2-loader { width: 1.1rem; height: 1.1rem; margin: 0 0.25rem; border-width: 2px; border-color: #2563eb transparent #2563eb transparent; }
/* Status colour only where it carries meaning: warning/error dialogs get a coloured top edge and a red confirm */
.ldar-dialog.swal2-icon-warning { border-top: 3px solid #d97706; }
.ldar-dialog.swal2-icon-error { border-top: 3px solid #dc2626; }
.ldar-dialog.swal2-icon-warning .swal2-confirm,
.ldar-dialog.swal2-icon-error .swal2-confirm { background-color: #dc3545 !important; border-color: #dc3545 !important; }
.swal2-container.swal2-backdrop-show { background: rgba(17, 24, 39, 0.35) !important; }

/* Toastr in the control-room look (defaults in js/ui-feedback.js): white, small corners, hairline border, status colour only on the left edge */
#toast-container > div {
    width: 320px;
    padding: 0.5rem 0.75rem 0.5rem 0.9rem;
    border: 1px solid #d1d5db;
    border-left-width: 4px;
    border-radius: var(--ldar-radius);
    background-color: #ffffff;
    background-image: none !important;
    box-shadow: none;
    color: #111827;
    font-size: 0.8rem;
    opacity: 1;
}
#toast-container > div:hover { box-shadow: none; }
#toast-container > .toast-success { border-left-color: #16a34a; }
#toast-container > .toast-info    { border-left-color: #2563eb; }
#toast-container > .toast-warning { border-left-color: #d97706; }
#toast-container > .toast-error   { border-left-color: #dc2626; background-color: #fef2f2; }
#toast-container .toast-title { font-weight: 700; font-size: 0.8rem; }
#toast-container .toast-close-button { color: #6b7280; text-shadow: none; opacity: 1; font-size: 1rem; }
#toast-container .toast-progress { background-color: #9ca3af; opacity: 1; height: 2px; }

/* ==========================================================================
   Page classes from the 2026-10-23 CLAUDE.md view clean-up (replacing inline styles and <style> blocks)
   ========================================================================== */

/* --- Shared, Home, Admin, Error, Test views --- */
/* Shared/_Layout: impersonation banner (red = impersonation; -viewer modifier = blue read-only viewer mode) */
.impersonation-banner { background-color: #b91c1c; color: #fff; padding: 4px 0; position: sticky; top: 0; flex-shrink: 0; z-index: 1030; font-weight: 600; }
/* Shared/_Layout: viewer-mode variant of the impersonation banner */
.impersonation-banner.impersonation-banner-viewer { background-color: #1d4ed8; }
/* Shared/_Layout: impersonation banner inner row */
.impersonation-banner .container-fluid { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
/* Shared/_Layout: impersonation banner left info group */
.impersonation-banner-info { display: flex; align-items: center; gap: 15px; }
/* Shared/_Layout: impersonation banner right action group */
.impersonation-banner-actions { display: flex; align-items: center; gap: 10px; }
/* Shared/_Layout: impersonation indicator (static; animations are off site-wide) */
.impersonation-indicator { font-weight: 700; }
/* Shared/_ParametersCategoryAdd + _ParametersCategoryCreate: "Include" checkbox column width */
.rule-param-col-include { width: 50px; }
/* Shared/_ParametersCategoryAdd + _ParametersCategoryCreate: "Value" input column width */
.rule-param-col-value { width: 150px; }
/* Shared/_ParametersCategoryAdd + _ParametersCategoryCreate: "Unit" column width */
.rule-param-col-unit { width: 100px; }
/* Shared/_ParametersCategoryAdd + _ParametersCategoryCreate: "Include" checkbox column width */
.rule-param-col-include { width: 50px; }
/* Shared/_ParametersCategoryAdd + _ParametersCategoryCreate: "Value" input column width */
.rule-param-col-value { width: 150px; }
/* Shared/_ParametersCategoryAdd + _ParametersCategoryCreate: "Unit" column width */
.rule-param-col-unit { width: 100px; }
/* Shared/_DisplayCommonFields: square icon tile beside each created/updated/deleted field */
.audit-field-icon { width: 40px; height: 40px; }
/* Shared/_LoginPartial: navbar notification dropdown width */
.notification-dropdown-menu { min-width: 350px; max-width: 400px; }
/* Shared/_LoginPartial: scrollable notification list inside the dropdown */
.notification-dropdown-list { max-height: 400px; }
/* Shared/_MediaManagementPartial: fixed-height media thumbnail (image, video, file tile) */
.media-thumb { height: 120px; object-fit: contain; background: #f3f4f6; } /* whole photo, its own shape */
/* Shared/_MediaManagementPartial: clickable thumbnail that opens the media viewer */
.media-thumb-link { cursor: pointer; }
/* Shared/_MediaManagementPartial: grey tile behind non-image/video file icons */
.media-thumb-file { background: #f0f0f0; }
/* Shared/_MediaManagementPartial: file-type / play icon inside a thumbnail */
.media-thumb-icon { font-size: 2rem; }
/* Shared/_MediaManagementPartial: large icon in the empty / error state of the media list */
.media-empty-icon { font-size: 3rem; }
/* Shared/_MediaManagementPartial: image/video in the media viewer modal */
.media-view-full { max-height: 70vh; width: auto; }
/* Shared/_MediaManagementPartial: file icon in the media viewer when no preview is available */
.media-view-file-icon { font-size: 5rem; }
/* Error/Status (every error and status page, layout _Layout_Status): one narrow panel near the top of the page */
.status-page { max-width: 40rem; margin: 3rem auto 0; }
.status-page-title { font-size: 1rem; font-weight: 700; margin: 0; }
/* The HTTP status before its words, in the monospace used for identifiers; no colour: an error page is not a compliance status */
.status-page-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; margin-right: 0.6rem; }
/* Address, reference and time: label and value side by side */
.status-page-facts { display: grid; grid-template-columns: max-content 1fr; column-gap: 0.75rem; row-gap: 0.15rem; }
.status-page-facts dt { font-weight: 600; }
.status-page-facts dd { margin: 0; overflow-wrap: anywhere; }
/* Common/_AuditLogsPartial: Date/Time column width */
.audit-col-when { width: 15%; }
/* Common/_AuditLogsPartial: Action column width */
.audit-col-action { width: 10%; }
/* Common/_AuditLogsPartial: User column width */
.audit-col-user { width: 15%; }
/* Common/_AuditLogsPartial: Changes column width */
.audit-col-changes { width: 60%; }
/* Common/_AuditLogs: empty-state icon */
.audit-empty-icon { font-size: 2rem; }
/* Common/_AuditLogs: square user icon tile */
.audit-user-icon { width: 28px; height: 28px; }
/* Common/_AuditLogs: truncated changes text */
.audit-changes-cell { max-width: 300px; }
/* Test/Index: progress bar inside the multi-component PDF progress toast */
.pdf-test-progress { height: 20px; }

/* --- Site hierarchy views (Areas ... OutOfServices, Components) --- */
/* Initially hidden blocks that scripts reveal via style.display / jQuery .show() (so not d-none): Areas/SubAreas/ComponentGroups Index reorder buttons, map/grid containers, drag cells, filter context; Drawings Edit upload progress; Components Details annotation error */
.entity-view-hidden { display: none; }
/* A long name in a list column: clipped to keep the table inside the page, the whole name in the cell's title */
.table td.cell-clip { max-width: 10rem; overflow: hidden; text-overflow: ellipsis; }

/* Areas/SubAreas/ComponentGroups Index: narrow Order column of the reorderable list */
.reorder-order-col { width: 60px; }

/* Areas/SubAreas/ComponentGroups Index: drag handle cell in reorder mode */
td.drag-handle { cursor: move; }
/* Hidden until reorder mode (table-reorder.js shows them and adds .reorder-mode to the table) */
table:not(.reorder-mode) .drag-handle { display: none; }

/* Areas/SubAreas/ComponentGroups Index: list/grid while reorder mode is on (table-reorder.js adds .reorder-mode) */
.reorder-mode { background-color: #f8f9fa; }
.reorder-mode tbody tr { cursor: move; }
.reorder-mode tbody tr:hover { background-color: #e9ecef; }

/* Areas/SubAreas/ComponentGroups Index: grid view tiles (div.* beats the defaults entity-views.js injects at runtime) */
div.grid-view-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; padding: 0; }
.grid-view-container .grid-item { border: 1px solid #dee2e6; border-radius: 0; padding: 1rem; position: relative; }
.grid-view-container .grid-item:hover { box-shadow: none; transform: none; }
.grid-view-container .grid-item .entity-image { width: 100%; height: 150px; margin-bottom: 0.75rem; overflow: hidden; background: #f8f9fa; display: flex; align-items: center; justify-content: center; }
.grid-view-container .grid-item .entity-image img { width: 100%; height: 100%; object-fit: contain; }
.grid-view-container .grid-item .order-badge { position: absolute; top: 0.5rem; right: 0.5rem; background: #6c757d; color: #fff; padding: 0.25rem 0.5rem; border-radius: 0; font-size: 0.875rem; font-weight: 600; }
.grid-view-container .grid-item .entity-name { font-weight: 600; margin-bottom: 0.5rem; }
.grid-view-container .grid-item .entity-info { font-size: 0.875rem; color: #6c757d; margin-bottom: 0.25rem; }
.grid-view-container .grid-item .entity-actions { margin-top: 0.75rem; display: flex; gap: 0.25rem; }

/* Areas/SubAreas/ComponentGroups Index: placeholder icon in a grid tile without a photo */
.entity-image-placeholder-icon { font-size: 3rem; }

/* Areas/SubAreas/ComponentGroups/Sections Index: large muted icon above an empty-list message */
.empty-state-icon { font-size: 4rem; color: #dee2e6; }

/* Sections Index, ServiceEquipments Index: image column and 50px square thumbnail / placeholder */
.list-thumb-col { width: 60px; }
.list-thumb { width: 50px; height: 50px; object-fit: contain; background: #f3f4f6; }

/* OutOfServices _OutOfServices partial (entity details pages): date and status column widths */
.oos-col-date { width: 20%; }
.oos-col-status { width: 15%; }

/* OutOfServices _OutOfServiceListPartialView: truncated Reason column */
.oos-reason-cell { max-width: 150px; }

/* ComponentGroups _ComponentsListPartial: smaller muted icon above an empty sub-list message */
.empty-state-icon-sm { font-size: 2rem; color: #dee2e6; }

/* Areas/SubAreas/Sections/Units/Plants/ComponentGroups/ServiceEquipments Create/Edit/Details: fixed-height boundary / location map panes */
.map-pane-350 { height: 350px; }
.map-pane-400 { height: 400px; }
.map-pane-500 { height: 500px; }
.map-pane-bordered { border: 1px solid #dee2e6; }

/* Areas/Units/Plants Details: large icon in the hierarchy count tiles */
.stat-icon-lg { font-size: 2rem; }

/* Areas/SubAreas/Sections/ServiceEquipments Details: primary photo (cover crop); ComponentGroups Details: primary photo (contain) */
.media-primary-img { max-height: 400px; object-fit: contain; }
.media-primary-img-contain { max-height: 400px; object-fit: contain; }

/* Areas/SubAreas/Sections/ComponentGroups/ServiceEquipments Details: 80px media gallery thumbnails and their placeholders */
.media-thumb-80 { height: 80px; width: 100%; object-fit: contain; background: #f3f4f6; }
.media-thumb-80-placeholder { height: 80px; }

/* Drawings DisplayDrawing: scrollable grey canvas area holding the stacked PDF and overlay canvases (sizes set by JS) */
.drawing-canvas-container { position: relative; width: 100%; height: 100vh; overflow: auto; background-color: #808080; border: 2px solid red; }
.drawing-canvas-layer { position: absolute; top: 0; left: 0; }
.drawing-canvas-overlay { pointer-events: none; }

/* Components Details: label column of the key/value info tables */
.kv-label-45 { width: 45%; }
.kv-label-40 { width: 40%; }
/* A record's notes (BaseEntity.Note) on its details page: the line breaks typed are kept */
.note-text { white-space: pre-line; }

/* Components Details: annotated image opens a zoom view; media thumbnails open an enlarged view */
.media-zoomable { cursor: zoom-in; }

/* ComponentGroups/Details live picture (group-photo-live.js): the components marked over the photo as the static picture draws
   them (red leader line, yellow label; red label for an open leak); a label is clicked for its card, double-clicked to open */
.group-photo-live { text-align: center; }
.group-photo-frame { position: relative; display: inline-block; max-width: 100%; }
.group-photo-frame > img { display: block; max-width: 100%; max-height: 400px; }
.group-photo-marks { position: absolute; inset: 0; width: 100%; height: 100%; }
.group-photo-line { fill: none; stroke: #ff0000; pointer-events: none; }
.group-photo-label { cursor: pointer; }
.group-photo-label rect { fill: #ffff00; stroke: #ff0000; }
.group-photo-label text { fill: #000000; font-family: Consolas, "Courier New", monospace; font-weight: 600; pointer-events: none; }
.group-photo-label.is-leaking rect { fill: #b91c1c; }
.group-photo-label.is-leaking text { fill: #ffffff; }
.group-photo-label.is-selected rect, .group-photo-label:focus rect { stroke: #2563eb; }
.group-photo-label:focus { outline: none; }
.group-photo-card { text-align: left; border: 1px solid #d1d5db; background: #ffffff; padding: 0.25rem 0.5rem; margin-top: 0.25rem; }

/* Photo thumbnail that opens the shared photo pop-up (photo-viewer.js, data-photo-viewer): fixed box, the whole picture in
   it at its own aspect ratio (never cropped or stretched; grey shows around it), hairline border; a caption says what it is */
.photo-thumb { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; border: 1px solid #d1d5db; background: #f3f4f6; cursor: zoom-in; }
.photo-thumb:hover, .photo-thumb:focus-visible { border-color: #374151; outline: none; }
.photo-thumb-caption { font-size: 0.85rem; color: #4b5563; margin-top: 0.15rem; }
/* A record's pictures under its main photo (group and component Details): a row of small thumbnails, each opening the viewer
   in the record's set (data-photo-set) so it steps Previous / Next through them; wraps on a narrow screen */
.photo-strip { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.25rem; }
.photo-strip > .photo-thumb { width: 88px; }

/* The shared photo pop-up: a large dialog over the dimmed page (photo-viewer.js). Fitted, the picture is centred in a box of
   fixed height; zoomed, it keeps its size and the box scrolls (drag to move) */
.photo-viewer-body { padding: 0.5rem; background: #111827; display: flex; align-items: center; justify-content: center; overflow: auto; height: min(75vh, 900px); }
.photo-viewer-img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; user-select: none; touch-action: none; }
/* The picture sits in a stage, so an overlay (photoViewerOverlays) sized to it zooms and moves with it; fitted, the picture is as
   tall as the body's inside at most, as before */
.photo-viewer-stage { position: relative; display: inline-block; max-width: 100%; }
.photo-viewer-stage > .photo-viewer-img { display: block; max-height: calc(min(75vh, 900px) - 1rem); }
.photo-viewer-zoomed .photo-viewer-stage { max-width: none; }
.photo-viewer-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.photo-viewer-overlay .group-photo-label { pointer-events: auto; }
.modal-content:has(.photo-viewer-card) { position: relative; }
.photo-viewer-card { position: absolute; left: 0.75rem; bottom: 0.75rem; min-width: 14rem; max-width: 20rem; background: #ffffff; border: 1px solid #d1d5db; padding: 0.25rem 0.5rem; }
.photo-viewer-zoomed { display: block; text-align: left; }
.photo-viewer-zoomed .photo-viewer-img { max-width: none; max-height: none; cursor: grab; }
.photo-viewer-zoomed .photo-viewer-img:active { cursor: grabbing; }
/* Upload progress in its toast (upload-progress.js): a thin bar of how much of the file is sent; grey while the server saves it */
.upload-progress { height: 4px; background: #e5e7eb; margin-top: 0.35rem; }
.upload-progress-bar { height: 100%; width: 0; background: #2563eb; }
.upload-progress-saving .upload-progress-bar { background: #6b7280; }
.photo-viewer-error { color: #d1d5db !important; padding: 2rem 0; }
.media-clickable { cursor: pointer; }

/* Components Index: chart containers */
.chart-pane-250 { height: 250px; }
.chart-pane-300 { height: 300px; }

/* --- Monitoring, Registers, Leaks, Inspections, OfflineMaps --- */
/* OfflineMaps/Index: chunked PBF upload progress bar */
.pbf-upload-progress { height: 25px; }
/* OfflineMaps/_PlantTileStatusPartial + wwwroot/js/OfflineMaps/tile-generator.js: thin "generating" bar */
.tile-status-progress { height: 8px; }
/* OfflineMaps/_PlantTileStatusPartial + tile-generator.js: label column of the status key/value table */
.tile-status-label { width: 40%; }
/* OfflineMaps/PlantTiles: Leaflet clip-area map */
.offline-map-canvas { height: 600px; }
/* OfflineMaps/PlantTiles: leaflet-draw toolbar icons (was a page <style> block) */
.leaflet-draw-toolbar a { background-size: 24px 24px; }

/* --- Lookups, Rules, SystemAdmin, CompanyPortal, SystemMessages, SystemSettings, Users --- */
/* G4: SystemAdmin + CompanyPortal (lead part); parts 1-3 appended below */

/* SystemAdmin/_SysAdminLayout: portal body (body class="sa-body") */
.sa-body { background: #f4f4f5; font-size: 0.825rem; }
/* SystemAdmin/_SysAdminLayout, CompanyPortal/_CompanyLayout: portal button text size */
.sa-body .btn, .cp-body .btn { font-size: 0.8rem; }
/* SystemAdmin/_SysAdminLayout: top navbar */
.sa-navbar { background: #1a0a2e; border-bottom: 2px solid #6f2da8; }
/* SystemAdmin/_SysAdminLayout: navbar brand */
.sa-navbar .navbar-brand { color: #c084fc; font-weight: 700; letter-spacing: 0.04em; font-size: 0.9rem; }
/* SystemAdmin/_SysAdminLayout: navbar links */
.sa-navbar .nav-link { color: #cdd9e5; font-size: 0.8rem; padding: 0.25rem 0.75rem; }
/* SystemAdmin/_SysAdminLayout: navbar link hover/active */
.sa-navbar .nav-link:hover, .sa-navbar .nav-link.active { color: #fff; }
/* SystemAdmin/_SysAdminLayout: signed-in banner under the navbar */
.sa-banner { background: #120720; color: #a78bca; font-size: 0.72rem; padding: 2px 0; border-bottom: 1px solid #3d1a6e; }
/* SystemAdmin/_SysAdminLayout: page body padding */
.sa-main { padding: 0.75rem 1rem; }
/* SystemAdmin/Dashboard: KPI block (border colour overridable with border-success / border-warning) */
.stat-block { border-left: 3px solid #6f2da8; border-radius: var(--ldar-radius); padding: 0.4rem 0.75rem; background: #fff; }
/* SystemAdmin/Dashboard: KPI value */
.stat-block .stat-val { font-size: 1.4rem; font-weight: 700; line-height: 1.1; }
/* SystemAdmin/Dashboard: KPI label */
.stat-block .stat-label { font-size: 0.7rem; color: #666; text-transform: uppercase; letter-spacing: 0.05em; }
/* SystemAdmin/Dashboard: Provisioning KPI block accent */
.stat-block-provisioning { border-left-color: #fd7e14; }
/* SystemAdmin/Companies: logo thumbnail in the company table */
.company-logo-thumb { height: 24px; width: 24px; object-fit: contain; }
/* SystemAdmin/Companies (edit modal, built in JS): current logo preview */
.company-logo-preview { height: 40px; object-fit: contain; }

/* CompanyPortal/_CompanyLayout: portal body (body class="cp-body") */
.cp-body { background: #f4f4f5; font-size: 0.825rem; }
/* CompanyPortal/_CompanyLayout: top navbar */
.cp-navbar { background: #0d1b2a; border-bottom: 2px solid #1e6091; }
/* CompanyPortal/_CompanyLayout: navbar brand */
.cp-navbar .navbar-brand { color: #4db8ff; font-weight: 700; letter-spacing: 0.04em; font-size: 0.9rem; }
/* CompanyPortal/_CompanyLayout: navbar links */
.cp-navbar .nav-link { color: #cdd9e5; font-size: 0.8rem; padding: 0.25rem 0.75rem; }
/* CompanyPortal/_CompanyLayout: navbar link hover/active */
.cp-navbar .nav-link:hover, .cp-navbar .nav-link.active { color: #fff; }
/* CompanyPortal/_CompanyLayout: signed-in banner under the navbar */
.cp-banner { background: #172a3a; color: #8ab4cc; font-size: 0.72rem; padding: 2px 0; border-bottom: 1px solid #1e4060; }
/* CompanyPortal/_CompanyLayout: page body padding */
.cp-main { padding: 0.75rem 1rem; }
/* CompanyPortal/_CompanyLayout: sysadmin impersonation warning strip */
.cp-impersonation-bar { background: #7c2d00; color: #ffd7b5; font-size: 0.72rem; padding: 3px 12px; border-bottom: 2px solid #b84500; display: flex; align-items: center; gap: 8px; }
/* CompanyPortal/_CompanyLayout: "Return to SysAdmin" link in the impersonation strip */
.cp-impersonation-bar a { color: #ffd7b5; margin-left: auto; font-weight: 600; text-decoration: underline; }
/* CompanyPortal/Create, CompanyPortal/Edit: narrow form column */
.portal-form-narrow { max-width: 540px; }

/* SystemAdmin/Login, CompanyPortal/Login: centred login page (body class="portal-login-body sa-login" / "portal-login-body cp-login") */
.portal-login-body { font-size: 0.825rem; display: flex; align-items: center; justify-content: center; min-height: 100vh; margin: 0; }
/* SystemAdmin/Login: page background */
.portal-login-body.sa-login { background: #1a0a2e; }
/* CompanyPortal/Login: page background */
.portal-login-body.cp-login { background: #0d1b2a; }
/* SystemAdmin/Login, CompanyPortal/Login: login box */
.portal-login-box { background: #fff; border-top: 3px solid #1e6091; width: 360px; padding: 1.5rem; }
/* SystemAdmin/Login: login box accent */
.sa-login .portal-login-box { border-top-color: #6f2da8; }
/* SystemAdmin/Login, CompanyPortal/Login: brand line */
.portal-login-brand { color: #1e6091; font-weight: 700; font-size: 0.85rem; letter-spacing: 0.04em; }
/* SystemAdmin/Login: brand colour */
.sa-login .portal-login-brand { color: #6f2da8; }

/* Fluids/ManageSubstances: thin total-mass-percent progress bar (width stays inline, set from data) */
.fluid-mass-progress {
    height: 8px;
}

/* RemoteConfig/Index: truncated Description / Default Value cells */
.remote-config-truncate {
    max-width: 15rem;
}

/* SystemMessages/Index + Archive: truncated message content preview */
.system-message-content {
    max-width: 25rem;
}

/* SystemMessages/Details: message body box (was the page's <style> .message-content) */
.system-message-body {
    font-size: 1rem;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    padding: 1.5rem;
    min-height: 150px;
}

/* SystemSettings/Index: Management Hub card lets its Quick Access dropdown overflow above the next cards */
.settings-hub-card {
    overflow: visible;
    position: relative;
    z-index: 2;
}

/* SystemSettings/Index: Management Hub Quick Access dropdown list scrolls */
.settings-hub-menu {
    max-height: 300px;
    overflow-y: auto;
}

/* SystemSettings/Index: clickable collapse header of System Information */
.settings-collapse-header {
    cursor: pointer;
}

/* Users/Index: thin progress bar under the Active / Inactive user counts */
.users-stat-progress {
    height: 5px;
}

/* Shutdowns/Edit: scrollable unit picker */
.shutdown-unit-list {
    max-height: 14rem;
    overflow-y: auto;
}

/* Users/Create + Edit: multi-select role list height */
.users-roles-select {
    height: 120px;
}

/* Overall pass progress in the Monitoring overview bar: a short meter beside its figures */
.overall-meter {
    display: inline-block;
    width: 160px;
    vertical-align: middle;
}

/* Monitoring overview: the work tiles are navigation tiles. One grid with the panels' margins (no negative gutters, so they
   line up with the panels); four across on a wide screen and one column below. Corners: the app's small radius (a .card). */
.tile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
    margin: 0.5rem;
}

@media (min-width: 1200px) {
    .tile-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.card.tile-card {
    overflow: hidden;
    background-color: #eff6ff;
    border-color: #bfdbfe;
    color: #1e3a8a;
}

a.card.tile-card:hover {
    background-color: #dbeafe;
}

a.card.tile-card:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Monitoring overview: each tile is a row. The icon on the left, the action and its counts beside it, an arrow on the right. */
.tile-card .card-body {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
    min-height: 4.5rem;
}

.tile-card .tile-icon {
    font-size: 1.6rem;
    color: #2563eb;
    flex: 0 0 auto;
}

.tile-card .tile-text {
    flex: 1 1 auto;
    min-width: 0;
}

.tile-card .tile-title {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    text-wrap: balance;
}

.tile-card .tile-line {
    font-size: 0.85rem;
    color: #6b7280;
}

.tile-card .tile-arrow {
    color: #2563eb;
    flex: 0 0 auto;
}

/* Monitoring overview: facts as a list in two columns (one on a narrow screen), each figure bold and the words after it */
.fact-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem 1.5rem;
    list-style: none;
    margin: 0;
    padding: 0.75rem 1rem;
}

.fact-list > li {
    min-width: 0;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid #f3f4f6;
}

.fact-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
    font-variant-numeric: tabular-nums;
    margin-right: 0.3rem;
}

@media (max-width: 575.98px) {
    .fact-list {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Monitoring overview: the work tiles in two groups (Work, Log): side by side from a small screen up (two tiles across),
   one column only on a phone */
.tile-groups {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
    margin: 0.5rem;
}

@media (min-width: 576px) {
    .tile-groups {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.tile-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

@media (min-width: 1200px) {
    /* Wide screens: all four tiles in one row. The groups stop being boxes; their labels are hidden to keep the row even. */
    .tile-groups {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .tile-group {
        display: contents;
    }

    .tile-group > .section-label {
        display: none;
    }
}
details.form-section > summary {
    cursor: pointer;
    list-style: none;
}

details.form-section > summary::-webkit-details-marker {
    display: none;
}

details.form-section > summary::after {
    content: "Show";
    margin-left: 0.5rem;
    font-weight: 400;
    font-size: 0.85rem;
    color: #2563eb;
}

details.form-section[open] > summary::after {
    content: "Hide";
}

/* Monitoring overview: the operational look. Scoped to the page (class monitoring-overview on its root), so the shared
   panels, tables and cards elsewhere stay as they are. Compact tables with hairline row rules and no vertical grid lines,
   light section bands, blue for everything clickable, and five action cards that match each other. */
.monitoring-overview {
    --bs-link-color: #2563eb;
    --bs-link-hover-color: #1d4ed8;
}

.monitoring-overview .btn-primary {
    --bs-btn-bg: #2563eb;
    --bs-btn-border-color: #2563eb;
    --bs-btn-hover-bg: #1d4ed8;
    --bs-btn-hover-border-color: #1d4ed8;
    --bs-btn-active-bg: #1d4ed8;
    --bs-btn-active-border-color: #1d4ed8;
}

.monitoring-overview .panel {
    border-color: #e5e7eb;
}

.monitoring-overview .panel > .p-2 {
    overflow-x: auto;
}

.monitoring-overview .section-title {
    background-color: #f8fafc;
    border-bottom-color: #e5e7eb;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.35rem 0.6rem;
}

.monitoring-overview .section-title:not(:first-child) {
    border-top-color: #e5e7eb;
}

/* Copy and other secondary controls in a band: muted text, blue only on hover */
.monitoring-overview .section-title .btn-link {
    color: #6b7280;
    font-size: 0.85rem;
    text-decoration: none;
}

.monitoring-overview .section-title .btn-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

.monitoring-overview .section-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
}

/* Tables: row rules only. Bootstrap's cell borders on every side go; a hairline under each row stays. */
.monitoring-overview .table-sm > :not(caption) > * > * {
    padding: 0.3rem 0.5rem !important;
    line-height: 1.3;
}

.monitoring-overview .table-bordered > :not(caption) > * {
    border-width: 0;
}

.monitoring-overview .table-bordered > :not(caption) > * > * {
    border-width: 0 0 1px 0;
    border-color: #eef2f6;
}

.monitoring-overview .table-striped {
    --bs-table-striped-bg: #fafbfc;
}

.monitoring-overview .table > thead th {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    background-color: #ffffff;
    border-bottom: 1px solid #d1d5db;
}

/* Progress bars: one height for each kind of cell */
.monitoring-overview .td-meter .meter {
    height: 6px;
}

.monitoring-overview .td-meter-sm .meter {
    height: 4px;
}

.monitoring-overview .overall-meter {
    width: 120px;
}

/* Facts: a little tighter, the figure in a regular weight with the words after it */
.monitoring-overview .fact-list {
    gap: 0.3rem 1.25rem;
    padding: 0.5rem 0.75rem;
}

.monitoring-overview .fact-list > li {
    padding-bottom: 0.3rem;
    border-bottom-color: #f1f5f9;
}

.monitoring-overview .fact-value {
    font-size: 1rem;
}

/* Action cards: the four work cards, one light blue treatment for all: a pale blue card with a subtle blue border, a larger
   icon on a stronger pale blue chip, bold dark titles, and the whole card a link. Equal widths and compact height. */
.monitoring-overview .card.tile-card {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #111827;
    cursor: pointer;
}

.monitoring-overview a.card.tile-card:hover {
    background-color: #dbeafe;
    border-color: #93c5fd;
}

.monitoring-overview a.card.tile-card:focus-visible {
    outline: 2px solid #1d4ed8;
    outline-offset: 2px;
}

.monitoring-overview .tile-card .card-body {
    gap: 0.6rem;
    min-height: 3.25rem;
    padding: 0.5rem 0.65rem;
}

.monitoring-overview .tile-card .tile-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    font-size: 1.3rem;
    background-color: #dbeafe;
    color: #2563eb;
}

.monitoring-overview .tile-card .tile-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #111827;
}

.monitoring-overview .tile-card .tile-line {
    font-size: 0.85rem;
    color: #4b5563;
}

.monitoring-overview .tile-card .tile-arrow {
    color: #2563eb;
}

/* A column may shrink below its widest table: the table scrolls inside its panel instead of widening the page */
.monitoring-overview .row > [class*="col-"] {
    min-width: 0;
}

/* Monitoring overview: the list links in the header bar, plain blue text separated by dots */
.monitoring-overview .monitoring-links {
    gap: 0.25rem 0;
    font-size: 0.85rem;
}

.monitoring-overview .monitoring-links a + a::before {
    content: "·";
    color: #9ca3af;
    margin: 0 0.6rem;
}

.monitoring-overview .monitoring-links a:hover {
    text-decoration: underline;
}

/* Monitoring overview pass card: its headings and note line up with the figures in its fact lists (which sit inside a 0.75rem inset) */
.monitoring-overview .pass-card-note {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

/* A number edited in a table row (Fluids/ManageSubstances): narrow, right-aligned, as a cell reads */
.inline-number { width: 7rem; }

/* A long run (an emissions run, Emissions/emissions-hub.js; tenant migrations, SystemAdmin/Tenants): the page locked under a dimmed overlay (owner's
   rule: no work while it computes), a large ring filling to the components calculated (blue: in progress), the percent in its middle */
body.run-overlay-open { overflow: hidden; }
.run-overlay { position: fixed; inset: 0; z-index: 2000; background-color: rgba(17, 24, 39, 0.6); display: flex; align-items: center; justify-content: center; }
.run-overlay-card { background-color: #ffffff; border: 1px solid #d1d5db; border-top: 4px solid #2563eb; width: 26rem; max-width: calc(100vw - 2rem); padding: 1.5rem; text-align: center; }
.run-overlay-card.run-overlay-failed { border-top-color: #b91c1c; }
.run-ring-box { position: relative; width: 10rem; height: 10rem; margin: 0 auto 1rem; }
.run-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.run-ring-track { fill: none; stroke: #dbeafe; stroke-width: 10; }
.run-ring-value { fill: none; stroke: #2563eb; stroke-width: 10; }
.run-ring-waiting .run-ring { animation: run-ring-spin 1.2s linear infinite; }
@keyframes run-ring-spin { from { transform: rotate(-90deg); } to { transform: rotate(270deg); } }
.run-ring-pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2.25rem; font-weight: 700; color: #1e3a8a; font-variant-numeric: tabular-nums; }
.run-overlay-title { font-weight: 600; font-size: 1rem; color: #111827; }
.run-overlay-failed .run-overlay-title { color: #991b1b; }
.run-overlay-text { margin-top: 0.25rem; font-variant-numeric: tabular-nums; }
.run-overlay-note { margin-top: 0.5rem; font-size: 0.8125rem; color: #6b7280; }
.run-overlay-actions { margin-top: 1rem; display: flex; justify-content: center; gap: 0.5rem; }

/* A panel as tall as the panel beside it (lg and up: the emission run's Estimate beside By component type): taken out of the row's
   height, so the other column sets it; its .pane-match-scroll part (the calculation notes) scrolls. Stacked below lg, the notes cap */
.pane-match > .panel > .pane-match-body { display: flex; flex-direction: column; }
.pane-match-scroll { overflow-y: auto; max-height: 16rem; }
/* Its tables follow the panel's width: labels and text wrap (a word breaks only when it can't fit), numbers stay on one line */
.pane-match .table { width: 100%; }
.pane-match .table th, .pane-match .table td { white-space: normal; overflow-wrap: break-word; text-overflow: clip; }
.pane-match .table td.text-end { white-space: nowrap; }
@media (min-width: 992px) {
    .pane-match { position: relative; min-height: 22rem; }
    .pane-match > .panel { position: absolute; inset: 0 calc(var(--bs-gutter-x) * .5); display: flex; flex-direction: column; }
    .pane-match > .panel > .pane-match-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
    .pane-match-scroll { flex: 1 1 auto; min-height: 3rem; max-height: none; }
}
