:root,
[data-theme="light"] {
    color-scheme: light;
    --pon-bg: #f4f1ea;
    --pon-surface: #ffffff;
    --pon-surface-muted: #f8f6f2;
    --pon-text: #211f1c;
    --pon-text-muted: #716d66;
    --pon-border: #dad3c3;
    --pon-header: #ffffff;
    --pon-hover: #f3efe6;
    --pon-input: #ffffff;
    --pon-shadow: 0 8px 24px rgba(33, 31, 28, 0.06);
    --pon-hamburger: #211f1c;
    --pon-tab-active-bg: #ffffff;
    --pon-table-min: 860px;
    --kt-app-header-base-bg-color: #ffffff;
    --kt-app-header-base-border-bottom: 1px solid #dad3c3;
}

[data-theme="dark"] {
    color-scheme: dark;
    --pon-bg: #141311;
    --pon-surface: #1d1b18;
    --pon-surface-muted: #26231f;
    --pon-text: #f4f1ea;
    --pon-text-muted: #b3ada3;
    --pon-border: #3d3933;
    --pon-header: #191714;
    --pon-hover: #2c2924;
    --pon-input: #221f1b;
    --pon-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    --pon-hamburger: #f4f1ea;
    --pon-tab-active-bg: #26231f;
    --bs-body-color: #f4f1ea;
    --bs-body-bg: #141311;
    --bs-secondary-bg: #1d1b18;
    --bs-tertiary-bg: #26231f;
    --bs-border-color: #3d3933;
    --bs-emphasis-color: #ffffff;
    --kt-app-bg-color: #141311;
    --kt-app-blank-bg-color: #141311;
    --kt-app-header-base-bg-color: #191714;
    --kt-app-header-base-border-bottom: 1px solid #3d3933;
    --kt-body-bg: #141311;
    --kt-body-color: #f4f1ea;
    --kt-card-bg: #1d1b18;
    --kt-border-color: #3d3933;
}

html,
body,
body.app-default {
    background-color: var(--pon-bg);
    color: var(--pon-text);
}

.app-header,
.app-page,
.app-wrapper,
.app-main,
.app-content,
.app-root {
    background-color: var(--pon-bg);
}

.app-header {
    background-color: var(--pon-header) !important;
    border-bottom: 1px solid var(--pon-border);
    box-shadow: none;
}

.card,
.card-flush {
    background-color: var(--pon-surface);
    border-color: var(--pon-border);
    box-shadow: var(--pon-shadow);
    color: var(--pon-text);
}

.text-gray-900,
.text-gray-800,
h1, h2, h3, h4, h5, h6,
.offcanvas-title {
    color: var(--pon-text) !important;
}

.text-gray-600,
.text-gray-500,
.text-muted {
    color: var(--pon-text-muted) !important;
}

.menu-link,
.menu-title {
    color: var(--pon-text);
}

.form-control,
.form-select,
.form-check-input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="textarea"],
select,
textarea {
    background-color: var(--pon-input);
    color: var(--pon-text);
    border-color: var(--pon-border);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--pon-input);
    color: var(--pon-text);
    border-color: #4fc9da;
}

.table {
    color: var(--pon-text);
    --bs-table-bg: transparent;
    --bs-table-striped-bg: var(--pon-surface-muted);
    --bs-table-hover-bg: var(--pon-hover);
    --bs-table-color: var(--pon-text);
    --bs-table-striped-color: var(--pon-text);
    --bs-table-hover-color: var(--pon-text);
    --bs-table-border-color: var(--pon-border);
}

.table > :not(caption) > * > * {
    background-color: transparent;
    color: inherit;
    border-color: var(--pon-border);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: var(--pon-surface-muted);
    color: var(--pon-text);
}

.table .thead-dark th,
.table thead th {
    background-color: #211f1c;
    color: #fff;
    border-color: #211f1c;
    white-space: nowrap;
}

[data-theme="dark"] .table .thead-dark th,
[data-theme="dark"] .table thead th {
    background-color: #2c2924;
    border-color: var(--pon-border);
    color: var(--pon-text);
}

.nav-tabs { border-bottom-color: var(--pon-border); }
.nav-line-tabs .nav-link,
.nav-tabs .nav-link {
    color: var(--pon-text-muted);
    white-space: nowrap;
}
/* Bootstrap hard-codes light grays for the hovered border and a white fill for
   the active tab, both of which have to follow the theme instead. */
.nav-tabs .nav-link:hover,
.nav-tabs .nav-link:focus {
    border-color: var(--pon-border);
}

.nav-line-tabs .nav-link.active,
.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
    color: var(--pon-text);
    border-color: #4fc9da;
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
    background-color: var(--pon-tab-active-bg);
}

.offcanvas {
    background-color: var(--pon-surface);
    color: var(--pon-text);
}

[data-theme="dark"] .btn-close { filter: invert(1) grayscale(1); }

/* Keen paints this alert with the secondary fill (#DAD3C3 / #323248) on the
   secondary-light surface. Those two steps are adjacent, so the text is about
   1.4:1 in both themes. Inverse is the readable color for that fill. */
.alert-secondary,
.alert-secondary .alert-link {
    color: var(--kt-secondary-inverse);
}

.badge-pill { border-radius: 50rem; }
.badge-danger { background-color: #f06445; color: #fff; }
.badge-warning { background-color: #e8c444; color: #211f1c; }
.badge-success { background-color: #b8d935; color: #211f1c; }
.form-group { margin-bottom: 1rem; }

.btn-icon { padding: 0.45rem; }

.pon-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 42px;
    min-height: 42px;
}

.pon-theme-icon { display: none; line-height: 0; }
[data-theme="light"] .pon-theme-icon-moon,
[data-theme="dark"] .pon-theme-icon-sun { display: inline-flex; }

.pon-theme-label { display: none; }
[data-theme="light"] .pon-theme-toggle .pon-theme-label-dark,
[data-theme="dark"] .pon-theme-toggle .pon-theme-label-light { display: inline; }

.pon-theme-toggle.is-wide {
    width: 100%;
    justify-content: flex-start;
    padding: 0.65rem 1rem;
}

.pon-user-email {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pon-hamburger {
    width: 42px;
    height: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.pon-hamburger-icon {
    display: block;
    width: 24px;
    height: 24px;
    fill: none;
    stroke: var(--pon-hamburger);
    stroke-width: 2;
    stroke-linecap: round;
}

.pon-refresh {
    display: inline-flex;
    align-items: baseline;
    gap: 0.45rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--pon-border);
    border-radius: 999px;
    background: var(--pon-surface-muted);
    color: var(--pon-text);
    font-variant-numeric: tabular-nums;
}

.pon-refresh-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--pon-text-muted);
}

.pon-refresh-time {
    font-size: 0.95rem;
    font-weight: 700;
}

.pon-refresh.is-soon {
    border-color: #e8c444;
    background: rgba(232, 196, 68, 0.16);
}

.pon-refresh.is-now {
    border-color: #f06445;
    background: rgba(240, 100, 69, 0.16);
}

.pon-header-tabs { min-width: 0; }

#myTab {
    flex-wrap: nowrap;
    width: 100%;
}

#myTab .nav-item { flex: 0 0 auto; }

.app-default .pon-dashboard {
    width: 100%;
}

.app-default {
    font-size: 1.2rem;
}

.app-default #kt_app_header {
    margin: 0;
    padding: 0;
}

.app-default #kt_app_header_container {
    padding-left: 0;
    padding-right: 0;
}

.app-default .pon-alarm-toolbar {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    border-bottom: 1px solid var(--pon-border);
    scrollbar-width: thin;
}

.app-default #myTab .nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    line-height: 1.15;
}

.app-default .pon-dashboard > .tab-content {
    width: 100%;
}

.app-default .pon-alarm-table-wrap {
    width: auto;
    margin-left: 20px;
    margin-right: 20px;
    overflow-x: auto;
    overflow-y: visible;
    border-bottom: 1px solid var(--pon-border);
    scrollbar-width: thin;
}

.app-default .pon-alarm-table-wrap:focus-visible {
    outline: 2px solid #4fc9da;
    outline-offset: -2px;
}

.app-default .pon-alarm-table {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
}

.app-default .pon-alarm-table thead th {
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

/* No max-width: the wrapper scrolls, so a capped cell would let nowrap
   content spill over the next column instead of widening the table. */
.app-default .pon-alarm-table .pon-object-cell {
    min-width: 13rem;
    white-space: normal;
    font-weight: 700;
}

.app-default .pon-alarm-table .pon-object-cell > a,
.app-default .pon-alarm-table .pon-object-cell li > a,
.app-default .pon-alarm-table .pon-status-cell,
.app-default .pon-alarm-table .pon-action-cell {
    white-space: nowrap;
}

.app-default .pon-alarm-table .pon-status-cell .badge {
    display: inline-flex;
    align-items: center;
    font-weight: 650;
}

.app-default .pon-alarm-table .pon-ack-cell {
    width: 3rem;
}

.app-default .pon-alarm-table .pon-ack-cell .material-icons {
    display: inline-block;
    font-size: 1.2rem;
    vertical-align: middle;
}

.app-default .pon-alarm-table .pon-action-cell {
    width: 1%;
}

.app-default .pon-ack-form {
    display: flex;
    align-items: center;
    margin: 0;
}

.app-default .pon-ack-form .pon-ack-check {
    flex: 0 0 auto;
    margin: 0;
}

.app-default .pon-ack-form textarea {
    width: 12rem;
    min-height: 2rem;
    resize: vertical;
}

.app-default .pon-alarm-table-wrap ul {
    margin: 0.25rem 0 0;
    padding-left: 1rem;
    min-width: 0;
}

.pon-table-wrap,
.table-responsive-sm {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.pon-table-wrap table,
.table-responsive-sm table {
    width: 100%;
    min-width: var(--pon-table-min);
}

.table-responsive-sm th,
.table-responsive-sm td,
.pon-table-wrap th,
.pon-table-wrap td {
    white-space: nowrap;
    vertical-align: middle;
}

.table-responsive-sm .badge,
.pon-table-wrap .badge { white-space: nowrap; }

.table-responsive-sm ul {
    margin: 0.4rem 0 0;
    padding-left: 1.1rem;
    white-space: normal;
    min-width: 14rem;
}

.pon-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-end;
}

.auth-panel {
    background: var(--pon-surface);
    border: 1px solid var(--pon-border);
    color: var(--pon-text);
}

.auth-logo {
    display: none;
    width: 240px;
    height: auto;
    margin: 0 auto 1.25rem;
}

@media (min-width: 992px) {
    .auth-logo {
        display: block;
    }
}

.auth-chooser input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.auth-chooser-label {
    margin: 0 0 0.4rem;
    color: var(--pon-text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
}

.auth-chooser-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.15rem;
    margin-bottom: 1rem;
    padding: 0.2rem;
    border: 1px solid var(--pon-border);
    border-radius: 8px;
    background: var(--pon-surface-muted);
}

.auth-chooser-tabs label {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0.4rem 0.5rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--pon-text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    cursor: pointer;
}

.auth-chooser-tabs label:hover {
    color: var(--pon-text);
}

#signin-uisp:checked ~ .auth-chooser-tabs label[for="signin-uisp"],
#signin-legacy:checked ~ .auth-chooser-tabs label[for="signin-legacy"] {
    background: var(--pon-surface);
    color: var(--pon-text);
    box-shadow: 0 1px 2px rgba(33, 31, 28, 0.12);
}

#signin-uisp:focus ~ .auth-chooser-tabs label[for="signin-uisp"],
#signin-legacy:focus ~ .auth-chooser-tabs label[for="signin-legacy"] {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

#signin-legacy:checked ~ .auth-pane-uisp,
#signin-uisp:checked ~ .auth-pane-legacy {
    display: none;
}

.auth-chooser.is-uisp-only .auth-pane-uisp {
    display: block;
}

.auth-shell { background-color: var(--pon-bg); }

.pon-theme-corner {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 20;
}

[data-theme="dark"] .navbar,
[data-theme="dark"] .navbar-light,
[data-theme="dark"] .bg-light,
[data-theme="dark"] .bg-faded {
    background-color: var(--pon-header) !important;
    border-color: var(--pon-border);
}

[data-theme="dark"] .navbar-light .navbar-brand,
[data-theme="dark"] .navbar-light .navbar-text {
    color: var(--pon-text);
}

[data-theme="dark"] .navbar-light .navbar-nav .nav-link {
    color: var(--pon-text-muted);
}

[data-theme="dark"] .btn-light,
[data-theme="dark"] .btn-light-primary {
    background-color: var(--pon-surface-muted);
    border-color: var(--pon-border);
    color: var(--pon-text);
}

[data-theme="dark"] a:not(.btn):not(.nav-link):not(.menu-link):not(.badge) {
    color: #7ad7e4;
}

.auth-panel .alert-warning a.auth-support-link,
[data-theme="dark"] .auth-panel .alert-warning a.auth-support-link:not(.btn) {
    color: #533f03;
    font-weight: 600;
    text-decoration: underline;
}

.pon-shared-retirement {
    margin: 0.75rem 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid #e6c35c;
    border-radius: 8px;
    background: #fff6d8;
    color: #3d3208;
    font-size: 0.95rem;
    line-height: 1.45;
    text-align: left;
}

.pon-shared-retirement a.auth-support-link,
[data-theme="dark"] .pon-shared-retirement a.auth-support-link:not(.btn):not(.nav-link) {
    color: #533f03;
    font-weight: 600;
    text-decoration: underline;
}

@media (max-width: 991.98px) {
    .app-header,
    .app-header .app-container {
        overflow: hidden;
    }

    .app-header .app-container {
        min-height: 58px;
        padding-top: 0.4rem;
        padding-bottom: 0.4rem;
        gap: 0.5rem;
    }

    body.pon-has-alarm-tabs .app-header .pon-theme-toggle {
        display: none !important;
    }

    .pon-header-tabs {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .pon-header-tabs::-webkit-scrollbar { display: none; }

    .pon-header-tabs #myTab {
        display: flex !important;
        flex-wrap: nowrap;
        width: max-content;
        min-width: 100%;
        margin: 0;
        border-bottom: 0;
    }

    .pon-header-tabs .nav-link {
        padding: 0.55rem 0.7rem;
        font-size: 0.8rem;
        font-weight: 650;
        line-height: 1.2;
    }

    #kt_app_content_container {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    .pon-dashboard {
        display: block;
        margin-left: -0.85rem;
        margin-right: -0.85rem;
    }

    .pon-dashboard-alarms {
        background: transparent;
        border: 0;
        box-shadow: none;
        border-radius: 0;
    }

    .pon-dashboard-alarms .card-header,
    .pon-alarm-toolbar {
        display: none;
    }

    .pon-dashboard-alarms .card-body { padding: 0; }

    .pon-dashboard .pon-refresh {
        display: flex;
        width: fit-content;
        margin: 0.85rem auto 0;
    }

    .fs-2hx { font-size: 1.75rem !important; }

    .pon-table-wrap,
    .table-responsive-sm { overflow: visible; }

    .pon-table-wrap table,
    .table-responsive-sm table {
        width: 100% !important;
        min-width: 0;
    }

    .pon-table-wrap thead,
    .table-responsive-sm thead { display: none; }

    .pon-table-wrap tbody tr {
        display: block;
        margin-bottom: 0.85rem;
        padding: 1rem;
        background: var(--pon-surface);
        border: 1px solid var(--pon-border);
        border-radius: 10px;
    }

    .table-responsive-sm tbody tr {
        display: flex;
        align-items: center;
        gap: 0.65rem;
        position: relative;
        margin: 0;
        padding: 0.85rem 1rem 0.85rem 2rem;
        min-height: 52px;
        background: var(--pon-surface);
        border: 0;
        border-bottom: 1px solid var(--pon-border);
        cursor: pointer;
    }

    .table-responsive-sm tbody tr::after {
        content: "";
        position: absolute;
        left: 0.85rem;
        top: 50%;
        width: 7px;
        height: 7px;
        margin-top: -5px;
        border-right: 2px solid var(--pon-text-muted);
        border-bottom: 2px solid var(--pon-text-muted);
        transform: rotate(-45deg);
        pointer-events: none;
    }

    .table-responsive-sm tbody tr.is-open {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: start;
        padding-top: 0.9rem;
        padding-bottom: 1rem;
        background: var(--pon-surface-muted);
    }

    .table-responsive-sm tbody tr.is-open::after {
        top: 1.25rem;
        margin-top: 0;
        transform: rotate(45deg);
    }

    .table-striped > tbody > tr:nth-of-type(odd) > * {
        background-color: transparent;
    }

    .pon-table-wrap tbody tr > *,
    .table-responsive-sm tbody tr.is-open > *:nth-child(n+3) {
        display: grid;
        gap: 0.2rem;
        width: 100%;
        padding: 0.45rem 0;
        border: 0;
        text-align: left;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .table-responsive-sm tbody tr > *:nth-child(1),
    .table-responsive-sm tbody tr > *:nth-child(2) {
        display: block;
        padding: 0;
        border: 0;
        background: transparent;
    }

    .table-responsive-sm tbody tr:not(.is-open) > *:nth-child(1) {
        flex: 1 1 auto;
        min-width: 0;
        font-weight: 650;
    }

    .table-responsive-sm tbody tr:not(.is-open) > *:nth-child(2) {
        flex: 0 1 auto;
        max-width: 46%;
    }

    .table-responsive-sm tbody tr:not(.is-open) > *:nth-child(n+3),
    .table-responsive-sm tbody tr:not(.is-open) ul {
        display: none !important;
    }

    .table-responsive-sm tbody tr:not(.is-open) > *:nth-child(1),
    .table-responsive-sm tbody tr:not(.is-open) > *:nth-child(1) a {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .table-responsive-sm tbody tr:not(.is-open) a {
        pointer-events: none;
        color: inherit;
        text-decoration: none;
    }

    .table-responsive-sm tbody tr.is-open > *:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
        min-width: 0;
        font-weight: 650;
    }

    .table-responsive-sm tbody tr.is-open > *:nth-child(2) {
        grid-column: 2;
        grid-row: 1;
    }

    .table-responsive-sm tbody tr.is-open > *:nth-child(n+3) {
        grid-column: 1 / -1;
    }

    .pon-table-wrap tbody tr > *::before,
    .table-responsive-sm tbody tr.is-open > *:nth-child(n+3)::before {
        content: attr(data-label);
        font-size: 0.72rem;
        font-weight: 700;
        letter-spacing: 0.03em;
        text-transform: uppercase;
        color: var(--pon-text-muted);
    }

    .table-responsive-sm tbody tr.is-open > *:nth-child(3)::before { content: "PON"; }
    .table-responsive-sm tbody tr.is-open > *:nth-child(4)::before { content: "Serial"; }
    .table-responsive-sm tbody tr.is-open > *:nth-child(5)::before { content: "Start"; }
    .table-responsive-sm tbody tr.is-open > *:nth-child(6)::before { content: "Ack"; }
    .table-responsive-sm tbody tr.is-open > *:nth-child(7)::before { content: "Acknowledge"; }

    .pon-table-wrap tbody tr > *[data-label]::before,
    .table-responsive-sm tbody tr.is-open > *[data-label]::before {
        content: attr(data-label);
    }

    .pon-table-wrap form,
    .table-responsive-sm form,
    .pon-actions {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.4rem;
    }

    .pon-actions .btn,
    .pon-table-wrap .btn,
    .table-responsive-sm .btn,
    .table-responsive-sm input[type="submit"] {
        width: 100%;
    }

    .table-responsive-sm tbody tr:not(.is-open) .badge {
        white-space: nowrap;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .table-responsive-sm tbody tr.is-open .badge {
        white-space: normal;
        text-align: left;
        line-height: 1.3;
    }

    .app-default .pon-header-tabs {
        box-shadow: inset -12px 0 10px -12px var(--pon-text-muted);
    }

    .app-default .pon-header-tabs .nav-link {
        min-height: 44px;
        font-size: 0.82rem;
    }

    .app-default .pon-dashboard .pon-alarm-table-wrap {
        overflow-x: auto;
        overflow-y: visible;
    }

    .app-default .pon-dashboard .pon-alarm-table {
        display: table;
        width: max-content !important;
        min-width: 100%;
    }

    .app-default .pon-dashboard .pon-alarm-table thead {
        display: table-header-group;
    }

    .app-default .pon-dashboard .pon-alarm-table tbody {
        display: table-row-group;
    }

    .app-default .pon-dashboard .pon-alarm-table tbody tr,
    .app-default .pon-dashboard .pon-alarm-table tbody tr.is-open {
        display: table-row;
        position: static;
        min-height: 0;
        margin: 0;
        padding: 0;
        background: transparent;
        border: 0;
        cursor: default;
    }

    .app-default .pon-dashboard .pon-alarm-table tbody tr::after,
    .app-default .pon-dashboard .pon-alarm-table tbody tr.is-open::after {
        display: none;
    }

    .app-default .pon-dashboard .pon-alarm-table tbody tr > *,
    .app-default .pon-dashboard .pon-alarm-table tbody tr.is-open > *,
    .app-default .pon-dashboard .pon-alarm-table tbody tr:not(.is-open) > * {
        display: table-cell !important;
        width: auto;
        border-bottom: 1px solid var(--pon-border);
        text-align: left;
        white-space: nowrap;
        overflow: visible;
    }

    .app-default .pon-dashboard .pon-alarm-table tbody tr > *::before,
    .app-default .pon-dashboard .pon-alarm-table tbody tr.is-open > *::before {
        display: none;
        content: none;
    }

    .app-default .pon-dashboard .pon-alarm-table .pon-object-cell {
        min-width: 13rem;
        white-space: normal;
    }

    .app-default .pon-dashboard .pon-alarm-table .pon-object-cell a,
    .app-default .pon-dashboard .pon-alarm-table tbody tr:not(.is-open) .pon-object-cell,
    .app-default .pon-dashboard .pon-alarm-table tbody tr:not(.is-open) .pon-object-cell a {
        overflow: visible;
        text-overflow: clip;
        white-space: nowrap;
        pointer-events: auto;
    }

    .app-default .pon-dashboard .pon-alarm-table tbody tr:not(.is-open) ul {
        display: block !important;
    }

    .app-default .pon-dashboard .pon-alarm-table .badge,
    .app-default .pon-dashboard .pon-alarm-table tbody tr:not(.is-open) .badge,
    .app-default .pon-dashboard .pon-alarm-table tbody tr.is-open .badge {
        max-width: none;
        overflow: visible;
        text-overflow: clip;
        white-space: nowrap;
        text-align: left;
        line-height: 1.15;
    }

    .app-default .pon-dashboard .pon-ack-form {
        display: flex;
        flex-direction: row;
        align-items: center;
    }

    .app-default .pon-dashboard .pon-ack-form .btn,
    .app-default .pon-dashboard .pon-ack-form input[type="submit"] {
        width: auto;
    }
}

@media (max-width: 767.98px) {
    .app-default .pon-dashboard .pon-alarm-table thead th:first-child,
    .app-default .pon-dashboard .pon-alarm-table tbody .pon-object-cell {
        position: static;
        left: auto;
        z-index: auto;
        box-shadow: none;
    }

    .app-default .pon-dashboard .pon-alarm-table thead th:first-child {
        z-index: auto;
    }

    .app-default .pon-dashboard .pon-alarm-table tbody .pon-object-cell {
        background: var(--pon-surface);
    }

    .app-default .pon-dashboard .pon-alarm-table.table-striped > tbody > tr:nth-of-type(odd) > .pon-object-cell {
        background: var(--pon-surface-muted);
    }
}

/* Modern monitoring dashboard: compact, table-first presentation. */
:root,
[data-theme="light"] {
    --pon-link: #0d6efd;
    --pon-link-hover: #0a58ca;
    --pon-link-soft: rgba(13, 110, 253, 0.12);
}

[data-theme="dark"] {
    --pon-link: #6ea8fe;
    --pon-link-hover: #9ec5fe;
    --pon-link-soft: rgba(110, 168, 254, 0.18);
}

.app-default .pon-user-email {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
    font-size: 1.02rem;
}

/* The header is fixed, so the wrapper offset below it has to match the height
   we actually give the header, or content ends up under it. */
body.app-default {
    --kt-app-header-height: 76px;
    --kt-app-header-height-actual: 76px;
}

.app-default #kt_app_header_container {
    min-height: 72px;
    gap: 0.85rem;
    padding-top: 0;
    padding-bottom: 0;
}

.app-default .pon-brand-logo {
    width: auto;
    height: 4.5rem;
    display: block;
}

.app-default .pon-header-tabs {
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    box-shadow: inset -12px 0 10px -12px var(--pon-text-muted);
}

.app-default .pon-header-tabs #myTab {
    display: flex;
    flex-wrap: nowrap;
    width: max-content;
    min-width: 100%;
    gap: 0.35rem;
    margin: 0 !important;
    margin-bottom: 0 !important;
    padding-bottom: 0;
    border: 0;
}

.app-default .pon-header-tabs .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 28px;
    padding: 0.1rem 0.7rem;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    color: var(--pon-text-muted);
    font-size: 1.28rem;
    font-weight: 650;
    line-height: 1.15;
    white-space: nowrap;
}

.app-default .pon-header-tabs .nav-item {
    margin-bottom: 0;
}

.app-default .pon-header-tabs .nav-link:hover,
.app-default .pon-header-tabs .nav-link:focus-visible,
.app-default .pon-header-tabs .nav-link.active {
    color: var(--pon-link);
}

.app-default .pon-header-tabs .nav-link.active {
    border-bottom-color: var(--pon-link);
    background: transparent;
}

.app-default .pon-header-tabs .nav-link:focus-visible,
.app-default .pon-alarm-table-wrap:focus-visible {
    outline: 2px solid var(--pon-link);
    outline-offset: -2px;
}

.app-default .pon-tab-count {
    min-width: 1.55rem;
    padding: 0.14rem 0.28rem;
    border-radius: 0.25rem;
    background: var(--pon-link-soft);
    color: var(--pon-link);
    font-size: 1.02rem;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.app-default .nav-link.active .pon-tab-count {
    background: var(--pon-link);
    color: #fff;
}

.app-default #ponTabHome {
    display: none;
}

.app-default .pon-mobile-tab-picker {
    display: none;
}

.pon-mobile-tab-select {
    position: relative;
}

/* Sits inside the select, clear of the native dropdown arrow. */
.pon-mobile-tab-select select {
    padding-right: 7.5rem;
    text-overflow: ellipsis;
}

.pon-mobile-tab-hint {
    position: absolute;
    top: 50%;
    right: 2rem;
    transform: translateY(-50%);
    color: var(--pon-text-muted);
    font-size: 0.78rem;
    pointer-events: none;
}

body.pon-has-alarm-tabs .app-content {
    padding-top: 0;
    padding-bottom: 0;
}

body.pon-has-alarm-tabs #kt_app_content_container {
    padding-right: 0 !important;
    padding-left: 0 !important;
}

.app-default .pon-dashboard {
    margin-right: 0;
    margin-left: 0;
}

body.pon-has-alarm-tabs .pon-header-utilities {
    display: none !important;
}

.app-default .pon-dashboard a:not(.btn):not(.nav-link):not(.badge) {
    color: var(--pon-link);
}

.app-default .pon-dashboard a:not(.btn):not(.nav-link):not(.badge):hover {
    color: var(--pon-link-hover);
}

.app-default .pon-alarm-table > :not(caption) > * > * {
    padding: 0.35rem 0.5rem;
}

.app-default .pon-alarm-table td,
.app-default .pon-alarm-table tbody th[scope="row"] {
    font-size: 1.08rem;
}

.app-default .pon-alarm-table .small,
.app-default .pon-alarm-table small {
    font-size: 1rem !important;
}

.app-default .pon-alarm-table thead th {
    padding-top: 0.32rem;
    padding-bottom: 0.32rem;
}

.app-default .pon-alarm-table .pon-status-cell,
.app-default .pon-alarm-table .pon-ack-cell,
.app-default .pon-alarm-table .pon-action-cell,
.app-default .pon-alarm-table td[data-label="PON"],
.app-default .pon-alarm-table td[data-label="Serial Number"],
.app-default .pon-alarm-table td[data-label="Start Time"] {
    width: 1%;
}

.pon-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.45rem;
    border-radius: 50rem;
    font-weight: 650;
    font-size: 0.95rem;
    line-height: 1.1;
    white-space: nowrap;
}

.app-default .pon-status-badge {
    border-radius: 0.25rem;
}

.pon-status-danger {
    background-color: #f06445;
    color: #fff;
}

.pon-status-warning {
    background-color: #e8c444;
    color: #211f1c;
}

/* Rides along in the object cell on tables that dropped the details column,
   pinned right so the badges line up as if they still had their own column. */
.pon-inline-status-badge {
    float: right;
    margin-left: 0.75rem;
    font-size: 0.78rem;
    padding: 0.15rem 0.4rem;
}

.pon-object-cell > ul {
    clear: right;
}

/* Sits over the badges so the merged column still names both halves. */
.pon-inline-status-heading {
    float: right;
    margin-right: 0.4rem;
}

.app-default .pon-dashboard-utilities {
    padding: 0.55rem 1rem 0.75rem;
}

.app-default .pon-dashboard-utilities .pon-refresh {
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.app-default .pon-dashboard-utilities .pon-refresh.is-soon {
    color: #997404;
    background: transparent;
}

.app-default .pon-dashboard-utilities .pon-refresh.is-now {
    color: #b02a37;
    background: transparent;
}

.app-default .pon-dashboard-utilities .pon-theme-toggle {
    min-width: auto;
    min-height: auto;
}

.app-default .pon-dashboard-utilities .pon-logout-link {
    font-size: 1.02rem;
}

button.pon-logout-link {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: var(--pon-link);
    text-decoration: underline;
    cursor: pointer;
}

button.pon-logout-link:hover {
    color: var(--pon-link-hover);
}

.pon-refresh-warning[hidden] {
    display: none !important;
}

.pon-refresh-warning {
    margin: 0.75rem 1rem 0;
}

.app-default .btn-primary {
    border-color: #0d6efd;
    background-color: #0d6efd;
}

.app-default .btn-outline-primary {
    border-color: var(--pon-link);
    color: var(--pon-link);
}

.app-default .btn-outline-primary:hover {
    border-color: #0d6efd;
    background-color: #0d6efd;
    color: #fff;
}

/* The tab strip only shares the header with the brand above 991px, and it
   needs the whole row to itself. */
@media (min-width: 992px) and (max-width: 1199.98px) {
    body.pon-has-alarm-tabs .pon-brand {
        display: none !important;
    }
}

@media (max-width: 1199.98px) {
    body.app-default {
        --kt-app-header-height: 60px;
        --kt-app-header-height-actual: 60px;
    }

    .app-default #kt_app_header_container {
        min-height: 56px;
        padding-top: 0;
        padding-bottom: 0;
        gap: 0.5rem;
    }

    .app-default .pon-header-tabs .nav-link {
        min-height: 38px;
        font-size: 1.18rem;
        padding: 0.1rem 0.55rem;
    }
}

@media (min-width: 1200px) {
    .app-default .pon-header-tabs .nav-link {
        font-size: 1.48rem;
        font-weight: 700;
    }
}

@media (max-width: 991.98px) {
    /* The tab buttons take over the header, so the logo gives up its space. */
    body.pon-has-alarm-tabs .pon-brand {
        display: none;
    }

    .app-default .pon-brand-logo {
        height: 2.75rem;
    }

    /* The theme reserves a fixed 60px header, which the button grid outgrows,
       so the header goes back in flow and sticks instead. */
    body.pon-has-alarm-tabs .app-header,
    body.pon-has-alarm-tabs .app-header .app-container {
        overflow: visible;
    }

    body.pon-has-alarm-tabs .app-header {
        position: sticky;
        height: auto;
    }

    body.pon-has-alarm-tabs .app-wrapper {
        margin-top: 0;
    }

    .app-default .pon-header-tabs {
        overflow: visible;
        box-shadow: none;
    }

    .app-default .pon-header-tabs #myTab {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        gap: 0.3rem;
        padding: 0.35rem;
    }

    .app-default .pon-header-tabs .nav-item:last-child {
        grid-column: 1 / -1;
    }

    .app-default .pon-header-tabs .nav-link {
        justify-content: center;
        width: 100%;
        min-height: 34px;
        gap: 0.3rem;
        padding: 0.25rem 0.4rem;
        border: 1px solid var(--pon-border);
        border-radius: 0.5rem;
        background: var(--pon-surface-muted);
        font-size: 0.86rem;
    }

    .app-default .pon-header-tabs .nav-link.active {
        border-color: var(--pon-link);
        background: var(--pon-link-soft);
    }

    /* Long names give way to the count rather than spilling out of the pill. */
    .app-default .pon-header-tabs .nav-link > span:first-child {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .app-default .pon-tab-count {
        flex: 0 0 auto;
        min-width: 1.35rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 575.98px) {
    .app-default .pon-dashboard-utilities {
        align-items: stretch !important;
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }

    .app-default .pon-dashboard-utilities > :last-child {
        width: 100%;
    }
}

/* ---------------------------------------------------------------------------
   Cross-tab alarm search

   The box sits at the right-hand end of the header nav, so it takes no vertical
   space of its own and the match summary floats beneath it as a popover.
   --------------------------------------------------------------------------- */

/* Shrinks faster than the tab strip beside it: on a narrow header a readable
   tab label matters more than a wide search box. */
.pon-header-search {
    flex: 0 3 20rem;
    min-width: 9rem;
}

.pon-alarm-search {
    position: relative;
    margin: 0;
}

.pon-alarm-search-input {
    width: 100%;
    background-color: var(--pon-input);
    border-color: var(--pon-border);
    color: var(--pon-text);
}

.pon-alarm-search-input::placeholder {
    color: var(--pon-text-muted);
}

.pon-alarm-search-input:focus {
    background-color: var(--pon-input);
    border-color: var(--pon-link);
    color: var(--pon-text);
    box-shadow: 0 0 0 0.2rem var(--pon-link-soft);
}

/* Floated out of flow so it can never change the height of the header, and
   hidden entirely when empty rather than reserving a blank line. */
.pon-alarm-search-summary {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    z-index: 1045;
    width: max-content;
    max-width: min(26rem, 88vw);
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--pon-border);
    border-radius: 0.4rem;
    background: var(--pon-surface);
    box-shadow: var(--pon-shadow);
    color: var(--pon-text-muted);
    font-size: 0.85rem;
    line-height: 1.35;
}

.pon-alarm-search-summary:empty {
    display: none;
}

/* An empty badge would otherwise show as a stray dot on the Acknowledged tab. */
.pon-tab-count:empty {
    display: none;
}

#myTab .nav-link.pon-tab-no-match {
    opacity: 0.45;
}

#timer.is-paused {
    color: var(--pon-text-muted);
}

.pon-refresh.is-paused .pon-refresh-time {
    opacity: 0.5;
}

/* ---------------------------------------------------------------------------
   DataTables, themed to match the rest of the dashboard

   Paging, page-length and info are all switched off, so the only chrome here is
   the sort arrows. Collapse any empty layout rows DataTables still emits.
   --------------------------------------------------------------------------- */

.pon-alarm-table-wrap .dt-container {
    color: var(--pon-text);
    font-size: 0.85rem;
}

.pon-alarm-table-wrap .dt-layout-row {
    align-items: center;
    margin: 0;
}

.pon-alarm-table-wrap .dt-layout-row:empty,
.pon-alarm-table-wrap .dt-layout-cell:empty {
    display: none;
}

/* Keep the sort arrows legible against the dark table header. */
.pon-alarm-table thead th.dt-orderable-asc,
.pon-alarm-table thead th.dt-orderable-desc,
.pon-alarm-table thead th.dt-ordering-asc,
.pon-alarm-table thead th.dt-ordering-desc {
    cursor: pointer;
}

.pon-alarm-table thead th .dt-column-order::before,
.pon-alarm-table thead th .dt-column-order::after {
    color: inherit;
    opacity: 0.5;
}

.pon-alarm-table thead th.dt-ordering-asc .dt-column-order::before,
.pon-alarm-table thead th.dt-ordering-desc .dt-column-order::after {
    opacity: 1;
}

.pon-alarm-table-wrap .dt-empty {
    color: var(--pon-text-muted);
}

/* ---------------------------------------------------------------------------
   "Signed in as", above the logout link at the foot of the dashboards
   --------------------------------------------------------------------------- */

.pon-signed-in {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    min-width: 0;
    font-size: 0.85rem;
}

/* Matches .pon-refresh-label so the footer column reads as one stack. */
.pon-signed-in-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--pon-text-muted);
}

.pon-signed-in-name {
    max-width: 18rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--pon-text);
    font-weight: 600;
}

.app-default .pon-dashboard-utilities .pon-signed-in {
    font-size: 1.02rem;
}

/* The classic layout has no page container, so its footer sets its own gutter.
   Everything that is not an alarm lives down here: the refresh countdown and
   who you are on the left, the UI and theme switches on the right. */
.pon-legacy-utilities {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 1rem 0.9rem;
}

.pon-legacy-session {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    min-width: 0;
}

.pon-legacy-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* ---------------------------------------------------------------------------
   Classic dashboard header

   A single row: the tab strip, then the search box at its right-hand end. The
   tabs are the point of the screen, so they get the width and the search box
   gives it up, first by shrinking and then by disappearing altogether.
   --------------------------------------------------------------------------- */

.pon-legacy-header {
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 1rem;
    padding-bottom: 0;
}

.pon-legacy-header #myTab {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.pon-legacy-header .pon-header-search {
    flex: 0 1 18rem;
    margin-left: auto;
    /* Lifts the box clear of the tab underline the row ends on. */
    padding-bottom: 0.4rem;
}

@media (max-width: 1199.98px) {
    .pon-legacy-header .pon-header-search {
        flex-basis: 12rem;
        min-width: 8rem;
    }
}

@media (max-width: 991.98px) {
    .pon-legacy-header .pon-header-search {
        display: none;
    }
}

/* ---------------------------------------------------------------------------
   Header search placement
   --------------------------------------------------------------------------- */

/* Below the breakpoint where the header collapses to a hamburger, the search
   drops onto a line of its own rather than fighting the tabs for width. */
@media (max-width: 1199.98px) {
    body.pon-has-alarm-tabs #kt_app_header_container {
        flex-wrap: wrap;
    }

    body.pon-has-alarm-tabs .pon-header-search {
        order: 1;
        flex: 1 1 100%;
        margin-left: 0 !important;
    }
}

@media (max-width: 767.98px) {
    .pon-header-search {
        flex: 1 1 100%;
        margin-left: 0 !important;
    }

    .pon-signed-in-name {
        max-width: 12rem;
    }
}
