/* ATS.Reporting.Components — reporting.css
   Fluent-token-based styles for all reporting components. */


/* ══════════════════════════════════════════════════════════════
   REPORT TOOLBAR
   ══════════════════════════════════════════════════════════════ */

.report-toolbar {
    --design-unit: 3;
    --base-height-multiplier: 8;
    padding: 2px 4px;
    min-height: unset;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
}

.report-toolbar fluent-button {
    white-space: nowrap;
}

.report-toolbar .quick4-select {
    min-width: 140px;
}

.report-toolbar .quick4-select::part(listbox) {
    width: max-content;
    min-width: 100%;
}

.report-toolbar small {
    font-size: 0.8rem;
    opacity: 0.8;
    white-space: nowrap;
}

/* Stats bar — same compact inline look as the toolbar */
.report-stats-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 2px 4px;
    white-space: nowrap;
}

.report-stats-bar small {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-inline-start: 4px;
}

/* ══════════════════════════════════════════════════════════════
   SPLITTER PANE HELPERS
   ══════════════════════════════════════════════════════════════ */

.splitter-page {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 102px);
    max-width: 100%;
    overflow: hidden;
}

.splitter-pane-header {
    padding: 6px 8px;
    border-bottom: 1px solid var(--neutral-stroke-rest);
}


/* ══════════════════════════════════════════════════════════════
   STRUCTURAL (carried from minimal.css)
   ══════════════════════════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay > * {
    max-height: 90vh;
    max-width: 90vw;
    overflow-y: auto;
}

.dropdown-panel {
    position: absolute;
    z-index: 100;
    min-width: 100%;
}

.image-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    cursor: pointer;
}

.image-overlay img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
}

.tree-children {
    padding-inline-start: 1.25rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}


/* ══════════════════════════════════════════════════════════════
   FORM CONTROLS
   ══════════════════════════════════════════════════════════════ */

input,
select,
textarea {
    background: var(--neutral-layer-1);
    color: var(--neutral-foreground-rest);
    border: 1px solid var(--neutral-stroke-rest);
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    font: inherit;
    width: 100%;
    box-sizing: border-box;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--accent-fill-rest);
    outline-offset: -1px;
    border-color: var(--accent-fill-rest);
}

input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    accent-color: var(--accent-fill-rest);
}

button {
    background: var(--neutral-layer-3);
    color: var(--neutral-foreground-rest);
    border: 1px solid var(--neutral-stroke-rest);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font: inherit;
    cursor: pointer;
}

button:hover {
    background: var(--neutral-fill-stealth-hover);
}

button:focus-visible {
    outline: 2px solid var(--accent-fill-rest);
    outline-offset: 2px;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* ══════════════════════════════════════════════════════════════
   DIALOGS
   ══════════════════════════════════════════════════════════════ */
dialog[open] {
    background: var(--neutral-layer-1);
    color: var(--neutral-foreground-rest);
    border: 1px solid var(--neutral-stroke-rest);
    border-radius: 8px;
    padding: 0;
    min-width: 400px;
    max-width: 90vw;
}

dialog > header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--neutral-stroke-rest);
}

dialog > header button {
    background: none;
    border: none;
    color: var(--neutral-foreground-hint);
    font-size: 1.25rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
}

dialog > header button:hover {
    color: var(--neutral-foreground-rest);
}

dialog > section {
    padding: 1rem;
}

dialog > footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--neutral-stroke-rest);
}


/* ══════════════════════════════════════════════════════════════
   TREES
   ══════════════════════════════════════════════════════════════ */

[role="tree"] {
    list-style: none;
    padding: 0;
    margin: 0;
}

[role="treeitem"] {
    list-style: none;
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
}

[role="treeitem"]:hover {
    background: var(--neutral-layer-3);
}

[role="treeitem"][aria-selected="true"],
[role="treeitem"][aria-selected="True"] {
    background: var(--accent-fill-rest);
    color: var(--neutral-foreground-rest);
}

[role="treeitem"] > div {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

[role="treeitem"] button {
    background: none;
    border: none;
    color: var(--neutral-foreground-hint);
    padding: 0.1rem 0.3rem;
    font-size: 0.85rem;
    min-width: 1.2rem;
}

[role="treeitem"] button:hover {
    color: var(--neutral-foreground-rest);
}

[role="group"] {
    list-style: none;
    padding: 0;
    margin: 0;
}


/* ══════════════════════════════════════════════════════════════
   NAV TREE HIERARCHY (dark theme)
   DashboardHierarchy-style collapsible tree with level-based
   indentation, section borders, and badge counts.
   ══════════════════════════════════════════════════════════════ */

.nav-tree {
    width: 100%;
    font-size: 0.875rem;
    line-height: 1.4;
    background: var(--neutral-layer-1);
    border: 1px solid var(--neutral-stroke-rest);
    border-radius: 6px;
    overflow: hidden;
}

.nav-tree ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Reset base [role="treeitem"] styles for expandable nodes (leaf items have their own padding) */
.nav-tree [role="treeitem"]:not(.tree-leaf),
.nav-tree [role="treeitem"]:not(.tree-leaf):hover {
    padding: 0;
    border-radius: 0;
    background: transparent;
}

/* ── Level 1 – Root sections (Company / top-level group) ── */

.nav-tree .tree-l1 {
    border-bottom: 1px solid var(--neutral-stroke-rest);
}

.nav-tree .tree-l1:last-child {
    border-bottom: none;
}

.nav-tree .tree-l1 > div {
    cursor: pointer;
    padding: 6px 10px;
    background: var(--neutral-layer-2);
    border-bottom: 1px solid var(--neutral-stroke-rest);
    transition: background 0.15s ease;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--neutral-foreground-rest);
}

.nav-tree .tree-l1 > div:hover {
    background: var(--neutral-layer-3);
}

.nav-tree .tree-l1 > div > button {
    background: none;
    border: none;
    color: var(--neutral-foreground-hint);
    padding: 0;
    font-size: 0.75rem;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
    cursor: pointer;
    line-height: 1;
}

.nav-tree .tree-l1 > div > button:hover {
    color: var(--neutral-foreground-rest);
}

.nav-tree .tree-l1 > div > .tree-badge {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 2px 6px;
    margin-left: auto;
    background: rgba(91, 155, 213, 0.15);
    color: var(--accent-fill-rest);
    border-radius: 10px;
}

.nav-tree .tree-l1 > ul {
    background: var(--neutral-layer-1);
}

/* Collapsed L1 – remove header bottom border */
.nav-tree .tree-l1:not(:has(> ul)) > div {
    border-bottom: none;
}

/* ── Level 2 – Sub-sections (Location) ── */

.nav-tree .tree-l2 {
    border-bottom: 1px solid var(--neutral-stroke-divider-rest);
}

.nav-tree .tree-l2:last-child {
    border-bottom: none;
}

.nav-tree .tree-l2 > div {
    cursor: pointer;
    padding: 5px 10px 5px 24px;
    background: transparent;
    transition: background 0.15s ease;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--neutral-foreground-rest);
}

.nav-tree .tree-l2 > div:hover {
    background: var(--neutral-layer-3);
}

.nav-tree .tree-l2 > div > button {
    background: none;
    border: none;
    color: var(--neutral-foreground-hint);
    padding: 0;
    font-size: 0.7rem;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
    cursor: pointer;
    line-height: 1;
}

.nav-tree .tree-l2 > div > button:hover {
    color: var(--neutral-foreground-rest);
}

.nav-tree .tree-l2 > div > .tree-badge {
    font-size: 0.65rem;
    font-weight: 500;
    padding: 1px 5px;
    margin-left: auto;
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
    border-radius: 10px;
}

/* When tree-leaf rows live directly under a tree-l2 (e.g. infrared
   project rows under a Year/Month group), give the parent ul the same
   indented look the .tree-l3 > ul rule applies under categories. */
.nav-tree .tree-l2 > ul {
    padding: 4px 10px 8px 56px;
    background: var(--neutral-layer-1);
    border-top: 1px solid var(--neutral-layer-3);
    list-style: none;
    margin: 0;
}

/* ── Level 3 – Nested sections (Category) ── */

.nav-tree .tree-l3 {
    border-bottom: 1px solid var(--neutral-layer-3);
}

.nav-tree .tree-l3:last-child {
    border-bottom: none;
}

.nav-tree .tree-l3 > div {
    cursor: pointer;
    padding: 4px 10px 4px 40px;
    background: transparent;
    transition: background 0.15s ease;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--neutral-foreground-hint);
}

.nav-tree .tree-l3 > div:hover {
    background: var(--neutral-layer-3);
}

.nav-tree .tree-l3 > div > button {
    background: none;
    border: none;
    color: var(--neutral-foreground-hint);
    padding: 0;
    font-size: 0.65rem;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
    cursor: pointer;
    line-height: 1;
}

.nav-tree .tree-l3 > div > button:hover {
    color: var(--neutral-foreground-hint);
}

.nav-tree .tree-l3 > div > .tree-badge {
    font-size: 0.625rem;
    font-weight: 500;
    padding: 1px 5px;
    margin-left: auto;
    background: var(--neutral-layer-3);
    color: var(--neutral-foreground-hint);
    border: 1px solid var(--neutral-stroke-rest);
    border-radius: 10px;
}

.nav-tree .tree-l3 > ul {
    padding: 4px 10px 8px 56px;
    background: var(--neutral-layer-1);
    border-top: 1px solid var(--neutral-layer-3);
}

/* ── Leaf items ── */

.nav-tree .tree-leaf {
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    color: var(--neutral-foreground-rest);
    transition: background 0.15s ease;
}

.nav-tree .tree-leaf:hover {
    background: var(--neutral-layer-3);
}

.nav-tree .tree-leaf[aria-selected="true"],
.nav-tree .tree-leaf[aria-selected="True"] {
    background: var(--neutral-layer-3);
    border-left: 2px solid var(--accent-fill-rest);
    color: var(--neutral-foreground-rest);
}

.nav-tree .tree-leaf small {
    color: var(--neutral-foreground-hint);
    font-size: 0.75rem;
}

/* Badge inside a leaf row (e.g. infrared project rows in InfraredReportSelector).
   The l1/l2/l3 .tree-badge rules above only target `> div > .tree-badge` because
   expandable rows wrap their contents in a div; leaves are flat <li>s, so they
   need their own rule. Pushed right via margin-left:auto and styled to match l3. */
.nav-tree .tree-leaf > .tree-badge {
    font-size: 0.625rem;
    font-weight: 500;
    padding: 1px 5px;
    margin-left: auto;
    background: var(--neutral-layer-3);
    color: var(--neutral-foreground-hint);
    border: 1px solid var(--neutral-stroke-rest);
    border-radius: 10px;
    flex-shrink: 0;
}

.nav-tree .tree-sensor-indicator {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
}

.nav-tree .tree-sensor-wireless {
    color: var(--sensor-signal-wireless, #66bb6a);
}

.nav-tree .tree-sensor-hardwired {
    color: var(--sensor-signal-hardwired, #42a5f5);
}

.nav-tree .tree-sensor-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 4px;
}

.nav-tree .tree-sensor-group .tree-sensor-indicator {
    margin-left: 0;
}

/* ── Selected state for expandable nodes ── */

.nav-tree .tree-l2[aria-selected="true"] > div,
.nav-tree .tree-l2[aria-selected="True"] > div,
.nav-tree .tree-l3[aria-selected="true"] > div,
.nav-tree .tree-l3[aria-selected="True"] > div {
    background: var(--accent-fill-rest);
}


/* ── Priority indicators ── */

/* Compact mark overrides for tree context — colours come from the
   global mark[data-priority] / --priority-N system. */
.nav-tree mark {
    font-size: 0.6rem;
    padding: 1px 3px;
    line-height: 1;
    flex-shrink: 0;
    letter-spacing: -0.02em;
}
.nav-tree mark sup {
    font-size: 0.55rem;
    font-weight: 700;
    vertical-align: super;
    line-height: 0;
    margin-left: 1px;
    color: var(--neutral-foreground-rest);
}

.nav-tree .tree-stats {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex-shrink: 0;
}

.nav-tree .tree-priority-group {
    display: flex;
    align-items: center;
    gap: 2px;
}


/* ══════════════════════════════════════════════════════════════
   DROPDOWN (RecommendationPicker)
   ══════════════════════════════════════════════════════════════ */

.dropdown-panel {
    background: var(--neutral-layer-1);
    border: 1px solid var(--neutral-stroke-rest);
    border-radius: 4px;
    padding: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.dropdown-panel ul {
    list-style: none;
    padding: 0;
    margin: 0.25rem 0;
}

.dropdown-panel li[role="option"] {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: 3px;
    cursor: pointer;
}

.dropdown-panel li[role="option"]:hover {
    background: var(--neutral-layer-3);
}

.dropdown-panel li[role="option"][aria-selected="true"],
.dropdown-panel li[role="option"][aria-selected="True"] {
    background: var(--accent-fill-rest);
}

.dropdown-panel li[role="option"][aria-disabled="true"],
.dropdown-panel li[role="option"][aria-disabled="True"] {
    opacity: 0.5;
    pointer-events: none;
}

.dropdown-panel details {
    margin-bottom: 0.25rem;
}

.dropdown-panel summary {
    cursor: pointer;
    padding: 0.3rem 0.4rem;
    font-weight: 600;
    color: var(--neutral-foreground-hint);
}

.dropdown-panel summary:hover {
    color: var(--neutral-foreground-rest);
}

.dropdown-panel footer {
    padding-top: 0.5rem;
    border-top: 1px solid var(--neutral-stroke-rest);
    color: var(--neutral-foreground-hint);
}

.dropdown-panel p {
    margin: 0.25rem 0;
    color: var(--neutral-foreground-hint);
}


/* ══════════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════════ */

table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

thead {
    background: var(--neutral-layer-1);
}

th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid var(--neutral-stroke-rest);
    color: var(--neutral-foreground-hint);
    font-weight: 600;
    white-space: nowrap;
}

td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--neutral-stroke-divider-rest);
}

tbody tr {
    cursor: pointer;
}

tbody tr:hover {
    background: var(--neutral-layer-3);
}


/* ══════════════════════════════════════════════════════════════
   PRIORITY (data-priority driven)
   ══════════════════════════════════════════════════════════════ */

/* — mark badges — */
mark[data-priority="1"] { background-color: var(--priority-1); color: var(--priority-1-fg); }
mark[data-priority="2"] { background-color: var(--priority-2); color: var(--priority-2-fg); }
mark[data-priority="3"] { background-color: var(--priority-3); color: var(--priority-3-fg); }
mark[data-priority="4"] { background-color: var(--priority-4); color: var(--priority-4-fg); }
mark[data-priority="5"] { background-color: var(--priority-5); color: var(--priority-5-fg); }
mark[data-priority="5"][data-last-priority="1"] { color: var(--priority-1); }
mark[data-priority="5"][data-last-priority="2"] { color: var(--priority-2); }
mark[data-priority="5"][data-last-priority="3"] { color: var(--priority-3); }
mark[data-priority="5"][data-last-priority="4"] { color: var(--priority-4); }
mark[data-priority="6"] { background-color: var(--priority-6); color: var(--priority-6-fg); }

mark {
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-weight: 600;
    font-size: 0.85em;
    white-space: nowrap;
}

/* — div containers — */
div[data-priority="1"],
div[data-priority="2"],
div[data-priority="3"],
div[data-priority="4"],
div[data-priority="5"],
div[data-priority="6"] {
    padding: 0.5rem 1rem;
    display: inline-block;
    border-radius: 4px;
}

div[data-priority="1"] { background-color: var(--priority-1); color: var(--priority-1-fg); }
div[data-priority="2"] { background-color: var(--priority-2); color: var(--priority-2-fg); }
div[data-priority="3"] { background-color: var(--priority-3); color: var(--priority-3-fg); }
div[data-priority="4"] { background-color: var(--priority-4); color: var(--priority-4-fg); }
div[data-priority="5"] { background-color: var(--priority-5); color: var(--priority-5-fg); }
div[data-priority="6"] { background-color: var(--priority-6); color: var(--priority-6-fg); }

/* — select (priority dropdown) — */
select[data-priority="1"] { background-color: var(--priority-1); color: var(--priority-1-fg); }
select[data-priority="2"] { background-color: var(--priority-2); color: var(--priority-2-fg); }
select[data-priority="3"] { background-color: var(--priority-3); color: var(--priority-3-fg); }
select[data-priority="4"] { background-color: var(--priority-4); color: var(--priority-4-fg); }
select[data-priority="5"] { background-color: var(--priority-5); color: var(--priority-5-fg); }
select[data-priority="5"][data-last-priority="1"] { color: var(--priority-1); }
select[data-priority="5"][data-last-priority="2"] { color: var(--priority-2); }
select[data-priority="5"][data-last-priority="3"] { color: var(--priority-3); }
select[data-priority="5"][data-last-priority="4"] { color: var(--priority-4); }
select[data-priority="6"] { background-color: var(--priority-6); color: var(--priority-6-fg); }
select[data-priority="0"] {
    background-color: var(--neutral-layer-1);
    color: var(--neutral-foreground-rest);
}

/* Reset option elements inside a priority-colored select so the
   dropdown list is always readable regardless of the select's bg */
select[data-priority] option {
    background-color: var(--neutral-layer-1);
    color: var(--neutral-foreground-rest);
}


/* — dark-mode priority cards (EquipmentDashboard) — border-only, no fill — */
body[data-theme="dark"] .priority-subgroup .card[data-priority] {
    background: transparent;
}
body[data-theme="dark"] .priority-subgroup .card[data-priority] .value {
    color: var(--neutral-foreground-rest);
}
body[data-theme="dark"] .priority-subgroup .card[data-priority="5"] {
    border-color: var(--neutral-stroke-rest, #888);
}
/* System theme: fall back to OS preference */
@media (prefers-color-scheme: dark) {
    body[data-theme="system"] .priority-subgroup .card[data-priority] {
        background: transparent;
    }
    body[data-theme="system"] .priority-subgroup .card[data-priority] .value {
        color: var(--neutral-foreground-rest);
    }
    body[data-theme="system"] .priority-subgroup .card[data-priority="5"] {
        border-color: var(--neutral-stroke-rest, #888);
    }
}

/* ══════════════════════════════════════════════════════════════
   INSIGHTS (ReportInsightsPanel badges)
   ══════════════════════════════════════════════════════════════ */

section[aria-label="Report insights"] > div {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

section[aria-label="Report insights"] button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    background: var(--neutral-layer-1);
    border: 1px solid var(--neutral-stroke-rest);
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    min-width: 120px;
    cursor: pointer;
}

section[aria-label="Report insights"] button:hover {
    background: var(--neutral-layer-3);
    border-color: var(--accent-fill-rest);
}

section[aria-label="Report insights"] button strong {
    font-size: 1.5rem;
    color: var(--accent-fill-rest);
}

section[aria-label="Report insights"] button span {
    font-size: 0.8rem;
    color: var(--neutral-foreground-hint);
}

/* Let the PriorityCards component flow naturally inside the button */
section[aria-label="Report insights"] button:last-child {
    min-width: auto;
    padding: 0.5rem;
}


/* ══════════════════════════════════════════════════════════════
   IMAGES
   ══════════════════════════════════════════════════════════════ */

figure {
    margin: 0.5rem 0;
    display: inline-block;
}

figure img {
    border: 1px solid var(--neutral-stroke-rest);
    border-radius: 4px;
    max-width: 100%;
    cursor: pointer;
}

figure img:hover {
    border-color: var(--accent-fill-rest);
}

figcaption {
    color: var(--neutral-foreground-hint);
    font-size: 0.85em;
    padding-top: 0.25rem;
}


/* ══════════════════════════════════════════════════════════════
   SEMANTIC ELEMENTS
   ══════════════════════════════════════════════════════════════ */

search {
    display: block;
    margin-bottom: 0.5rem;
}

nav[aria-label="Location navigation"] > search {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--neutral-layer-1);
    padding: 8px 10px;
    margin: 0 0 0.5rem;
    border-bottom: 1px solid var(--neutral-stroke-divider-rest);
}

dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 0.75rem;
    margin: 0.5rem 0;
}

dt {
    color: var(--neutral-foreground-hint);
    font-weight: 600;
}

dd {
    margin: 0;
}

article {
    margin-bottom: 1rem;
}

article > header {
    margin-bottom: 0.75rem;
}

article > section {
    margin-bottom: 0.75rem;
}

article > footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--neutral-stroke-divider-rest);
}

nav[aria-label="Breadcrumb"] ol {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0 0 0.75rem;
    gap: 0.25rem;
}

nav[aria-label="Breadcrumb"] li + li::before {
    content: "/ ";
    color: var(--neutral-foreground-hint);
    margin-right: 0.25rem;
}

nav[aria-label="Breadcrumb"] a {
    color: var(--accent-fill-rest);
    text-decoration: none;
}

nav[aria-label="Breadcrumb"] a:hover {
    text-decoration: underline;
}

nav[aria-label="Breadcrumb"] [aria-current="page"] {
    color: var(--neutral-foreground-rest);
}

blockquote {
    border-left: 3px solid var(--accent-fill-rest);
    margin: 0.5rem 0;
    padding: 0.5rem 1rem;
    color: var(--neutral-foreground-rest);
    background: var(--neutral-layer-1);
    border-radius: 0 4px 4px 0;
}

details {
    margin-bottom: 0.25rem;
}

summary {
    cursor: pointer;
    padding: 0.3rem 0;
    color: var(--neutral-foreground-rest);
}

summary:hover {
    color: var(--neutral-foreground-rest);
}

hgroup {
    margin-bottom: 0.25rem;
}

hgroup small {
    color: var(--neutral-foreground-hint);
    font-weight: normal;
}

fieldset {
    border: 1px solid var(--neutral-stroke-rest);
    border-radius: 4px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

legend {
    color: var(--neutral-foreground-hint);
    font-weight: 600;
    padding: 0 0.25rem;
}

[role="alert"] {
    border: 1px solid var(--status-danger);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 24, 24, 0.1);
}

li[aria-selected="true"],
li[aria-selected="True"] {
    background: var(--accent-fill-rest);
    border-radius: 3px;
}


/* ══════════════════════════════════════════════════════════════
   NAV HEADERS / RADIO GROUPS
   ══════════════════════════════════════════════════════════════ */

nav > header {
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--neutral-stroke-rest);
}

[role="radiogroup"] {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

[role="radiogroup"] label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    color: var(--neutral-foreground-rest);
    font-size: 0.9em;
}


/* ══════════════════════════════════════════════════════════════
   TREE SCROLL HIGHLIGHT (location-tree-scroll.js)
   ══════════════════════════════════════════════════════════════ */

@keyframes tree-scroll-flash {
    0%   { background-color: rgba(91, 155, 213, 0.35); }
    100% { background-color: transparent; }
}

.tree-scroll-highlight {
    animation: tree-scroll-flash 1.2s ease-out;
    border-radius: 4px;
}


/* ══════════════════════════════════════════════════════════════
   WORK ORDER STATUS BADGES
   ══════════════════════════════════════════════════════════════ */

.wo-status {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    text-transform: capitalize;
}

.wo-status-pending   { background: rgba(250, 225, 2, 0.2);  color: var(--status-warning); }
.wo-status-approved  { background: rgba(41, 150, 2, 0.2);   color: var(--status-success); }
.wo-status-executing { background: rgba(59, 130, 246, 0.2);  color: var(--status-info); }
.wo-status-complete  { background: rgba(41, 150, 2, 0.3);   color: var(--status-success); }
.wo-status-closed    { background: rgba(136, 136, 136, 0.2); color: var(--status-neutral); }
.wo-status-rejected  { background: rgba(255, 24, 24, 0.2);  color: var(--status-danger); }
.wo-status-unknown   { background: var(--neutral-layer-3);   color: var(--neutral-foreground-hint); }


/* ══════════════════════════════════════════════════════════════
   WORK ORDER CARDS
   ══════════════════════════════════════════════════════════════ */

.wo-card {
    border: 1px solid var(--neutral-stroke-divider-rest);
    border-radius: 6px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.wo-card-header {
    padding: 0.5rem 0.75rem;
    background: var(--neutral-layer-2);
    border-bottom: 1px solid var(--neutral-stroke-divider-rest);
}

.wo-card-details {
    padding: 0.75rem;
}

.wo-card-details > section {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--neutral-stroke-divider-rest);
}

.wo-panel {
    margin-top: 0.5rem;
}

/* ── Vibration Data Panel ── */

.vib-trend-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0.5rem 0;
}

.vib-alert-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.vib-device-strip {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.vib-component-section {
    border: 1px solid var(--neutral-stroke-divider-rest);
    border-radius: 6px;
    overflow: hidden;
}

.vib-component-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.4rem 0.75rem;
    background: var(--neutral-fill-secondary-rest);
    border-bottom: 1px solid var(--neutral-stroke-divider-rest);
}

.vib-component-name {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--neutral-foreground-rest);
}

.vib-component-meta {
    font-size: 0.72rem;
    color: var(--neutral-foreground-hint);
}

.vib-charts-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem;
}

.vib-chart-wrapper {
    flex: 1 1 300px;
    min-width: 240px;
    border: 1px solid var(--neutral-stroke-divider-rest);
    border-radius: 4px;
    padding: 0.75rem;
}


/* ══════════════════════════════════════════════════════════════
   REPORT ASSIGNMENT EDITOR
   ══════════════════════════════════════════════════════════════ */

.report-assignment {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.report-assignment label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.8rem;
}

.report-assignment select {
    width: auto;
    min-width: 160px;
}

.report-assignment input[type="text"] {
    flex: 1;
    min-width: 200px;
}


/* ══════════════════════════════════════════════════════════════
   WORK ORDER FORM GRID
   ══════════════════════════════════════════════════════════════ */

/* Prevent FluentSelect listbox from being clipped by overflow:auto splitter panes */
fieldset fluent-select::part(listbox) {
    position: fixed;
    max-height: 220px;
}

.wo-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.wo-filter-bar {
    margin: 0.5rem 0;
}

.wo-filter-bar label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.8rem;
}

.wo-filter-bar select {
    width: auto;
    min-width: 120px;
}


/* ══════════════════════════════════════════════════════════════
   BULK WORK ORDER REVIEW GRID
   ══════════════════════════════════════════════════════════════ */

.bulk-wo-grid {
    max-height: 60vh;
    overflow-y: auto;
}

.bulk-wo-grid header {
    position: sticky;
    top: 0;
    background: var(--neutral-layer-1);
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--neutral-stroke-rest);
    z-index: 1;
}

.bulk-wo-row input[type="text"],
.bulk-wo-row input[type="number"],
.bulk-wo-row input[type="date"] {
    width: auto;
    min-width: 80px;
    padding: 0.2rem 0.4rem;
    font-size: 0.85rem;
}

.bulk-wo-row--warning {
    background: rgba(255, 193, 7, 0.08);
}

.bulk-wo-row--error {
    background: rgba(244, 67, 54, 0.08);
    opacity: 0.7;
}


/* ══════════════════════════════════════════════════════════════
   CHART PANELS
   ══════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════
   HIERARCHY SELECTOR
   ══════════════════════════════════════════════════════════════ */

.hierarchy-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hs-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hs-toolbar input[type="search"] {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid var(--neutral-stroke-rest);
    border-radius: 4px;
    background: var(--neutral-layer-1);
    color: var(--neutral-foreground-rest);
    font-size: 0.8125rem;
}

.hs-count {
    font-size: 0.75rem;
    color: var(--neutral-foreground-hint);
    white-space: nowrap;
}

/* Tree checkbox — CSS-only checked / indeterminate / unchecked */
.nav-tree .tree-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--neutral-stroke-rest);
    border-radius: 3px;
    flex-shrink: 0;
    cursor: pointer;
    background: transparent;
    font-size: 0;
    line-height: 1;
    transition: background 0.1s ease, border-color 0.1s ease;
}

.nav-tree .tree-check[data-state="checked"] {
    background: var(--accent-fill-rest);
    border-color: var(--accent-fill-rest);
}

.nav-tree .tree-check[data-state="checked"]::after {
    content: "✓";
    font-size: 11px;
    color: #fff;
}

.nav-tree .tree-check[data-state="indeterminate"] {
    background: var(--accent-fill-rest);
    border-color: var(--accent-fill-rest);
}

.nav-tree .tree-check[data-state="indeterminate"]::after {
    content: "–";
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.nav-tree .tree-check[data-disabled="true"] {
    opacity: 0.4;
    cursor: not-allowed;
}

.nav-tree .tree-check:hover:not([data-disabled="true"]) {
    border-color: var(--accent-fill-hover);
}

.hs-annotation {
    color: var(--neutral-foreground-hint);
    font-size: 0.75rem;
    font-style: italic;
}

/* Side-by-side columns for ProjectItemsDialog */
.project-items-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

.project-items-columns > section {
    min-width: 0;
    max-height: 60vh;
    overflow-y: auto;
}


.chart-panel {
    background: var(--neutral-layer-card-container, var(--neutral-layer-2));
    border: 1px solid var(--neutral-stroke-layer-rest, var(--neutral-stroke-divider-rest));
    border-radius: calc(var(--layer-corner-radius, 4) * 1px);
    padding: 0.75rem;
    min-width: 0;
}

.chart-panel h4 {
    margin: 0 0 0.5rem;
    font-size: 0.875rem;
    color: var(--neutral-foreground-hint);
    font-weight: 600;
}


/* ══════════════════════════════════════════════════════════════
   TREE LEAF ACTION BUTTONS (document quick-access)
   ══════════════════════════════════════════════════════════════ */

.tree-leaf-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    flex-shrink: 0;
}

.tree-leaf-action {
    all: unset;
    cursor: pointer;
    opacity: 0.4;
    padding: 0 2px;
    transition: opacity 0.15s;
}

.tree-leaf:hover .tree-leaf-action {
    opacity: 0.8;
}

.tree-leaf-action:hover {
    opacity: 1;
}


/* ══════════════════════════════════════════════════════════════
   MOBILE: LocationTreeNav sidebar + touch targets
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    /* Sidebar pane takes ~80% width on mobile */
    .splitter-page fluent-multi-splitter > div:first-child {
        flex-basis: 80% !important;
        max-width: none !important;
    }

    /* Enlarge the splitter bar for touch */
    .splitter-page fluent-multi-splitter .fluent-multi-splitter-bar,
    .splitter-page fluent-multi-splitter [role="separator"] {
        width: 24px !important;
        min-width: 24px !important;
    }

    /* Bigger touch target on collapse button (44px min per WCAG) */
    .splitter-page fluent-multi-splitter .fluent-multi-splitter-bar button,
    .splitter-page fluent-multi-splitter [role="separator"] button {
        min-width: 32px;
        min-height: 44px;
        font-size: 1.25rem;
    }

    /* Make tree leaf action buttons always visible on touch (no hover) */
    .tree-leaf .tree-leaf-action {
        opacity: 0.7;
    }
}
