/* Portal pages outside HBEDS (Components/PortalPage.razor). They sit on the HBEDS design system (css/hbeds.css) and use its tokens, so
   this file only adds what HBEDS has no need for: navigation tiles, the account area and a few page-specific pieces. */

/* ---------- Account (Shared/LoginDisplay.razor) ---------- */

.admin-account {
    display: flex;
    align-items: center;
    gap: .6rem;
    min-width: 0;
    padding-left: .75rem;
    border-left: 1px solid var(--mud-palette-lines-default);
}

.admin-avatar {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fdeeed;
    color: #a51d16;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .02em;
}

.admin-account-name {
    overflow: hidden;
    font-size: 13.5px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--mud-palette-text-primary);
}

.admin-account .admin-signout,
.admin-signin {
    border-radius: 6px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
}

.admin-account .admin-signout {
    color: var(--mud-palette-text-secondary);
}

.admin-account .admin-signout:hover {
    color: var(--mud-palette-text-primary);
}

:root[data-theme="dark"] .admin-avatar {
    background: rgba(224, 71, 58, .2);
    color: #ff9b95;
}

/* The phone menu's account block sits on the red sidebar. */
.nav-account-mobile .admin-account {
    padding-left: 0;
    border-left: none;
}

.nav-account-mobile .admin-account-name,
.nav-account-mobile .admin-account .admin-signout {
    color: #ffffff;
}

.nav-account-mobile .admin-account .admin-signout {
    margin-left: auto;
}

/* ---------- Navigation tiles (Components/PortalTile.razor) ---------- */

.portal-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr));
    gap: .875rem;
    max-width: 76rem;
}

.portal-group + .portal-group {
    margin-top: 1.75rem;
}

.portal-group-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0 0 .65rem;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--hb-text-3);
}

.hb a.portal-tile {
    display: flex;
    align-items: flex-start;
    gap: .9rem;
    padding: 1rem 1rem 1rem 1.1rem;
    border: 1px solid var(--hb-border);
    border-radius: var(--hb-radius);
    background: var(--hb-surface);
    box-shadow: var(--hb-shadow);
    text-decoration: none;
    color: var(--hb-text);
    transition: border-color .12s ease, box-shadow .12s ease;
}

.hb a.portal-tile:hover {
    border-color: var(--hb-border-strong);
    box-shadow: 0 2px 4px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .06);
}

.portal-tile-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--hb-accent-soft);
    color: var(--hb-accent);
}

.portal-tile-icon .mud-icon-root {
    font-size: 22px;
}

.portal-tile-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: .2rem;
    min-width: 0;
}

.portal-tile-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.hb a.portal-tile:hover .portal-tile-title {
    color: var(--hb-accent);
}

.portal-tile-text {
    font-size: 13px;
    color: var(--hb-text-2);
}

.portal-tile-tags {
    margin-top: .4rem;
}

.portal-tile-go {
    flex: none;
    align-self: center;
    color: var(--hb-text-3);
    transition: transform .12s ease;
}

.hb a.portal-tile:hover .portal-tile-go {
    color: var(--hb-accent);
    transform: translateX(2px);
}

/* ---------- Home ---------- */

.portal-signin {
    max-width: 34rem;
    margin: 3rem auto 0;
}

/* ---------- Lists and reports ---------- */

.portal-county {
    flex: 0 1 17rem;
    min-width: 13rem;
}

.portal-facility {
    min-width: 12rem;
    max-width: 20rem;
}

/* Role over its status badge, so the account's access reads as one thing. */
.portal-access {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .3rem;
}

.portal-name {
    display: block;
    min-width: 8rem;
}

/* Two sort controls in one header, for a column that shows both first and last name. */
.portal-sorts {
    display: inline-flex;
    align-items: center;
    gap: .15rem;
}

.portal-sorts .mud-table-sort-label + .mud-table-sort-label::before {
    content: "·";
    margin-right: .3rem;
    color: var(--hb-text-3);
}

.portal-title {
    display: block;
    min-width: 8rem;
    max-width: 14rem;
}

.portal-contact {
    display: block;
    white-space: nowrap;
}

.portal-roles {
    display: block;
    max-width: 14rem;
    font-size: 12.5px;
    color: var(--hb-text-2);
}

/* Business continuity modules: every module in a fixed order, enabled ones filled, so rows compare at a glance. */
.portal-modules {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    min-width: 22rem;
}

.portal-module {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 .45rem;
    border: 1px dashed var(--hb-border-strong);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    color: var(--hb-text-3);
}

.portal-module.on {
    border: 1px solid transparent;
    background: var(--hb-info-bg);
    color: var(--hb-info);
}

.portal-module.on::before {
    content: "";
    width: 5px;
    height: 5px;
    margin-right: .3rem;
    border-radius: 50%;
    background: var(--hb-info-dot);
}

/* ---------- Health checks (Pages/Health.razor) ---------- */

.portal-frame {
    display: block;
    width: 100%;
    height: calc(100vh - 13.5rem);
    min-height: 30rem;
    border: none;
    border-radius: 0 0 var(--hb-radius) var(--hb-radius);
    background: #ffffff;
}

/* ---------- Search dialogs (Pages/Search) ---------- */

.portal-dialog-heading {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: .25rem 0 .6rem;
    font-size: 14px;
    font-weight: 600;
    color: var(--hb-text);
}

.portal-module-list {
    margin-bottom: 1.25rem;
}

.portal-module-tag {
    height: 24px;
    gap: .4rem;
    color: var(--hb-text-2);
}

.portal-module-tag .hb-num {
    font-weight: 500;
    color: var(--hb-text-3);
}

.hb-dialog .portal-dialog-panel {
    margin-bottom: 0;
    overflow: hidden;
    box-shadow: none;
}

.hb-dialog .portal-dialog-table {
    border: 1px solid var(--hb-border);
    border-radius: var(--hb-radius);
    overflow: hidden;
}

.hb-dialog .portal-dialog-panel .hb-table,
.hb-dialog .portal-dialog-table.hb-table {
    border-radius: var(--hb-radius);
}

/* ---------- ReddiNet Monitoring (Pages/Monitoring/ReddiNetMonitoring.razor) ---------- */

.portal-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.portal-metrics.stacked {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
}

.portal-metrics.stacked .portal-metric + .portal-metric {
    margin-top: .9rem;
    padding-top: .9rem;
    border-top: 1px solid var(--hb-border);
}

.portal-metric {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    min-width: 0;
}

.portal-metric-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--hb-neutral-bg);
    color: var(--hb-text-2);
}

.portal-metric-icon .mud-icon-root {
    font-size: 21px;
}

.portal-metric.tone-warning .portal-metric-icon {
    background: var(--hb-warning-bg);
    color: var(--hb-warning);
}

.portal-metric.tone-danger .portal-metric-icon {
    background: var(--hb-danger-bg);
    color: var(--hb-danger);
}

.portal-metric-body {
    min-width: 0;
}

.portal-metric-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--hb-text-2);
}

.portal-metric-value {
    font-size: 30px;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -.01em;
}

.portal-metric-text {
    margin-top: .15rem;
    font-size: 12.5px;
    color: var(--hb-text-2);
}

.portal-metric-detail {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    margin-top: .55rem;
    font-size: 12.5px;
}

.portal-change {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-weight: 500;
    color: var(--hb-text);
}

.portal-change .mud-icon-root {
    font-size: 15px;
    color: var(--hb-text-2);
}

.portal-change-base {
    color: var(--hb-text-3);
}

.portal-change-base b {
    font-weight: 600;
    color: var(--hb-text-2);
}

/* The explanation sits at the foot of the panel when Account status beside it is taller. */
.hb-panel.portal-growth,
.hb-panel.portal-fill {
    display: flex;
    flex-direction: column;
}

.portal-growth .hb-panel-body,
.portal-fill .hb-panel-body {
    flex: 1 1 auto;
    padding-top: .25rem;
}

/* Password expiration: one bar for the next 14 days, then the three groups that make it up. */
.portal-expiry-bar {
    display: flex;
    height: 10px;
    margin: .25rem 0 1rem;
    overflow: hidden;
    border-radius: 999px;
    background: var(--hb-neutral-bg);
}

.portal-expiry-bar span + span {
    border-left: 2px solid var(--hb-surface);
}

.portal-expiry-bar span[style="width: 0%"] {
    display: none;
}

.portal-expiry-bar .expired,
.portal-expiry-group.expired i {
    background: var(--hb-danger-dot);
}

.portal-expiry-bar .week,
.portal-expiry-group.week i {
    background: var(--hb-warning-dot);
}

.portal-expiry-bar .later,
.portal-expiry-group.later i {
    background: var(--hb-info-dot);
}

.portal-expiry-groups {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
}

.portal-expiry-group {
    padding: .8rem 1rem;
    border: 1px solid var(--hb-border);
    border-radius: var(--hb-radius-sm);
    background: var(--hb-surface-muted);
}

.portal-expiry-group .label {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: 13px;
    font-weight: 500;
    color: var(--hb-text-2);
}

.portal-expiry-group i {
    flex: none;
    width: 9px;
    height: 9px;
    border-radius: 3px;
}

.portal-expiry-group .value {
    margin-top: .2rem;
    font-size: 26px;
    font-weight: 600;
    line-height: 1.2;
}

.portal-expiry-group .when {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--hb-text);
}

.portal-expiry-group p {
    margin: .15rem 0 0;
    font-size: 12px;
    color: var(--hb-text-3);
}

.portal-skeleton-panel {
    padding: 1.25rem;
}

.portal-metric-value.text {
    font-size: 22px;
    line-height: 1.35;
}

/* Platform activity: counts beside the concurrency chart, then recent sessions. */
.portal-activity {
    display: grid;
    grid-template-columns: minmax(15rem, 20rem) minmax(0, 1fr);
}

.portal-activity-kpis {
    padding: 1.1rem 1.25rem 1.25rem;
    border-right: 1px solid var(--hb-border);
}

/* Users online: the one figure about right now, so it leads the activity column with its own card. */
.portal-online {
    margin-bottom: 1.1rem;
    padding: .85rem 1rem .9rem;
    border: 1px solid var(--hb-border);
    border-left: 3px solid var(--hb-success-dot);
    border-radius: var(--hb-radius-sm);
    background: var(--hb-surface-muted);
}

.portal-online.is-stale {
    border-left-color: var(--hb-warning-dot);
}

.portal-online.is-unavailable {
    border-left-color: var(--hb-neutral-dot);
}

.portal-online-head {
    display: flex;
    align-items: center;
    gap: .45rem;
}

.portal-online-head .hb-status {
    margin-left: auto;
}

.portal-online-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--hb-text);
}

.portal-online-pulse {
    position: relative;
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--hb-success-dot);
}

.portal-online.is-fresh .portal-online-pulse::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--hb-success-dot);
    opacity: 0;
    animation: portal-pulse 2.4s ease-out infinite;
}

.portal-online.is-stale .portal-online-pulse {
    background: var(--hb-warning-dot);
}

.portal-online.is-unavailable .portal-online-pulse,
.portal-online:not(.is-fresh, .is-stale, .is-unavailable) .portal-online-pulse {
    background: var(--hb-neutral-dot);
}

@keyframes portal-pulse {
    0% { opacity: .7; transform: scale(.6); }
    100% { opacity: 0; transform: scale(1.6); }
}

@media (prefers-reduced-motion: reduce) {
    .portal-online.is-fresh .portal-online-pulse::after {
        animation: none;
    }
}

.portal-online-value {
    margin-top: .25rem;
    font-size: 40px;
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -.02em;
    color: var(--hb-text);
}

.portal-online.is-stale .portal-online-value {
    color: var(--hb-text-2);
}

.portal-online-value.unavailable {
    font-size: 20px;
    line-height: 1.4;
    color: var(--hb-text-2);
}

.portal-online-skeleton {
    width: 30%;
    height: 38px;
    margin: .35rem 0 .3rem;
}

.portal-online-scope {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--hb-text-2);
}

.portal-online-meta {
    margin-top: .3rem;
    font-size: 12px;
    color: var(--hb-text-3);
}

.portal-online-meta b {
    font-weight: 600;
    color: var(--hb-text-2);
}

.portal-online-warning {
    margin: .4rem 0 0;
    font-size: 12px;
    color: var(--hb-warning);
}

.portal-online-explain {
    margin: .55rem 0 0;
    padding-top: .5rem;
    border-top: 1px solid var(--hb-border);
    font-size: 11.5px;
    color: var(--hb-text-3);
}

.portal-kpi-heading {
    margin: 0 0 .75rem;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--hb-text-3);
}

.portal-activity-note {
    margin: 1rem 0 0;
    font-size: 12px;
    color: var(--hb-text-3);
}

.portal-activity-chart {
    min-width: 0;
    padding-top: 1.1rem;
}

.portal-chart-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: .5rem 1rem;
    padding: 0 1.25rem;
}

.portal-chart-head h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.portal-chart-head p {
    margin: .15rem 0 0;
    font-size: 12.5px;
    color: var(--hb-text-2);
}

.portal-peak {
    display: flex;
    align-items: baseline;
    gap: .5rem;
}

.portal-peak .label {
    font-size: 12.5px;
    color: var(--hb-text-2);
}

.portal-peak .value {
    font-size: 26px;
    font-weight: 600;
    line-height: 1;
}

.portal-peak .hb-status {
    align-self: center;
}

.portal-concurrency {
    padding-bottom: .25rem;
}

.portal-concurrency .hb-chart-bar,
.portal-legend-closed {
    background: var(--hb-info-dot);
}

/* Buckets that unresolved open sessions overlap: hatched, with a marker under the bar so even an empty bucket shows it. */
.portal-concurrency .hb-chart-col.uncertain .hb-chart-bar,
.portal-legend-uncertain {
    background: repeating-linear-gradient(135deg, var(--hb-info-dot) 0 3px, var(--hb-warning-stripe) 3px 6px);
}

.portal-concurrency .hb-chart-col.uncertain::after {
    content: "";
    position: absolute;
    right: 1px;
    bottom: -5px;
    left: 1px;
    height: 3px;
    border-radius: 2px;
    background: var(--hb-warning-dot);
}

.portal-concurrency .hb-chart-col.selected {
    background: var(--hb-chart-hover);
    box-shadow: inset 0 0 0 1px var(--hb-border-strong);
}

.hb-legend i.portal-legend-uncertain {
    box-shadow: inset 0 -2px 0 var(--hb-warning-dot);
}

.portal-concurrency-detail {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 1rem;
    margin: .1rem 1.25rem 0;
    padding: .5rem .75rem;
    border-radius: var(--hb-radius-sm);
    background: var(--hb-surface-muted);
    font-size: 12.5px;
    color: var(--hb-text-2);
}

.portal-concurrency-detail .when {
    font-weight: 500;
    color: var(--hb-text);
}

.portal-concurrency-detail b {
    font-weight: 600;
    color: var(--hb-text);
}

.portal-uncertain-text {
    color: var(--hb-warning);
}

.portal-concurrency-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .5rem 1.25rem .25rem;
}

.portal-concurrency-table {
    max-height: 18rem;
    margin: 0 1.25rem 1rem;
    border: 1px solid var(--hb-border);
    border-radius: var(--hb-radius-sm);
}

.portal-uncertainty {
    margin: .5rem 1.25rem 1.25rem;
}

.portal-chart-skeleton {
    height: 200px;
    margin: 1rem 1.25rem 1.25rem;
}

.portal-window {
    margin-left: auto;
}

.portal-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.portal-pager > span {
    flex: 1 1 auto;
}

.portal-pager b {
    font-weight: 600;
    color: var(--hb-text);
}

.portal-pager .mud-button-root {
    border-radius: var(--hb-radius-sm);
    text-transform: none;
}

/* Metric content is spans, so it is valid inside a button; these keep the original block layout. */
.portal-metric-label,
.portal-metric-value,
.portal-metric-text {
    display: block;
}

.portal-expiry-group .label,
.portal-expiry-group .value,
.portal-expiry-group .when,
.portal-expiry-group .note {
    display: block;
}

.portal-expiry-group .label {
    display: flex;
}

.portal-expiry-group .note {
    margin: .15rem 0 0;
    font-size: 12px;
    color: var(--hb-text-3);
}

/* Figures that open their records: a card with a hover lift, a focus ring and a View cue, so they read differently from plain summaries. */
button.portal-metric,
button.portal-expiry-group {
    position: relative;
    width: 100%;
    margin: 0;
    font: inherit;
    text-align: left;
    color: inherit;
    cursor: pointer;
}

/* Buttons centre their content by default; these keep the card layouts. */
button.portal-metric {
    display: flex;
    justify-content: flex-start;
}

button.portal-metric .portal-metric-body {
    flex: 1 1 auto;
}

button.portal-expiry-group {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

button.portal-metric {
    padding: .65rem 4.25rem .7rem .7rem;
    border: 1px solid transparent;
    border-radius: var(--hb-radius-sm);
    background: transparent;
}

.portal-metrics.stacked button.portal-metric + .portal-metric,
.portal-metrics.stacked .portal-metric + button.portal-metric {
    margin-top: .5rem;
    padding-top: .65rem;
    border-top: 1px solid transparent;
}

.portal-metrics.stacked button.portal-metric {
    margin-left: -.7rem;
    width: calc(100% + 1.4rem);
}

button.portal-metric:hover,
button.portal-expiry-group:hover {
    border-color: var(--hb-border-strong);
    background: var(--hb-surface-muted);
}

button.portal-expiry-group:hover {
    background: var(--hb-surface);
}

button.portal-metric:focus-visible,
button.portal-expiry-group:focus-visible {
    outline: 2px solid var(--hb-focus);
    outline-offset: 2px;
}

.portal-metric-go {
    position: absolute;
    top: .7rem;
    right: .6rem;
    display: inline-flex;
    align-items: center;
    font-size: 12px;
    font-weight: 500;
    color: var(--hb-text-3);
}

.portal-metric-go .mud-icon-root {
    font-size: 17px;
}

button.portal-metric:hover .portal-metric-go,
button.portal-expiry-group:hover .portal-metric-go,
button.portal-metric:focus-visible .portal-metric-go,
button.portal-expiry-group:focus-visible .portal-metric-go {
    color: var(--hb-accent);
}

/* In the narrower password cards the cue sits at the foot, leaving the label the full width. */
button.portal-expiry-group {
    padding-bottom: 2rem;
}

button.portal-expiry-group .portal-metric-go {
    top: auto;
    bottom: .6rem;
}

.portal-online-view.mud-button-root {
    margin: .5rem 0 -.25rem -.5rem;
    border-radius: var(--hb-radius-sm);
    font-weight: 500;
    text-transform: none;
}

/* ---------- Drill-down dialogs (Pages/Monitoring/Drilldowns) ---------- */

.portal-drill-context {
    margin-bottom: .75rem;
}

.portal-drill-context .hb-muted {
    display: block;
    margin-top: .1rem;
    font-size: 12.5px;
}

.portal-drill-count {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 6rem;
}

.portal-drill-count .label {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--hb-text-3);
}

.portal-drill-count .value {
    font-size: 26px;
    font-weight: 600;
    line-height: 1.15;
}

.portal-drill-note {
    margin: 0 0 .75rem;
}

.portal-drill-toolbar {
    padding-top: 0;
    border: none;
    background: transparent;
}

.portal-drill-table .mud-table-body .mud-table-cell {
    vertical-align: top;
}

.portal-places {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    min-width: 12rem;
}

.portal-place .name {
    display: block;
    font-weight: 500;
}

/* Concurrent users: bars and table rows open the users at a peak; the table's headings reorder only the table. */
.portal-concurrency-hint {
    margin-left: auto;
    font-size: 12px;
    color: var(--hb-text-3);
}

.portal-th-sort,
.portal-link-button {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.portal-th-sort .mud-icon-root {
    font-size: 15px;
    color: var(--hb-text-3);
}

.portal-link-button {
    text-align: left;
    color: var(--hb-accent);
}

.portal-link-button:hover {
    text-decoration: underline;
}

.portal-th-sort:focus-visible,
.portal-link-button:focus-visible {
    outline: 2px solid var(--hb-focus);
    outline-offset: 2px;
    border-radius: 2px;
}

.portal-peak-summary {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 2rem;
    margin-bottom: .75rem;
}

.portal-peak-summary > div {
    display: flex;
    flex-direction: column;
    gap: .1rem;
}

.portal-peak-summary .label {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--hb-text-3);
}

.portal-peak-summary .value {
    font-size: 24px;
    font-weight: 600;
    line-height: 1.1;
}

.portal-peak-summary .when {
    font-size: 15px;
    font-weight: 600;
}

/* Drill-down sorting: two orders that share one column, and the current order beside the search. */
.portal-sort-sep {
    margin: 0 .3rem;
    color: var(--hb-text-3);
}

.portal-drill-sort:empty {
    display: none;
}

.portal-drill-mobile-sort {
    display: none;
    align-items: center;
    gap: .4rem;
    min-width: 0;
}

.portal-drill-mobile-sort .mud-select {
    min-width: 12rem;
}

/* Where the table stacks into cards, the dialog's own field and direction control replaces MudBlazor's ascending-only menu. */
@media (max-width: 959.98px) {
    .portal-drill-mobile-sort {
        display: flex;
    }

    .portal-drill-table .mud-table-smalldevices-sortselect {
        display: none;
    }
}

/* ---------- Facility participation (Pages/Monitoring/ReddiNetMonitoring.razor) ---------- */

/* Section jump links in the dashboard's status bar. */
.portal-jump {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
}

.hb a.portal-jump-link,
.portal-jump a {
    padding: .25rem .6rem;
    border: 1px solid var(--hb-border);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    color: var(--hb-text-2);
}

.portal-jump a:hover {
    border-color: var(--hb-border-strong);
    color: var(--hb-text);
}

.portal-participation-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.35fr);
}

.portal-participation-block {
    min-width: 0;
    padding: 1.1rem 1.25rem 1.25rem;
}

.portal-participation-block + .portal-participation-block {
    border-left: 1px solid var(--hb-border);
}

.portal-block-title {
    margin: 0 0 .5rem;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--hb-text-3);
}

.portal-block-total {
    font-size: 13px;
    color: var(--hb-text-2);
}

.portal-block-total b {
    margin-right: .2rem;
    font-size: 26px;
    font-weight: 600;
    color: var(--hb-text);
}

.portal-share-bar {
    display: flex;
    height: 8px;
    margin: .6rem 0 .5rem;
    overflow: hidden;
    border-radius: 999px;
    background: var(--hb-neutral-bg);
}

.portal-share-bar span + span {
    border-left: 2px solid var(--hb-surface);
}

/* Neutral pairs: the second part of each split is described, never marked as a problem. */
.portal-share-bar .covered,
.portal-split-key.covered,
.portal-share-bar .observed,
.portal-split-key.observed {
    background: var(--hb-info-dot);
}

.portal-share-bar .uncovered,
.portal-split-key.uncovered,
.portal-share-bar .unobserved,
.portal-split-key.unobserved {
    background: var(--hb-neutral-dot);
}

.portal-split-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    margin: 0;
    padding: .4rem .5rem;
    border: 1px solid transparent;
    border-radius: var(--hb-radius-sm);
    background: transparent;
    font: inherit;
    font-size: 13px;
    text-align: left;
    color: var(--hb-text);
}

.portal-split-row .label {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--hb-text-2);
}

.portal-split-row b {
    font-weight: 600;
}

.portal-split-row .go {
    margin-right: -.25rem;
    font-size: 18px;
    color: var(--hb-text-3);
}

button.portal-split-row {
    cursor: pointer;
}

button.portal-split-row:hover {
    border-color: var(--hb-border-strong);
    background: var(--hb-surface-muted);
}

button.portal-split-row:hover .go,
button.portal-split-row:focus-visible .go {
    color: var(--hb-accent);
}

button.portal-split-row:focus-visible {
    outline: 2px solid var(--hb-focus);
    outline-offset: 1px;
}

.portal-split-key {
    flex: none;
    width: 9px;
    height: 9px;
    border-radius: 3px;
}

.portal-block-note {
    margin: .6rem 0 0;
    font-size: 11.5px;
    color: var(--hb-text-3);
}

.portal-ranking {
    margin: .25rem 0 .25rem;
    padding: 0;
    list-style: none;
    counter-reset: rank;
}

.portal-ranking li {
    display: grid;
    grid-template-columns: 1.2rem minmax(0, 1fr) minmax(2.5rem, 4.5rem) auto;
    align-items: center;
    gap: .25rem .6rem;
    padding: .4rem 0;
    border-bottom: 1px solid var(--hb-border);
    counter-increment: rank;
}

.portal-ranking li::before {
    content: counter(rank);
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--hb-text-3);
}

.portal-ranking .name {
    min-width: 0;
}

.portal-ranking .name .hb-cell-primary,
.portal-ranking .name .hb-cell-secondary {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-ranking .bar {
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--hb-neutral-bg);
}

.portal-ranking .bar i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--hb-info-dot);
}

.portal-ranking .figures {
    font-size: 12.5px;
    white-space: nowrap;
    color: var(--hb-text-2);
}

.portal-ranking .figures b {
    font-weight: 600;
    color: var(--hb-text);
}

.portal-rank-cell {
    width: 1%;
}

/* ---------- New-user activity (Accounts, Pages/Monitoring/ReddiNetMonitoring.razor) ---------- */

/* Reuses the participation blocks and split rows, in three equal columns below Growth and Password expiration. */
.hb-panel.portal-newuser {
    margin-top: 1rem;
}

.portal-newuser-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.portal-newuser-grid .portal-split-row + .portal-split-row {
    margin-top: .15rem;
}

.portal-newuser-note + .portal-newuser-note {
    margin-top: .4rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 1023.98px) {
    .portal-participation-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .portal-participation-block.engagement {
        grid-column: 1 / -1;
        border-top: 1px solid var(--hb-border);
        border-left: none;
    }

    .portal-newuser-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .portal-newuser-grid .portal-participation-block:last-child {
        grid-column: 1 / -1;
        border-top: 1px solid var(--hb-border);
        border-left: none;
    }

    .portal-activity {
        grid-template-columns: minmax(0, 1fr);
    }

    .portal-activity-kpis {
        border-right: none;
        border-bottom: 1px solid var(--hb-border);
    }

    .portal-activity-kpis .portal-metrics.stacked {
        grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
        gap: 1rem;
    }

    .portal-activity-kpis .portal-metrics.stacked .portal-metric + .portal-metric {
        margin-top: 0;
        padding-top: 0;
        border-top: none;
    }
}

@media (max-width: 900px) {
    .admin-account-name {
        display: none;
    }
}

@media (max-width: 640.98px) {
    .nav-account-mobile .admin-account-name {
        display: inline;
    }

    .portal-county {
        flex-basis: 100%;
    }

    .portal-page .hb-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .5rem;
    }

    .portal-page .hb-kpi-value {
        font-size: 22px;
    }

    .portal-modules {
        min-width: 0;
    }

    .portal-frame {
        height: 75vh;
    }

    .portal-metrics,
    .portal-expiry-groups {
        grid-template-columns: minmax(0, 1fr);
    }

    .portal-metrics:not(.stacked) .portal-metric + .portal-metric {
        padding-top: .9rem;
        border-top: 1px solid var(--hb-border);
    }

    .portal-expiry-groups {
        gap: .5rem;
    }

    .portal-window {
        flex-basis: 100%;
        margin-left: 0;
    }

    /* One per row on phones, so the View cue never squeezes a figure. */
    .portal-activity-kpis .portal-metrics.stacked {
        grid-template-columns: minmax(0, 1fr);
        gap: .25rem;
    }

    .portal-concurrency .hb-chart-x span.minor {
        display: none;
    }

    .portal-drill-count {
        align-items: flex-start;
    }

    .portal-participation-grid,
    .portal-newuser-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .portal-participation-block + .portal-participation-block {
        border-top: 1px solid var(--hb-border);
        border-left: none;
    }

    .portal-ranking li {
        grid-template-columns: 1.4rem minmax(0, 1fr) auto;
    }

    .portal-ranking .bar {
        display: none;
    }

    .portal-jump {
        width: 100%;
    }

    .portal-places {
        min-width: 0;
    }

}

/* Recent sessions: each ID beside its name, so a session takes one line. */
.portal-recent .mud-table-body .mud-table-cell {
    padding-top: .45rem;
    padding-bottom: .45rem;
}

.portal-recent .mud-table-body .hb-cell-primary,
.portal-recent .mud-table-body .hb-cell-secondary {
    display: inline;
}

.portal-recent .mud-table-body .hb-cell-secondary {
    margin-left: .4rem;
}

/* Recent sessions where the table stacks (tablets and phones): the start time, then user and facility, without the stacked table's field labels. */
@media (max-width: 959.98px) {
    .portal-recent .mud-table-body .mud-table-row {
        display: block;
        padding: .6rem 1rem;
        border-bottom: 1px solid var(--hb-border);
    }

    .portal-recent .mud-table-body .mud-table-row .mud-table-cell {
        display: block;
        padding: 0 !important;
        border: none;
        text-align: left;
    }

    .portal-recent .mud-table-body .mud-table-cell::before {
        display: none;
    }

    .portal-recent .mud-table-body .mud-table-cell + .mud-table-cell {
        margin-top: .15rem;
    }

    .portal-recent .mud-table-body .hb-cell-primary,
    .portal-recent .mud-table-body .hb-cell-secondary {
        display: inline;
    }

    .portal-recent .mud-table-body .hb-cell-secondary {
        margin-left: .4rem;
    }

    .portal-recent .portal-recent-county {
        font-size: 12px;
        color: var(--hb-text-3);
    }

    /* Facility and county share a line; the facility ID stays in the desktop table and the drill-downs. */
    .portal-recent .mud-table-body .mud-table-row .mud-table-cell:nth-child(3),
    .portal-recent .mud-table-body .mud-table-row .mud-table-cell.portal-recent-county {
        display: inline;
    }

    .portal-recent .mud-table-body .mud-table-cell:nth-child(3) .hb-cell-secondary {
        display: none;
    }

    .portal-recent .mud-table-body .mud-table-cell.portal-recent-county {
        margin-left: .4rem;
    }

    .portal-recent .mud-table-body .hb-num.hb-nowrap {
        font-size: 12.5px;
        font-weight: 600;
    }
}

/* Activity by county: one row per county recorded on sessions, each figure with a bar relative to its own column's largest. */
.portal-counties-scope {
    display: flex;
    flex-wrap: wrap;
    gap: .15rem 1rem;
    margin: 0;
    padding: .6rem 1.25rem;
    border-bottom: 1px solid var(--hb-border);
    font-size: 12px;
    color: var(--hb-text-3);
}

.portal-counties-wrap {
    overflow-x: auto;
}

.portal-counties {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.portal-counties thead th {
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--hb-border);
    background: var(--hb-surface-muted);
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
    color: var(--hb-text-2);
}

.portal-counties tbody th,
.portal-counties tbody td {
    padding: .4rem .75rem;
    border-bottom: 1px solid var(--hb-border);
    font-weight: 400;
    text-align: left;
    vertical-align: middle;
    color: var(--hb-text);
}

.portal-counties tr > :first-child {
    padding-left: 1.25rem;
}

.portal-counties tr > :last-child {
    padding-right: 1.25rem;
}

.portal-counties .num {
    text-align: right;
}

.portal-counties tbody tr:last-child > * {
    border-bottom: none;
}

.portal-counties tbody tr:hover > * {
    background: var(--hb-row-hover);
}

.portal-counties tbody tr.is-selected > * {
    background: var(--hb-info-bg);
}

.portal-counties tbody tr.is-selected > :first-child {
    box-shadow: inset 3px 0 0 var(--hb-info-dot);
}

.portal-county-name {
    font-weight: 500;
}

.portal-county-tag {
    margin-left: .4rem;
    padding: .05rem .4rem;
    border-radius: 999px;
    background: var(--hb-surface);
    font-size: 11px;
    font-weight: 600;
    color: var(--hb-info);
}

.portal-county-note {
    display: block;
    font-size: 12px;
    color: var(--hb-text-3);
}

.portal-county-figure {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: .6rem;
}

.portal-county-figure .hb-num {
    font-weight: 600;
}

/* The figures open the county's users or facilities; plain text colour, so a larger figure never reads as an alert. */
.portal-county-figure .portal-link-button {
    color: var(--hb-text);
    text-decoration: underline dotted var(--hb-text-3);
    text-underline-offset: 3px;
}

.portal-county-figure .portal-link-button:hover {
    color: var(--hb-accent);
}

.portal-county-bar {
    display: block;
    flex: 0 0 auto;
    width: 5.5rem;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--hb-neutral-bg);
}

.portal-county-bar > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--hb-info-dot);
}

.portal-counties-skeleton {
    display: grid;
    gap: .9rem;
    padding: 1rem 1.25rem;
}

/* Tablets and phones: figures only, so the county names stay on one line and the table never scrolls sideways. */
@media (max-width: 1023.98px) {
    .portal-county-bar {
        display: none;
    }
}

@media (max-width: 640.98px) {
    .portal-counties-scope,
    .portal-counties tr > :first-child {
        padding-left: 1rem;
    }

    .portal-counties tr > :last-child {
        padding-right: 1rem;
    }

    .portal-counties thead th,
    .portal-counties tbody th,
    .portal-counties tbody td {
        padding-left: .4rem;
        padding-right: .4rem;
    }

    .portal-counties thead th {
        white-space: normal;
    }

    .portal-counties thead th.num .portal-th-sort {
        justify-content: flex-end;
        text-align: right;
    }
}

/* ---------- Facility information markers (Pages/Monitoring/Drilldowns/FacilityInformationMarkersDialog.razor) ---------- */

.portal-marker-entry {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem 1rem;
    font-size: 12.5px;
}

.portal-marker-about p {
    margin: 0 0 .35rem;
}

.portal-marker-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem 1.25rem;
    font-size: 12px;
    color: var(--hb-text-3);
}

/* A recorded time on two lines; a marker without a UTC time and a missing marker are written out, each with its own look. */
.portal-stamp {
    display: inline-flex;
    flex-direction: column;
    white-space: nowrap;
}

.portal-stamp .time {
    font-size: 12px;
    color: var(--hb-text-2);
}

.portal-stamp.unavailable,
.portal-stamp.none,
.portal-stamp.sample {
    display: inline-block;
    padding: .05rem .4rem;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 500;
}

.portal-stamp.unavailable {
    border: 1px solid var(--hb-border-strong);
    color: var(--hb-text-2);
}

.portal-stamp.none {
    border: 1px dashed var(--hb-border-strong);
    color: var(--hb-text-3);
}

.portal-stamp.sample {
    background: var(--hb-neutral-bg);
    color: var(--hb-text-2);
}

.portal-markers .mud-table-container {
    overflow-x: auto;
}

.portal-markers .mud-table-head .mud-table-cell {
    white-space: normal;
}

.portal-markers .mud-table-body .portal-marker-facility {
    min-width: 13rem;
}

.portal-markers .mud-table-body .mud-table-cell:nth-child(2) {
    white-space: nowrap;
}

/* Tablets and phones: one card per facility, the name across the top and each value under its own label, two to a line. */
@media (max-width: 959.98px) {
    .portal-markers .mud-table-body .mud-table-row {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
        gap: .55rem 1rem;
        padding: .75rem 1rem;
        border-bottom: 1px solid var(--hb-border);
    }

    .portal-markers .mud-table-body .mud-table-row .mud-table-cell {
        display: block;
        min-width: 0;
        padding: 0 !important;
        border: none;
        text-align: left;
    }

    .portal-markers .mud-table-body .mud-table-cell::before {
        display: block;
        margin-bottom: .1rem;
        padding: 0;
        font-size: 11px;
        font-weight: 600;
        letter-spacing: .04em;
        text-transform: uppercase;
        color: var(--hb-text-3);
    }

    .portal-markers .mud-table-body .mud-table-row .mud-table-cell.portal-marker-facility {
        grid-column: 1 / -1;
        min-width: 0;
    }

    .portal-markers .mud-table-body .portal-marker-facility::before {
        display: none;
    }

    .portal-markers .mud-table-body .portal-marker-facility .hb-cell-primary {
        font-weight: 600;
    }

    .portal-markers .mud-table-body .mud-table-cell:nth-child(2) {
        white-space: normal;
    }
}

/* Phones: two values to a line, so a facility's card stays short. */
@media (max-width: 599.98px) {
    .portal-markers .mud-table-body .mud-table-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .5rem .75rem;
    }
}

/* Session activity chart: its heading names the reading shown, and a switch beside it turns closed-session concurrency on and off. */
.portal-chart-title {
    flex: 1 1 18rem;
    min-width: 0;
}

.portal-chart-aside {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .55rem;
}

.portal-mode-switch {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .3rem .7rem .3rem .4rem;
    border: 1px solid var(--hb-border);
    border-radius: 999px;
    background: var(--hb-surface);
    font: inherit;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--hb-text-2);
    cursor: pointer;
}

.portal-mode-switch:hover {
    border-color: var(--hb-border-strong);
    color: var(--hb-text);
}

.portal-mode-switch:focus-visible {
    outline: 2px solid var(--hb-focus);
    outline-offset: 2px;
}

.portal-mode-switch .track {
    position: relative;
    flex: 0 0 auto;
    width: 28px;
    height: 16px;
    border-radius: 999px;
    background: var(--hb-neutral-dot);
    transition: background-color .15s ease;
}

.portal-mode-switch .track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
    transition: transform .15s ease;
}

.portal-mode-switch[aria-checked="true"] {
    border-color: var(--hb-info-dot);
    color: var(--hb-text);
}

.portal-mode-switch[aria-checked="true"] .track {
    background: var(--hb-info-dot);
}

.portal-mode-switch[aria-checked="true"] .track::after {
    transform: translateX(12px);
}

/* Users starting sessions: the hour or day still in progress is drawn lighter. */
.portal-starts .hb-chart-col.partial .hb-chart-bar,
.portal-legend-partial {
    opacity: .5;
}

.portal-legend-partial {
    background: var(--hb-info-dot);
}

@media (prefers-reduced-motion: reduce) {
    .portal-mode-switch .track,
    .portal-mode-switch .track::after {
        transition: none;
    }
}

/* Phones: the switch and figure share a row under the heading. */
@media (max-width: 640.98px) {
    .portal-chart-aside {
        flex: 1 1 100%;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
    }
}

/* Recorded application experience: three overlapping categories side by side, each with its users and facilities. */
.portal-experience-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.portal-experience-grid .portal-participation-block + .portal-participation-block {
    border-left: 1px solid var(--hb-border);
}

.portal-experience-name {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--hb-text);
}

.portal-experience-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: var(--hb-radius-sm);
    background: var(--hb-info-bg);
    color: var(--hb-info);
}

.portal-experience-block.unknown .portal-experience-icon {
    background: var(--hb-neutral-bg);
    color: var(--hb-text-2);
}

.portal-experience-icon .mud-icon-root {
    font-size: 18px;
}

.portal-experience-rule {
    margin: .3rem 0 .8rem;
    font-size: 12px;
    color: var(--hb-text-3);
}

.portal-experience-figures {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
    margin: 0 -.5rem;
}

/* Each figure that has records is a button to its list: outlined on hover, accented chevron, visible focus. Zero is plain text. */
.portal-experience-figure {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    margin: 0;
    padding: .35rem .5rem;
    border: 1px solid transparent;
    border-radius: var(--hb-radius-sm);
    background: transparent;
    font: inherit;
    text-align: left;
    color: var(--hb-text);
}

.portal-experience-figure .label {
    font-size: 12px;
    color: var(--hb-text-2);
}

.portal-experience-figure .value {
    display: inline-flex;
    align-items: center;
    gap: .15rem;
    margin-top: .1rem;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
}

.portal-experience-figure .value .mud-icon-root {
    font-size: 20px;
    color: var(--hb-text-3);
}

button.portal-experience-figure {
    cursor: pointer;
}

/* Like the other clickable figures in Monitoring: ordinary text with a dotted underline, the accent only on hover or focus. */
button.portal-experience-figure .value {
    color: var(--hb-text);
    text-decoration: underline dotted var(--hb-text-3);
    text-underline-offset: 4px;
}

button.portal-experience-figure:hover .value,
button.portal-experience-figure:focus-visible .value {
    color: var(--hb-accent);
}

button.portal-experience-figure:hover {
    border-color: var(--hb-border-strong);
    background: var(--hb-surface-muted);
}

button.portal-experience-figure:hover .value .mud-icon-root,
button.portal-experience-figure:focus-visible .value .mud-icon-root {
    color: var(--hb-accent);
}

button.portal-experience-figure:focus-visible {
    outline: 2px solid var(--hb-focus);
    outline-offset: 1px;
}

.portal-experience-note {
    margin: 0;
}

/* Partial coverage: when the counted window starts, above the figures, in the neutral information treatment. */
.portal-experience-coverage {
    margin: .85rem 1rem 0;
}

/* A recorded username and its current accounts stay stacked when a phone shows the row as a card. */
.portal-experience-cell {
    min-width: 0;
    text-align: left;
}

/* Tablets and phones: one category per row, its two figures still side by side. */
@media (max-width: 1023.98px) {
    .portal-experience-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .portal-experience-grid .portal-participation-block + .portal-participation-block {
        border-top: 1px solid var(--hb-border);
        border-left: none;
    }
}

/* Tablets: the name on the left, the figures on the right, so the three rows stay compact. */
@media (min-width: 641px) and (max-width: 1023.98px) {
    .portal-experience-block {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
        column-gap: 1.25rem;
        align-items: center;
        padding-top: .85rem;
        padding-bottom: .85rem;
    }

    .portal-experience-rule {
        grid-column: 1;
        margin-bottom: 0;
    }

    .portal-experience-figures {
        grid-column: 2;
        grid-row: 1 / span 2;
    }
}