/* FiberVu: THE top bar (same in every module). Loaded after fibervu-ui.css.
   48 px, one line, 16 px side padding, thin #0047BB line at the bottom, controls 32 px / radius 8, chips 28 px.
   Nothing may sit on top of a button: the page keeps the space of the bell / user menu free (--fv-reserve, measured by fibervu-topbar.js),
   the Province switch is part of the bar (not floating over it), and Filament's corner only catches clicks on its own buttons. Colours are not touched. */
:root { --fv-bar: 48px; --fv-corner: 160px; --fv-reserve: 190px; }

@media (min-width: 1024px) {
    /* Filament's corner (do-not-disturb, bells, user menu): only its own buttons take clicks, its empty box never covers the page */
    body:has(:is(.fv-page, .fv-settings)) .fi-topbar-ctn { height: var(--fv-bar); pointer-events: none; }
    body:has(:is(.fv-page, .fv-settings)) .fi-topbar { height: var(--fv-bar); gap: 8px; padding: 0 16px 0 0; pointer-events: none; align-items: center; }
    body:has(:is(.fv-page, .fv-settings)) .fi-topbar :is(button, a, input, select, [role=button], .fi-dropdown-trigger, .fi-dropdown-panel) { pointer-events: auto; }
    body:has(:is(.fv-page, .fv-settings)) .fi-topbar::before { content: ""; width: 1px; height: 22px; background: var(--dk-bg-e4e8ef, #E4E8EF); margin-right: 6px; flex: none; }
    body:has(:is(.fv-page, .fv-settings)) .fi-topbar :is(.fv-bell, .nb-dnd, .fi-dropdown-trigger .fi-icon-btn) { width: 32px; height: 32px; border-radius: 8px; }

    /* the bar */
    .fv-top { height: var(--fv-bar); flex: 0 0 var(--fv-bar); padding: 0 var(--fv-reserve) 0 16px; gap: 8px; border-bottom: 2px solid var(--dk-bd-0047bb, #0047BB); box-sizing: border-box; }
    .fv-detail { top: var(--fv-bar); }
}
@media (max-width: 1023px) { .fv-top { padding-right: 16px; height: var(--fv-bar); flex-basis: var(--fv-bar); } }

.fv-top .fv-title { flex: none; font-size: 16px; gap: 6px; }
.fv-top .fv-i { width: 16px; height: 16px; font-size: 10px; line-height: 14px; flex: none; }

/* the green "live" indicator: seconds since the numbers were last updated */
.fv-live { display: none; align-items: center; gap: 5px; margin-left: 6px; font: 500 11.5px/1 system-ui, sans-serif; color: var(--fv-faint, var(--dk-fg-98a2b3, #98A2B3)); font-variant-numeric: tabular-nums; cursor: help; white-space: nowrap; }
.fv-live.is-live { display: inline-flex; }
.fv-live i { width: 7px; height: 7px; border-radius: 50%; background: #22A06B; flex: none; }
.fv-live b { font-weight: 500; min-width: 1ch; text-align: right; }
.fv-live.is-stale i { background: #E8A317; }

/* counter chips: 28 px, dot + label + number (same-width digits). Buttons = filters, the lit one is light blue */
.fv-top .fv-chips { align-self: stretch; align-items: center; gap: 6px; padding: 0 2px; margin-left: 4px; }
.fv-top .fv-chips.fade-r { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.fv-top .fv-chips.fade-l { -webkit-mask-image: linear-gradient(270deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(270deg, #000 calc(100% - 28px), transparent); }
.fv-top .fv-chips.fade-l.fade-r { -webkit-mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent); }
.fv-top .fv-chip { display: inline-flex; align-items: center; gap: 5px; height: 28px; min-height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; line-height: 1; color: var(--dk-fg-475467, #475467); white-space: nowrap; box-sizing: border-box; flex: none; transition: background .15s, border-color .15s; }
.fv-top .fv-chip b { order: 2; font-weight: 700; font-variant-numeric: tabular-nums; }
.fv-top .fv-chip > i { order: -1; flex: none; }
.fv-top button.fv-chip { cursor: pointer; }
.fv-top button.fv-chip:hover { background: var(--dk-bg-f7f9fc, #F7F9FC); border-color: var(--dk-bd-d0d5dd, #D0D5DD); }
.fv-top .fv-chip.is-on, .fv-top button.fv-chip.is-on:hover { background: var(--dk-bg-e6eef9, #E6EEF9); border-color: var(--dk-bd-bfd3f2, #BFD3F2); color: var(--dk-fg-0047bb, #0047BB); }
.fv-top .fv-chip.is-on b { color: var(--dk-fg-0047bb, #0047BB); }

/* the right side: never shrinks, never cut */
.fv-top .fv-actions { display: flex; align-items: center; gap: 8px; flex: none; margin-left: 8px; position: relative; }
.fv-more-wrap { display: inline-flex; align-items: center; position: relative; }
.fv-more-box { display: inline-flex; align-items: center; gap: 8px; }
.fv-more-btn { display: none; width: 32px; padding: 0; justify-content: center; font-weight: 700; letter-spacing: 1px; }
.fv-top.is-tight .fv-more-btn { display: inline-flex; }
.fv-top.is-tight .fv-more-box { display: none; }
.fv-top.is-tight .fv-actions.is-more .fv-more-box { display: flex; flex-direction: column; align-items: stretch; gap: 8px; position: absolute; top: calc(100% + 6px); right: 0; z-index: 80; background: var(--dk-bg-ffffff, #fff); border: 1px solid var(--fv-line, var(--dk-bd-e4e8ef, #E4E8EF)); border-radius: 12px; box-shadow: 0 10px 28px rgba(16, 24, 40, .16); padding: 8px; white-space: nowrap; }
.fv-top.is-tight .fv-actions.is-more .fv-more-box .fv-dens { align-self: flex-start; }

/* view (row spacing) switch: two equal 32 px icon buttons */
.fv-dens { display: inline-flex; height: 32px; margin: 0; border: 1px solid var(--dk-bd-d0d5dd, #D0D5DD); border-radius: 8px; overflow: hidden; background: var(--dk-bg-ffffff, #fff); box-sizing: border-box; flex: none; }
.fv-dens button { width: 32px; height: 100%; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; background: var(--dk-bg-ffffff, #fff); color: var(--dk-fg-475467, #475467); cursor: pointer; }
.fv-dens button + button { border-left: 1px solid var(--dk-bd-d0d5dd, #D0D5DD); }
.fv-dens button:hover { background: var(--dk-bg-f2f4f7, #F2F4F7); }
.fv-dens button.is-on { background: var(--dk-bg-e6eef9, #E6EEF9); color: var(--dk-fg-0047bb, #0047BB); }

/* Province switch: part of the bar */
.fv-prov-slot { display: inline-flex; align-items: center; flex: none; }
.fv-prov-slot .prov-bar { position: static !important; margin: 0 !important; display: flex; align-items: center; }
body:has(:is(.fv-page, .fv-settings)) .fv-prov-slot .prov-seg a, .prov-seg a { display: inline-flex; align-items: center; height: 100%; padding: 0 12px; font-size: 13px; white-space: nowrap; box-sizing: border-box; }
.prov-seg { height: 32px; border-radius: 8px; box-sizing: border-box; flex: none; }
/* City dropdown (admins): right of the province switch, the same 32 px; blue while one city is picked */
.city-pick { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 0 8px; flex: none; }
.city-pick select { height: 32px; max-width: 180px; padding: 0 28px 0 10px; font-size: 13px; color: var(--dk-fg-344054, #344054); border: 1px solid var(--dk-bd-d0d5dd, #D0D5DD); border-radius: 8px; background-color: var(--dk-bg-ffffff, #fff); box-sizing: border-box; cursor: pointer; }
.city-pick select.is-on { color: var(--blue, var(--dk-fg-0047bb, #0047BB)); background-color: var(--blue-tint, var(--dk-bg-e6eef9, #E6EEF9)); border-color: var(--blue, var(--dk-bd-0047bb, #0047BB)); font-weight: 700; }
.city-pick select:focus-visible { outline: 2px solid var(--blue, var(--dk-bd-0047bb, #0047BB)); outline-offset: 1px; }
/* where the Province switch is not inside a bar (Settings, Map): it floats left of the corner, 32 px, same line */
@media (min-width: 1024px) {
    body:has(:is(.fv-page, .fv-settings)) .prov-bar:not(.fv-prov-slot *) { top: calc((var(--fv-bar) - 32px) / 2) !important; right: var(--fv-corner) !important; }
}

/* bells: small badges that do not cover the next button */
.fi-topbar .fv-bell .nb-badge { transform: translate(2px, -2px); }
.fv-top .fv-chip .dot { margin-right: 0; }
/* the Map's chips are check boxes with their own order (dot, name, range, count): keep the markup order there */
.fv-map .fv-top .fv-chip b, .fv-map .fv-top .fv-chip > * { order: 0; }
.fv-top .fv-actions .map-search { position: relative; margin: 0; }
/* every button answers at once: pressed look the moment it is clicked, before the server has replied */
.fv-top button.fv-chip:active, .fv-top .fv-chip.fv-pending { background: var(--dk-bg-e6eef9, #E6EEF9); border-color: var(--dk-bd-bfd3f2, #BFD3F2); color: var(--dk-fg-0047bb, #0047BB); }
.fv-top .fv-chip.fv-pending { cursor: progress; }
.fv-top .fv-btn:active, .fv-dens button:active, .prov-seg a:active { transform: translateY(1px); }
/* the original Province switch (part of the redrawn page) stays hidden while its copy sits in the bar */
body:has(.fv-top .fv-prov-slot .prov-bar) .prov-bar:not(.fv-prov-slot *) { display: none !important; }

/* Offline monitoring: ONE row. Status chips are a dot + the count (name, share and hint in the tooltip), one "Province · City" menu,
   Export as an icon, the less-used items (row spacing, offline totals) in the ⋯ menu. Only this page has .om-top. */
.fv-top.om-top .fv-chips { gap: 4px; }
.fv-top.om-top .om-chip { gap: 6px; padding: 0 9px; border: 1px solid var(--dk-bd-e4e7ec, #E4E7EC); background: var(--dk-bg-ffffff, #fff); color: var(--dk-fg-101828, #101828); }
.fv-top.om-top .om-chip:hover, .fv-top.om-top .om-chip:focus-visible { border-color: var(--dk-bd-98a2b3, #98A2B3); background: var(--dk-bg-f9fafb, #F9FAFB); outline: none; }
.fv-top.om-top .om-chip.is-on { border-color: var(--blue, var(--dk-bd-0047bb, #0047BB)); background: var(--blue-tint, var(--dk-bg-e6eef9, #E6EEF9)); color: var(--blue, var(--dk-fg-0047bb, #0047BB)); box-shadow: inset 0 0 0 1px var(--blue, var(--dk-bd-0047bb, #0047BB)); }
.om-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; order: -1; }
.fv-top.om-top .fv-prov-slot { display: none !important; }
.fv-top.om-top .fv-more-btn { display: inline-flex; }
.fv-top.om-top .fv-more-box { display: none; }
.fv-top.om-top .fv-actions.is-more .fv-more-box { display: flex; flex-direction: column; align-items: stretch; gap: 10px; position: absolute; top: calc(100% + 6px); right: 0; z-index: 80; min-width: 230px; background: var(--dk-bg-ffffff, #fff); border: 1px solid var(--dk-bd-e4e7ec, #E4E7EC); border-radius: 12px; box-shadow: 0 10px 28px rgba(16, 24, 40, .16); padding: 10px; }
.fv-top.om-top .fv-actions.is-more .fv-more-box .fv-dens { align-self: flex-start; }
.om-facts { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--dk-fg-475467, #475467); white-space: nowrap; }
.om-facts b { color: var(--dk-fg-101828, #101828); font-variant-numeric: tabular-nums; margin-right: 2px; } .om-facts b.r { color: var(--dk-fg-b42318, #B42318); }
.om-loc { position: relative; flex: none; }
.om-loc-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; max-width: 240px; padding: 0 10px; border: 1px solid var(--dk-bd-d0d5dd, #D0D5DD); border-radius: 8px; background: var(--dk-bg-ffffff, #fff); color: var(--dk-fg-344054, #344054); font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.om-loc-btn span { overflow: hidden; text-overflow: ellipsis; }
.om-loc-btn:hover { background: var(--dk-bg-f9fafb, #F9FAFB); } .om-loc-btn:focus-visible { outline: 2px solid var(--blue, var(--dk-bd-0047bb, #0047BB)); outline-offset: 1px; }
.om-loc-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 80; min-width: 220px; max-height: 70vh; overflow-y: auto; background: var(--dk-bg-ffffff, #fff); border: 1px solid var(--dk-bd-e4e7ec, #E4E7EC); border-radius: 12px; box-shadow: 0 10px 28px rgba(16, 24, 40, .16); padding: 6px; }
.om-loc-h { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--dk-fg-98a2b3, #98A2B3); }
.om-loc-menu a { display: block; padding: 7px 10px; border-radius: 8px; font-size: 13px; color: var(--dk-fg-101828, #101828); text-decoration: none; white-space: nowrap; }
.om-loc-menu a:hover { background: var(--dk-bg-f2f4f7, #F2F4F7); } .om-loc-menu a.is-on { background: var(--blue-tint, var(--dk-bg-e6eef9, #E6EEF9)); color: var(--blue, var(--dk-fg-0047bb, #0047BB)); font-weight: 700; }
.fv-top.om-top .om-ex { width: 32px; height: 32px; padding: 0; justify-content: center; }
#fv-tip .fv-tip-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
@media (max-width: 1279px) { .om-loc-btn { max-width: 150px; } .fv-top.om-top .fv-live { margin-left: 2px; } }
@media (max-width: 1100px) { .om-loc-btn { max-width: 118px; } .fv-top.om-top .om-chip { padding: 0 7px; gap: 5px; } .fv-top.om-top .fv-title { font-size: 15px; } }
body:has(.om-top [aria-expanded="true"]) #fv-tip { opacity: 0 !important; }            /* a header menu is open: its tooltip would cover it */

/* Offline monitoring: the summary stats in the row (icon + count), after a thin divider; Export and row spacing in the ⋯ menu.
   Below 1240 px (the sidebar takes 250 px) the chips wrap to a second line instead of overflowing. */
.fv-top.om-wide .fv-chips { overflow: visible; -webkit-mask-image: none !important; mask-image: none !important; }
.om-div { width: 1px; height: 20px; background: var(--dk-bg-d0d5dd, #D0D5DD); flex: none; margin: 0 4px; }
.om-stats { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.fv-top.om-top .om-stat svg { flex: none; color: var(--dk-fg-667085, #667085); }
.fv-top.om-top .om-stat b.r { color: var(--dk-fg-b42318, #B42318); }
.fv-top.om-top .om-stat.is-on svg { color: currentColor; }
.om-more-ex { display: flex; flex-direction: column; gap: 2px; min-width: 260px; }
.om-more-ex .om-loc-h { padding: 2px 4px 4px; display: flex; align-items: center; gap: 6px; }
.om-ex-items button, .om-ex-items .ex-item { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: .45rem .55rem; cursor: pointer; font: inherit; color: var(--dk-fg-101828, #101828); }
.om-ex-items button:hover, .om-ex-items .ex-item:hover { background: var(--dk-bg-f2f4f7, #F2F4F7); }
.om-ex-items b { display: block; font-size: 13px; } .om-ex-items small { display: block; font-size: 11.5px; color: var(--dk-fg-667085, #667085); }
.om-ex-items select { margin-top: 4px; width: 100%; }
@media (max-width: 1240px) {
    .fv-top.om-wide { height: auto !important; min-height: var(--fv-bar); flex-basis: auto !important; flex-wrap: wrap; row-gap: 6px; padding-top: 8px; padding-bottom: 8px; }
    .fv-top.om-wide .fv-chips { flex-wrap: wrap; row-gap: 6px; }
    .fv-top.om-wide .om-div { display: none; }
}
@media (max-width: 1365px) and (min-width: 1241px) {
    .fv-top.om-wide .om-chip { padding: 0 6px; gap: 4px; }
    .fv-top.om-wide .fv-chips, .fv-top.om-wide .om-stats { gap: 3px; }
    .fv-top.om-wide .om-div { margin: 0 2px; }
    .fv-top.om-wide .fv-title { font-size: 15px; }
    .fv-top.om-wide .fv-live { margin-left: 2px; }
}
