/*
 * CQM - the 1310 look, with a few nods to the original FireBrick chrome.
 *
 * Replaces the ported FireBrick stylesheets (fb.css / preset.css / style.css).
 * Palette and type come from the 1310 design system: navy header/footer, mist
 * panels, blue accent, Poppins. What stays FireBrick: the left sidebar layout,
 * the FireBrick mark beside the 1310 logo, the red gradient strip (the old
 * header's colours) along the top of the header and bottom of the footer, and
 * "ember" red reserved for FireBrick-sourced signals (live dot, active
 * firebrick tab, destructive actions).
 *
 * Loaded after Tailwind's compiled CSS (see partials/head.blade.php), so the
 * rules here win ties against Preflight's bare-element resets, while Tailwind
 * utility classes on the admin/profile pages (one class = higher specificity
 * than a bare element) still win over the element defaults set here.
 */

:root {
    --navy: #172d36;
    --blue: #27aae1;
    --mist: #eaf2f6;
    --mist-dark: #d3e4ed;
    --grey: #58595b;
    --black: #070807;
    --line: #d3dde2;
    /* Form control borders: the design system's #ccc is 1.6:1 on white. */
    --control: #6f7f86;
    --field: #fafafa;
    --charcoal: #272727;
    --ember: #bd1220;
    --font: Poppins, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    min-width: 20em;
    font-family: var(--font);
    font-weight: 300;
    line-height: 1.6;
    color: #000;
    background: #fff;
}

[x-cloak] {
    display: none !important;
}

a {
    color: var(--navy);
    text-decoration: underline;
    text-decoration-color: var(--blue);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

a:hover {
    color: var(--black);
    text-decoration-color: var(--navy);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--navy);
    outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* App shell                                                          */
/* ------------------------------------------------------------------ */

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    background: var(--navy);
    color: #fff;
}

.app-header-strip,
.app-footer-strip {
    height: 4px;
    background: linear-gradient(90deg, #dd1750 0%, #a30d08 100%);
}

.app-footer-strip {
    background: linear-gradient(90deg, #a30d08 0%, #dd1750 100%);
}

.app-header-bar {
    display: flex;
    align-items: center;
    gap: 12px 28px;
    min-height: 56px;
    box-sizing: border-box;
    padding: 6px 4vw;
}

.brand-logo {
    display: flex;
    align-items: center;
}

.brand-logo img {
    display: block;
    height: 28px;
    width: auto;
}

.brand-divider {
    width: 1px;
    height: 26px;
    background: #fff;
    opacity: 0.3;
}

.brand-fb {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
    font-size: 17px;
    font-weight: 500;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.brand-fb img {
    display: block;
    width: 24px;
    height: 19px;
}

.app-header a:focus-visible,
.app-footer a:focus-visible {
    outline-color: var(--blue);
}

.mobilemenu {
    display: none;
    position: relative;
    flex: none;
    width: 35px;
    height: 25px;
    margin-left: auto;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.mobilemenu::before,
.mobilemenu::after,
.mobilemenu span {
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: #fff;
    transform-origin: left;
    transition: all 300ms ease;
}

.mobilemenu::before {
    top: 0;
}

.mobilemenu span {
    top: 11px;
}

.mobilemenu::after {
    bottom: 0;
}

.mobilemenu.active span {
    opacity: 0;
}

.mobilemenu.active::before {
    top: -1px;
    transform: rotate(45deg);
}

.mobilemenu.active::after {
    transform: rotate(-45deg);
}

.app-body {
    display: flex;
    flex: 1 1 auto;
}

.sidebar {
    flex: 0 0 248px;
    box-sizing: border-box;
    background: var(--mist);
}

.app-main {
    flex: 1 1 0;
    min-width: 0;
    box-sizing: border-box;
    padding: 28px 4vw 56px;
    word-wrap: break-word;
}

.app-main-inner {
    max-width: 1120px;
}

.app-footer {
    background: var(--navy);
    color: #cfdde3;
    font-size: 13px;
    line-height: 22px;
}

.app-footer-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 32px;
    box-sizing: border-box;
    padding: 26px 4vw;
}

.app-footer p {
    margin: 0;
}

.app-footer a,
.app-footer a:hover {
    color: var(--blue);
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}

@media screen and (max-width: 768px) {
    .app-body {
        flex-direction: column;
    }

    .sidebar {
        display: none;
        flex-basis: auto;
    }

    .sidebar.active {
        display: block;
    }

    .mobilemenu {
        display: block;
    }

    .app-main {
        padding: 28px 20px 56px;
    }

    .brand-divider {
        display: none;
    }

    .brand-logo img {
        height: 28px;
    }
}

/* ------------------------------------------------------------------ */
/* Sidebar                                                            */
/* ------------------------------------------------------------------ */

.menu {
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-sizing: border-box;
    padding: 28px 14px 32px;
}

.menu ul {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.menu li {
    margin: 0;
}

.menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 6.4px;
    color: var(--navy);
    font-size: 15px;
    font-weight: 400;
    text-decoration: none;
}

.menu a:hover {
    background: var(--mist-dark);
    color: var(--navy);
}

.menu li.current > a,
.menu li.current > a:hover {
    background: var(--navy);
    color: #fff;
    font-weight: 500;
}

.menu svg {
    flex: none;
}

.menu-label {
    padding: 22px 14px 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--grey);
}

.menu-label:first-child {
    padding-top: 0;
}

.menu li.menu-recent > a {
    display: block;
    min-height: 36px;
    line-height: 36px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 300;
}

.menu-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 22px 14px 6px;
    border: 0;
    background: none;
    font: 500 12px/1.6 var(--font);
    color: var(--grey);
    cursor: pointer;
}

.menu-group-toggle:hover {
    color: var(--black);
}

.menu-group-toggle .arrow {
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 150ms ease;
}

.menu-group-toggle[aria-expanded="true"] .arrow {
    transform: rotate(225deg);
}

.menu ul.submenu a {
    min-height: 38px;
    padding-left: 46px;
    font-size: 14px;
    font-weight: 300;
}

.menu ul.submenu {
    display: none;
}

.menu ul.submenu.active {
    display: flex;
}

.menu-account {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-top: 28px;
    padding: 18px 14px 0;
    border-top: 1px solid #c4d6df;
    font-size: 14px;
}

.menu-account-name {
    font-weight: 500;
    color: var(--navy);
}

.menu-account a {
    display: inline;
    min-height: 0;
    padding: 0;
    border-radius: 0;
    background: none;
    font-size: 14px;
    font-weight: 300;
    text-decoration: underline;
    text-decoration-color: var(--blue);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.menu-account a:hover {
    background: none;
}

.link-button {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: var(--navy);
    text-decoration: underline;
    text-decoration-color: var(--blue);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    cursor: pointer;
}

.link-button:hover {
    color: var(--black);
    text-decoration-color: var(--navy);
}

.menu-account .link-button {
    min-height: 32px;
    font-weight: 300;
}

/* ------------------------------------------------------------------ */
/* Page furniture                                                     */
/* ------------------------------------------------------------------ */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 12px;
}

.page-head-main {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 20px;
}

.page-title {
    margin: 0;
    font-size: 32px;
    line-height: 40px;
    font-weight: 500;
    color: var(--navy);
    overflow-wrap: anywhere;
}

.page-title.is-detail {
    font-size: 30px;
    line-height: 38px;
}

.page-sub {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin: 2px 0 0;
    font-size: 14px;
    line-height: 22px;
    color: var(--grey);
}

.page-sub strong {
    font-weight: 500;
    color: #000;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--grey);
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stack-tight {
    gap: 12px;
}

.live-dot {
    display: inline-block;
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ember);
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--navy);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 2px;
    background: var(--mist);
    color: var(--navy);
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
}

.chip-strong {
    background: var(--navy);
    color: #fff;
    letter-spacing: 0.3px;
}

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

.notice {
    padding: 14px 20px;
    background: var(--mist);
    color: var(--navy);
    font-size: 14px;
    line-height: 24px;
}

.notice strong {
    font-weight: 500;
}

.result-count {
    font-weight: 500;
    color: #000;
}

.filter-loading {
    color: var(--grey);
    font-style: italic;
}

.reset-link {
    min-height: 36px;
    padding: 0 4px;
    border: 0;
    background: none;
    font: 500 14px var(--font);
    color: var(--navy);
    text-decoration: underline;
    text-decoration-color: var(--blue);
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
    cursor: pointer;
}

.results-loading {
    opacity: 0.45;
    transition: opacity 0.15s 0.1s;
}

/* ------------------------------------------------------------------ */
/* Firebrick tabs                                                     */
/* ------------------------------------------------------------------ */

.fb-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
    border-bottom: 1px solid var(--line);
}

.fb-tabs button {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    margin: 0 0 -1px;
    padding: 6px 18px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    font: 400 15px/1.2 var(--font);
    color: var(--grey);
    white-space: nowrap;
    cursor: pointer;
}

/* The FireBrick mark, tinted with the tab's own text colour. */
.fb-tabs button::before {
    content: "";
    flex: none;
    width: 18px;
    height: 14px;
    background: currentColor;
    -webkit-mask: url("../images/fbwhite.svg") center / contain no-repeat;
    mask: url("../images/fbwhite.svg") center / contain no-repeat;
}

.fb-tabs button:hover {
    background: var(--mist);
    color: var(--black);
}

.fb-tabs button.active {
    border-bottom-color: var(--ember);
    color: var(--navy);
    font-weight: 500;
}

/* ------------------------------------------------------------------ */
/* Filters, segmented controls, pagination                            */
/* ------------------------------------------------------------------ */

.filter-bar,
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px 12px;
    padding: 10px 16px 12px;
    background: var(--mist);
}

.pagination {
    gap: 12px 16px;
    padding: 12px 16px;
}

/* Buttons, page count and selects share one 40px row, bottom-aligned with the
   selects (whose labels sit above them). */
.pagination .btn-sm {
    min-height: 40px;
    padding: 0 16px;
    font-size: 13px;
}

.pagination > span {
    align-self: flex-end;
    min-width: 84px;
    line-height: 40px;
    text-align: center;
    font-size: 14px;
    font-weight: 400;
}

.field {
    display: flex;
    flex-direction: column;
}

.field-search {
    flex: 1 1 140px;
}

.filter-bar label,
.filter-bar .field-label,
.pagination .field label,
.label {
    display: block;
    margin: 0 0 2px;
    padding: 0;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--grey);
}

.filter-bar select,
.pagination select,
.filter-bar input[type="search"],
.input {
    box-sizing: border-box;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--control);
    border-radius: 2px;
    background-color: var(--field);
    font: 400 14px var(--font);
    color: #000;
    box-shadow: none;
}

.filter-bar select,
.pagination select {
    min-width: 110px;
    padding-right: 36px;
}

.filter-bar input[type="search"] {
    width: 100%;
    padding-right: 34px;
}

.input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    font-size: 15px;
}

textarea.input {
    height: auto;
    padding: 10px 14px;
}

.filter-bar select:focus,
.pagination select:focus,
.filter-bar input[type="search"]:focus,
.input:focus {
    border-color: var(--navy);
    box-shadow: none;
}

.filter-bar input[type="search"]::-webkit-search-cancel-button,
.filter-bar input[type="search"]::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
}

.filter-bar #date {
    width: 12em;
    min-width: 0;
}

.pagination #jumpDate {
    min-width: 200px;
}

.pagination #perPage {
    min-width: 8em;
}

.search-wrap {
    position: relative;
}

.search-clear {
    position: absolute;
    right: 4px;
    bottom: 6px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--grey);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.page-head-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 20px;
}

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 40px;
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    color: #000;
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--navy);
}

.check input {
    width: 20px;
    height: 20px;
    margin: 0;
}

.seg {
    display: inline-flex;
    box-sizing: border-box;
    border: 1px solid var(--control);
    border-radius: 2px;
    background: #fff;
    overflow: hidden;
}

.seg button {
    height: 38px;
    padding: 0 11px;
    border: 0;
    background: transparent;
    font: 400 14px var(--font);
    color: #000;
    cursor: pointer;
}

.seg button:hover {
    background: var(--mist);
}

.seg button.active,
.seg button.active:hover {
    background: var(--navy);
    color: #fff;
    font-weight: 500;
}

/*
 * Jump list: a floating button at the right edge that opens a vertical list
 * of groups, so it is reachable from anywhere in a long page without taking
 * a row of space at the top.
 */
.jump-pop {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.jump-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border: 0;
    border-radius: 2px;
    background: var(--navy);
    color: #fff;
    font: 500 14px var(--font);
    box-shadow: 0 4px 16px rgba(23, 45, 54, 0.3);
    cursor: pointer;
}

.jump-toggle:hover {
    background: #070807;
}

.jump-toggle:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.jump-panel {
    box-sizing: border-box;
    width: 260px;
    max-width: calc(100vw - 32px);
    max-height: min(60vh, 480px);
    overflow-y: auto;
    padding: 8px 0;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: 0 8px 24px rgba(23, 45, 54, 0.25);
}

.jump-label {
    margin: 0;
    padding: 6px 16px 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--grey);
}

.jump-panel ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.jump-panel a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 40px;
    padding: 0 16px;
    font-size: 14px;
    font-weight: 400;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.jump-panel a:hover {
    background: var(--mist);
}

.jump-panel .count {
    flex: none;
    font-size: 12px;
    color: var(--grey);
}

/*
 * Sticky filter bar (desktop) with the current group's heading pinned just
 * beneath it. --filter-h is measured in the page (see index.blade.php); the
 * heading only sticks inside its own group, so the next group's heading
 * pushes it away.
 */
@media screen and (min-width: 769px) {
    .filter-bar {
        position: sticky;
        top: 0;
        z-index: 20;
        box-shadow: 0 1px 0 var(--line);
    }
}

.group-heading {
    position: sticky;
    top: 0;
    z-index: 10;
    margin-top: 0;
    padding-top: 12px; /* white, so graphs scrolling underneath never show in the gap */
    background: #fff;
}

@media screen and (min-width: 769px) {
    .group-heading {
        top: var(--filter-h, 72px);
        scroll-margin-top: var(--filter-h, 72px);
    }
}

@media screen and (max-width: 768px) {
    .filter-bar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        padding: 20px;
    }

    .filter-bar .field-search,
    .filter-bar .field:has(.seg),
    .filter-bar .check {
        grid-column: 1 / -1;
    }

    .filter-bar select {
        width: 100%;
        min-width: 0;
    }

    .seg {
        display: flex;
    }

    .seg button {
        flex: 1;
        padding: 0 4px;
    }
}

/* ------------------------------------------------------------------ */
/* Graph cards                                                        */
/* ------------------------------------------------------------------ */

.group-heading {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 4px 0 0;
    padding-bottom: 4px;
    border-bottom: 2px solid var(--navy);
    font-size: 18px;
    line-height: 26px;
    font-weight: 500;
    color: var(--navy);
}

.group-count {
    font-size: 13px;
    font-weight: 300;
    color: var(--grey);
}

.graph-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.graph-card {
    box-sizing: border-box;
    background: #fff;
    border: 1px solid var(--line);
}

.graph-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 2px 16px;
    padding: 6px 16px 2px;
}

.graph-card-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    min-width: 0;
}

.graph-card-heading .chip {
    min-height: 20px;
    padding: 0 8px;
    font-size: 11px;
}

/* Context tag: a quiet label ahead of the name, not a badge competing with it. */
.graph-card-heading .chip-quiet {
    min-height: 18px;
    padding: 0 6px;
    background: var(--mist);
    color: var(--grey);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.6px;
}

.graph-card-note {
    margin-left: 10px;
    font-size: 13px;
    font-weight: 300;
    color: var(--grey);
}

.graph-card-title {
    margin: 0;
    font-size: 15px;
    line-height: 24px;
    font-weight: 500;
    color: var(--navy);
    overflow-wrap: anywhere;
}

.graph-card-links {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 13px;
    font-weight: 500;
}

.icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--navy);
    text-decoration: none;
}

.icon-link:hover {
    background: var(--mist);
    color: #000;
}

.icon-link:focus-visible {
    outline: 2px solid var(--navy);
    outline-offset: 1px;
}

.graph-card-body {
    padding: 0 16px 8px;
}

button.icon-link {
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

button.icon-link:hover {
    background: var(--mist);
}

/* Share link: truncated so the table stays compact; the full URL is the tooltip. */
.share-link-cell {
    display: flex;
    align-items: center;
    gap: 4px;
}

.share-link {
    display: block;
    min-width: 0;
    max-width: 20rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.share-copied {
    font-size: 13px;
    color: var(--grey);
}

.graph-card-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    padding: 14px 24px 18px;
    font-size: 13px;
    line-height: 20px;
    color: var(--grey);
}

/*
 * The graph itself is a 1005x116 image rendered by the FireBrick. The frame
 * reserves that box up front so nothing below it jumps while it loads (see
 * resources/views/components/graph/image.blade.php). On a phone it scales
 * down to the screen width so the whole day is visible.
 */
.graph-scroll {
    overflow-x: auto;
}

/* The frame is the click target for the lightbox. */
.graph-zoom {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
}

.graph-zoom:focus-visible {
    outline: 2px solid var(--navy);
    outline-offset: 2px;
}

.graph-frame {
    display: block;
    width: 100%;
    max-width: 1005px; /* the FireBrick's native width: never upscale it */
    aspect-ratio: 1005 / 116;
    background-color: var(--mist);
}

img.cqm {
    display: block;
    width: 100%;
    height: auto;
}

@media screen and (max-width: 768px) {
    /* Name on the left, icons pinned right on the same row; a long name wraps
       inside its own column instead of pushing the icons onto a second line. */
    .graph-card-head {
        flex-wrap: nowrap;
        align-items: flex-start;
        padding: 8px 12px 4px;
    }

    .graph-card-heading {
        flex: 1 1 auto;
    }

    .graph-card-title {
        font-size: 13px;
        line-height: 20px;
    }

    /* One title line tall (20px) so the icons sit on the first line's centre
       whether or not a long name wraps; the pseudo-element keeps the tap area
       taller than the visible button. */
    .graph-card-links .icon-link {
        position: relative;
        width: 28px;
        height: 20px;
    }

    .graph-card-links .icon-link::after {
        content: "";
        position: absolute;
        inset: -6px 0;
    }

    .graph-card-links .icon-link svg {
        width: 15px;
        height: 15px;
    }

    .graph-card-links {
        flex: none;
    }

    .graph-card-body {
        padding: 0 12px 8px;
    }

    .graph-card-foot {
        padding: 12px 16px 16px;
    }
}

/* ------------------------------------------------------------------ */
/* Detail page                                                        */
/* ------------------------------------------------------------------ */

/*
 * Information section: one mist panel with a column per source section
 * (Network / Customer / Service / Session ...), label beside value, so it
 * takes a fraction of the height the old stack of tall cards did and the first
 * graph is visible without scrolling.
 */
.detail-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
}

#details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 18px 32px;
    padding: 16px 24px 18px;
    background: var(--mist);
}

.detail-card {
    min-width: 0;
}

.detail-card h4 {
    margin: 0 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #c3d2d9;
    font-size: 14px;
    line-height: 22px;
    font-weight: 600;
    color: var(--navy);
}

.detail-card dl {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 2px 8px;
    align-items: baseline;
    margin: 0;
}

.detail-card dt {
    font-size: 12px;
    font-weight: 500;
    color: var(--grey);
}

.detail-card dd {
    margin: 0;
    min-width: 0;
    font-size: 14px;
    line-height: 22px;
    font-weight: 400;
    overflow-wrap: anywhere;
}

.section-heading {
    margin: 8px 0 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--navy);
    font-size: 20px;
    line-height: 28px;
    font-weight: 500;
    color: var(--navy);
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 2px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
}

.pill-success { background: #d7f0dd; color: #14602a; }
.pill-danger { background: #f8d7da; color: #8a1320; }
.pill-warning { background: #fff0c2; color: #7a5a00; }
.pill-neutral { background: #fff; color: var(--navy); }

/* Clickable on/off state in admin tables (a <button> styled as a pill). */
.pill-toggle {
    min-width: 0;
    margin: 0;
    padding: 0 10px;
    border: 0;
    cursor: pointer;
}

.pill-toggle:hover {
    filter: brightness(0.95);
}

/* Missing graphs: collapsed by default, it's diagnostics, not content. */
.missing-graphs-section {
    margin-top: 12px;
    padding: 16px 24px;
    background: var(--mist);
}

.missing-graphs-section summary {
    display: flex;
    align-items: center;
    min-height: 44px;
    font-size: 15px;
    font-weight: 500;
    color: var(--navy);
    cursor: pointer;
}

.missing-graphs-section p {
    margin: 8px 0 12px;
    font-size: 14px;
}

.missing-graphs-scroll {
    max-height: 300px;
    overflow: auto;
}

table.config {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    font-weight: 400;
}

table.config th {
    padding: 10px 12px;
    border-bottom: 1px solid var(--control);
    text-align: left;
    font-weight: 500;
    white-space: nowrap;
}

table.config td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.missing-graphs-section th {
    position: sticky;
    top: 0;
    background: var(--mist);
}

.targets-table-wrap {
    overflow-x: auto;
}

/* ------------------------------------------------------------------ */
/* Buttons                                                            */
/* ------------------------------------------------------------------ */

/* Primary: blue with near-black text (white on blue is 2.65:1). */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 0;
    min-height: 48px;
    margin: 0;
    padding: 0 28px;
    border: 2px solid transparent;
    border-radius: 6.4px;
    font: 500 14.56px/1.25 var(--font);
    letter-spacing: 0.29px;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.15s, background-color 0.15s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.btn-primary,
.btn-primary:hover {
    background: var(--blue);
    border-color: var(--blue);
    color: var(--black);
}

.btn-primary:hover:not(:disabled) {
    opacity: 0.85;
}

.btn-secondary,
.btn-secondary:hover {
    background: transparent;
    border-color: var(--navy);
    color: var(--navy);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--mist);
}

.btn-danger,
.btn-danger:hover {
    background: transparent;
    border-color: var(--ember);
    color: var(--ember);
}

.btn-danger:hover:not(:disabled) {
    background: var(--ember);
    border-color: var(--ember);
    color: #fff;
}

.btn-dark,
.btn-dark:hover {
    background: var(--charcoal);
    border-color: var(--charcoal);
    color: #fff;
}

.btn-dark:hover:not(:disabled) {
    opacity: 0.85;
}

.btn-block {
    display: flex;
    width: 100%;
    min-height: 52px;
}

.btn-sm {
    min-height: 36px;
    padding: 0 14px;
    font-size: 12px;
    letter-spacing: 0.24px;
}

/* ------------------------------------------------------------------ */
/* Admin helpers (view modals, run status, failing rows)              */
/* ------------------------------------------------------------------ */

.status-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--ember);
    vertical-align: middle;
}

.kv-list {
    border: 1px solid var(--line);
    font-size: 14px;
}

.kv-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 12px;
}

.kv-row + .kv-row {
    border-top: 1px solid var(--line);
}

.kv-row dt {
    flex-shrink: 0;
    color: var(--grey);
}

.kv-row dd {
    min-width: 0;
    text-align: right;
    overflow-wrap: anywhere;
}

.modal-heading {
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--grey);
}

.run-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px;
    background: var(--mist);
    font-size: 14px;
}

.run-bar-error {
    margin-top: 4px;
    font-size: 13px;
    color: #8a1320;
    overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ */
/* Sign in and other guest pages                                      */
/* ------------------------------------------------------------------ */

.guest-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 48px 4vw 128px;
    background: var(--navy);
    color: #fff;
    text-align: center;
}

.guest-hero h1 {
    margin: 0;
    font-size: 52px;
    line-height: 62px;
    font-weight: 500;
}

.guest-hero p {
    margin: 0;
    font-size: 17px;
    line-height: 28px;
    color: #dbe7ec;
}

.guest-body {
    display: flex;
    flex: 1 1 auto;
    align-items: flex-start;
    justify-content: center;
    padding: 0 4vw 96px;
    background: var(--mist);
}

.guest-card {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    box-sizing: border-box;
    width: 100%;
    max-width: 440px;
    margin-top: -72px;
    padding: 40px;
    background: #fff;
}

.guest-card details {
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.guest-card summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    border-radius: 6.4px;
    list-style: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--navy);
    cursor: pointer;
}

.guest-card summary::-webkit-details-marker {
    display: none;
}

.guest-card summary:hover {
    background: var(--mist);
}

.guest-card details[open] .chev {
    transform: rotate(180deg);
}

.guest-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.guest-note {
    margin: 0;
    font-size: 13px;
    line-height: 22px;
    color: var(--grey);
    text-align: center;
}

.guest-card .error-text,
.input-error {
    font-size: 13px;
    color: #8a1320;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 32px;
    font-size: 14px;
    font-weight: 400;
}

.check-row input {
    width: 20px;
    height: 20px;
    margin: 0;
}

/* ------------------------------------------------------------------ */
/* Public share page (customer-facing)                                */
/* ------------------------------------------------------------------ */

.public-header {
    display: flex;
    align-items: center;
    box-sizing: border-box;
    min-height: 76px;
    padding: 0 max(20px, 4vw);
    background: var(--navy);
}

.public-header img {
    display: block;
    height: 32px;
    width: auto;
}

.public-main {
    flex: 1 1 auto;
}

.public-hero {
    padding: 32px max(20px, 4vw) 28px;
    background: var(--mist);
}

.public-hero p {
    margin: 0 0 8px;
    font-size: 16px;
    line-height: 24px;
    font-weight: 500;
    color: var(--navy);
}

.public-hero p.public-ip {
    margin: 4px 0 0;
    font-size: 16px;
    font-weight: 400;
    color: var(--grey);
}

.public-hero h1 {
    margin: 0;
    max-width: 1120px;
    font-size: 30px;
    line-height: 40px;
    font-weight: 500;
    color: var(--navy);
    overflow-wrap: anywhere;
}

.public-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1120px;
    box-sizing: border-box;
    padding: 24px max(20px, 4vw) 48px;
}

.public-hint {
    margin: 0;
    font-size: 14px;
    line-height: 22px;
    color: var(--grey);
}

.public-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 28px max(20px, 4vw) 32px;
    background: var(--navy);
    color: #fff;
    font-size: 14px;
    line-height: 24px;
}

.public-footer p {
    margin: 0;
}

.public-footer .contact {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.public-footer a,
.public-footer a:hover {
    color: var(--blue);
    font-weight: 400;
    text-decoration: none;
}

.public-footer a:hover {
    text-decoration: underline;
}

.public-footer .legal {
    margin-top: 8px;
    font-size: 12px;
    line-height: 20px;
    color: #cfdde3;
}

@media screen and (min-width: 769px) {
    .public-hero h1 {
        font-size: 36px;
        line-height: 44px;
    }

    .public-hint {
        display: none;
    }

    .public-footer {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
    }

    .public-footer .legal {
        margin-top: 0;
    }
}

/* ------------------------------------------------------------------ */
/* Graph lightbox                                                     */
/* ------------------------------------------------------------------ */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    background: rgba(7, 8, 7, 0.82);
}

.lightbox-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 24px;
    padding: 14px 16px;
    background: var(--navy);
    color: #fff;
    border-top: 3px solid var(--ember);
}

/* A title that is also a link keeps the look of a plain title. */
.title-link {
    color: inherit;
    text-decoration: none;
}

.lightbox-heading {
    flex: 1 1 280px;
    min-width: 0;
}

.lightbox-title {
    margin: 0;
    font-size: 22px;
    line-height: 30px;
    font-weight: 500;
    color: #fff;
    overflow-wrap: anywhere;
}

.lightbox-date {
    margin: 2px 0 0;
    font-size: 14px;
    line-height: 22px;
    color: #cfdde3;
}

.lightbox-tools,
.lightbox-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.lightbox-btn,
.lightbox-select {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 2px;
    background: transparent;
    color: #fff;
    font: 500 14px var(--font);
    text-decoration: none;
    cursor: pointer;
}

.lightbox-select {
    max-width: 210px;
    padding-right: 8px;
    background: var(--navy);
    font-weight: 400;
}

.lightbox-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
}

.lightbox-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.lightbox-btn:focus-visible,
.lightbox-select:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.lightbox-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 40px;
    height: 40px;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.lightbox-close:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

@media screen and (max-width: 768px) {
    .lightbox-title {
        font-size: 17px;
        line-height: 24px;
    }

    .lightbox-tools {
        width: 100%;
    }

    .lightbox-select {
        flex: 1 1 120px;
        min-width: 0;
    }
}

.lightbox-body {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 16px 16px;
    overflow: auto;
}

/* White card so the graph's transparent areas read as they do on the page. */
.lightbox-img {
    display: block;
    flex: none;
    width: min(100%, 2200px);
    min-width: 1005px;
    height: auto;
    margin: 0 auto;
    background: #fff;
}

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