/*
 * The look of the panel: a dark, high-contrast control room that stays legible
 * on a wall monitor and on a phone.  Colours come from tokens; the palette
 * (data-palette on <html>) decides how saturated the status colours are.
 */

:root {
    --rail-w: 216px;
    --radius: 16px;
    --radius-sm: 10px;
    --gap: 16px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    --f7-page-bg-color: var(--bg);
    --f7-bars-bg-color: transparent;
    --f7-bars-border-color: transparent;
    --f7-theme-color: var(--accent);
}

/* ------------------------------------------------------------- palettes -- */

html[data-palette] {
    --ok: #22c55e;
    --degraded: #f59e0b;
    --scrambled: #a855f7;
    --stub: #06b6d4;
    --off: #f43f5e;
    --locked: #22c55e;
    --unlocked: #f43f5e;
    --unknown: #64748b;
    --fresh: #22c55e;
    --stale: #f59e0b;
    --dead: #ef4444;
    --accent: #6366f1;
    --accent-2: #22d3ee;
    --accent-3: #f472b6;
}

html[data-palette="calm"] {
    --ok: #2f7d5f;
    --degraded: #a8762a;
    --scrambled: #6d5aa8;
    --stub: #3a7f92;
    --off: #a4445c;
    --locked: #2f7d5f;
    --unlocked: #a4445c;
    --accent: #40527a;
    --accent-2: #3d7f92;
    --accent-3: #8a5a75;
}

/* dark is the default face of the panel */
html,
html.dark {
    --bg: #070b14;
    --bg-2: #0b1120;
    --surface: rgba(19, 27, 45, 0.72);
    --surface-solid: #121a2b;
    --surface-2: rgba(12, 18, 31, 0.6);
    --line: rgba(148, 163, 184, 0.16);
    --line-strong: rgba(148, 163, 184, 0.32);
    --text: #eaf1fb;
    --dim: #93a4bd;
    --shadow: 0 18px 45px rgba(2, 6, 16, 0.55);
    --glow: 0 0 0 1px rgba(99, 102, 241, 0.35), 0 12px 40px rgba(34, 211, 238, 0.12);
    --f7-text-color: var(--text);
    --page-glow:
        radial-gradient(1100px 620px at 12% -8%, rgba(99, 102, 241, 0.28), transparent 60%),
        radial-gradient(900px 520px at 92% 4%, rgba(34, 211, 238, 0.18), transparent 55%),
        radial-gradient(800px 600px at 60% 105%, rgba(244, 114, 182, 0.14), transparent 60%);
}

html:not(.dark) {
    --bg: #eef2fb;
    --bg-2: #e6ecf8;
    --surface: rgba(255, 255, 255, 0.82);
    --surface-solid: #ffffff;
    --surface-2: rgba(255, 255, 255, 0.6);
    --line: rgba(28, 43, 70, 0.14);
    --line-strong: rgba(28, 43, 70, 0.28);
    --text: #12203a;
    --dim: #55688a;
    --shadow: 0 16px 36px rgba(24, 43, 76, 0.12);
    --glow: 0 0 0 1px rgba(99, 102, 241, 0.22), 0 10px 30px rgba(99, 102, 241, 0.1);
    --f7-text-color: var(--text);
    --page-glow:
        radial-gradient(1100px 620px at 8% -10%, rgba(99, 102, 241, 0.22), transparent 60%),
        radial-gradient(900px 520px at 95% 0%, rgba(34, 211, 238, 0.2), transparent 55%);
}

/* ------------------------------------------------------------- the frame -- */

.sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

body {
    font-family: var(--font);
    background: var(--bg);
}

/*
 * The Framework7 bundle ships a bare "button { width: 100% }" rule (it suits the
 * framework's own card/list buttons).  Every control of the panel sizes to its
 * content unless a component of the panel says otherwise; the rule is here, in
 * the frame section, so that the components below can still widen a button.
 */
button {
    width: auto;
}

#app {
    background:
        radial-gradient(1100px 620px at 12% -8%, rgba(99, 102, 241, 0.28), transparent 60%),
        radial-gradient(900px 520px at 92% 4%, rgba(34, 211, 238, 0.18), transparent 55%),
        radial-gradient(800px 600px at 60% 105%, rgba(244, 114, 182, 0.14), transparent 60%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
    background-attachment: fixed;
}

html:not(.dark) #app {
    background:
        radial-gradient(1100px 620px at 8% -10%, rgba(99, 102, 241, 0.22), transparent 60%),
        radial-gradient(900px 520px at 95% 0%, rgba(34, 211, 238, 0.2), transparent 55%),
        linear-gradient(180deg, #f5f8ff 0%, var(--bg) 60%, var(--bg-2) 100%);
    background-attachment: fixed;
}

.views,
.view,
.page-content {
    background: transparent;
}

/*
 * Framework7 keeps the previous pages of the history stack inside the view
 * (swipe back), a page off the stack sits 24px aside.  A page therefore paints
 * its own background; a transparent one would show the page behind it.
 */
.page {
    background-color: var(--f7-page-bg-color);
    background-image: var(--page-glow);
}

.page-content {
    padding: 0;
    /*
     * The entrance of a page is ours, not Framework7's router transition: the
     * router ends its animation on the animationend event, which a browser that
     * asks to reduce motion never delivers (this file shortens every animation
     * away), and the page of the previous section then stays in the DOM.
     */
    animation: page-in 0.22s ease-out both;
}

.wrap {
    max-width: 1680px;
    margin: 0 auto;
    padding: 0 22px 60px;
}

.ic {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: none;
}

.ic-xs {
    width: 14px;
    height: 14px;
}

.ic-dim {
    color: var(--dim);
}

.muted {
    color: var(--dim);
}

.mono {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
}

code {
    font-family: var(--mono);
    font-size: 0.9em;
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--surface-2);
    border: 1px solid var(--line);
}

/* ----------------------------------------------------------- rail  nav -- */

.rail {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--rail-w);
    /*
     * The rail is the column the page is offset by (.views takes
     * margin-left: var(--rail-w)), so that number has to be the whole width of
     * the rail, its padding and border included.  Framework7 applies its
     * border-box reset to its own classes only: without it here the rail grows
     * by its padding, and the panel slides under the rail - every card of the
     * page is then cut along its left border.
     */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px 14px;
    z-index: 1200;
    background: var(--surface);
    border-right: 1px solid var(--line);
    backdrop-filter: blur(16px);
}

.rail-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 6px 14px;
    border-bottom: 1px solid var(--line);
}

.rail-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 8px 22px rgba(99, 102, 241, 0.4);
}

.rail-title {
    font-weight: 650;
    font-size: 14px;
    letter-spacing: 0.01em;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rail-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rail-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--dim);
    text-decoration: none;
    font-size: 14px;
    font-weight: 550;
    transition: background 0.16s ease, color 0.16s ease;
}

.rail-link:hover {
    color: var(--text);
    background: var(--surface-2);
}

.rail-link.active {
    color: var(--text);
    background: linear-gradient(120deg, rgba(99, 102, 241, 0.24), rgba(34, 211, 238, 0.12));
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.35);
}

.rail-foot {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.rail-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--dim);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.rail-btn:hover {
    color: var(--text);
}

/* a control of the rail is as wide as the rail: what does not fit is shortened,
   never pushed past the edge of the column */
.rail-btn span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* the language of the panel is switched here: two segments, the pressed one
   carries the language on screen, and both are the same width so switching
   never moves the rail around */
.rail-lang {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.rail-lang-btn {
    padding: 7px 0;
    border: 0;
    border-radius: calc(var(--radius-sm) - 2px);
    background: transparent;
    color: var(--dim);
    font: inherit;
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease;
}

.rail-lang-btn:hover {
    color: var(--text);
}

.rail-lang-btn.is-on {
    color: var(--text);
    background: linear-gradient(120deg, rgba(99, 102, 241, 0.24), rgba(34, 211, 238, 0.12));
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.35);
}

.rail-live {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface-2);
    font-size: 12px;
    color: var(--dim);
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--unknown);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--unknown) 25%, transparent);
}

.rail-live.tone-fresh .live-dot { background: var(--fresh); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fresh) 22%, transparent); }
.rail-live.tone-stale .live-dot { background: var(--stale); box-shadow: 0 0 0 3px color-mix(in srgb, var(--stale) 22%, transparent); }
.rail-live.tone-dead .live-dot { background: var(--dead); box-shadow: 0 0 0 3px color-mix(in srgb, var(--dead) 22%, transparent); animation: pulse 1.6s infinite; }

.live-text {
    min-width: 0;
    font-size: 12px;
    color: var(--dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


.rail-scrim {
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 16, 0.55);
    opacity: 0;
    pointer-events: none;
    z-index: 1100;
    transition: opacity 0.2s ease;
}

.rail-scrim.show {
    opacity: 1;
    pointer-events: auto;
}

@media (min-width: 1024px) {
    .views {
        margin-left: var(--rail-w);
        transition: margin-left 0.22s ease;
    }

    /* the rail is a column here, so the menu control folds it away instead of
       sliding it over the page: the tables get the whole screen */
    .rail {
        transition: transform 0.22s ease;
    }

    html.rail-hidden .rail {
        transform: translateX(-100%);
    }

    html.rail-hidden .views {
        margin-left: 0;
    }
}

@media (max-width: 1023px) {
    .rail {
        transform: translateX(-100%);
        transition: transform 0.22s ease;
    }

    .rail.open {
        transform: none;
    }
}

/* -------------------------------------------------------------- topbar -- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 0 14px;
    background: linear-gradient(180deg, var(--bg) 30%, color-mix(in srgb, var(--bg) 70%, transparent));
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    margin-bottom: 18px;
}

.topbar-title {
    flex: 1;
    min-width: 0;
}

.topbar-title h1 {
    margin: 0;
    font-size: 21px;
    font-weight: 680;
    letter-spacing: -0.01em;
}

.topbar-title p {
    margin: 3px 0 0;
    font-size: 12.5px;
    color: var(--dim);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--dim);
    cursor: pointer;
}

.icon-btn:hover {
    color: var(--text);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.btn-ghost:hover {
    border-color: var(--line-strong);
    background: var(--surface);
}

.btn-sm {
    padding: 7px 12px;
}

.btn.active {
    color: var(--text);
    border-color: color-mix(in srgb, var(--accent) 55%, transparent);
    background: color-mix(in srgb, var(--accent) 18%, transparent);
}

.btn .ic.spinning,
.btn.spinning .ic {
    animation: spin 0.9s linear infinite;
}

.nav-link {
    color: var(--accent-2);
    text-decoration: none;
    font-size: 13px;
}

.section-actions .nav-link {
    color: var(--dim);
}

.nav-link:hover {
    text-decoration: underline;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.dot-sep {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--line-strong);
    display: inline-block;
    margin: 0 6px;
}

/* ------------------------------------------------------------ sections -- */

.section {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    margin-bottom: var(--gap);
    overflow: hidden;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.section-head h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 640;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.section-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 12.5px;
}

.section-body {
    padding: 14px 16px;
    min-width: 0;
}

.section-body.table-wrap,
.section > .table-wrap {
    padding: 0;
}

.split {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--gap);
}

@media (min-width: 1200px) {
    /* the wide slot carries a table, the narrow one a list of text rows */
    .split {
        align-items: start;
    }

    .split.split-wide {
        grid-template-columns: 1.9fr 1fr;
    }

    .split {
        grid-template-columns: 1.35fr 1fr;
    }

    .split .section {
        margin-bottom: 0;
        min-width: 0;
    }

    .split {
        margin-bottom: var(--gap);
    }
}

/* ----------------------------------------------------------- accounts -- */

.rail-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--line);
}

.user-name {
    /* an operator names themselves whatever they like, and the rail is narrow:
       the name breaks instead of being cut, so it stays readable whole */
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    overflow-wrap: anywhere;
}

.rail-logout {
    flex: none;
    padding: 4px 6px;
}

/* --------------------------------------------------------------- login -- */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 24px;
    color: var(--text);
    background:
        radial-gradient(1100px 620px at 12% -8%, rgba(99, 102, 241, 0.3), transparent 60%),
        radial-gradient(900px 520px at 92% 4%, rgba(34, 211, 238, 0.2), transparent 55%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
    background-attachment: fixed;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 26px 24px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(14px);
    box-shadow: 0 24px 60px rgba(2, 6, 23, 0.45);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--dim);
}

.login-title {
    margin: 14px 0 18px;
    font-size: 22px;
    font-weight: 700;
}

.login-form {
    display: grid;
    gap: 12px;
}

.login-field {
    display: grid;
    gap: 6px;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--dim);
}

.login-field input {
    width: 100%;
    padding: 11px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 15px;
    letter-spacing: normal;
    text-transform: none;
}

.login-field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.login-submit {
    margin-top: 4px;
    padding: 12px 14px;
    border: 0;
    border-radius: var(--radius-sm);
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    color: #fff;
    font: inherit;
    font-size: 14.5px;
    font-weight: 700;
    cursor: pointer;
}

.login-submit:hover {
    filter: brightness(1.08);
}

.login-error {
    min-height: 18px;
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--off);
}

.login-error:empty {
    display: none;
}

/* the login page carries no script, so the language is asked for with links */
.login-lang {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
}

.login-lang-link {
    padding: 5px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--dim);
    font-size: 12px;
    text-decoration: none;
    transition: color 0.16s ease, border-color 0.16s ease;
}

.login-lang-link:hover {
    color: var(--text);
}

.login-lang-link.is-on {
    color: var(--text);
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 18%, transparent);
}

/* ----------------------------------------------------------------- kpi -- */

.kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--gap);
    margin-bottom: var(--gap);
}

.kpi {
    position: relative;
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    overflow: hidden;
}

.kpi::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--kpi-color, var(--accent));
}

.kpi-ok { --kpi-color: var(--ok); }
.kpi-degraded { --kpi-color: var(--degraded); }
.kpi-off { --kpi-color: var(--off); }
.kpi-accent { --kpi-color: var(--accent-3); }

.kpi-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    color: var(--kpi-color, var(--accent));
    background: color-mix(in srgb, var(--kpi-color, var(--accent)) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--kpi-color, var(--accent)) 30%, transparent);
}

.kpi-value {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.kpi-value small {
    font-size: 14px;
    font-weight: 500;
    color: var(--dim);
    margin-left: 4px;
}

.kpi-label {
    font-size: 12.5px;
    color: var(--dim);
}

.kpi-hint {
    margin-top: 4px;
    font-size: 12px;
    color: var(--dim);
    font-variant-numeric: tabular-nums;
}

.kpi-skeleton {
    min-height: 88px;
    animation: breathe 1.4s ease-in-out infinite;
}

/* -------------------------------------------------------------- tables -- */

.table-wrap {
    overflow: auto;
}

table.grid-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table.grid-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    text-align: left;
    padding: 11px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.045em;
    color: var(--dim);
    background: color-mix(in srgb, var(--surface-solid) 92%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

table.grid-table.compact thead th {
    padding: 8px 8px;
}

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

table.grid-table.compact tbody td {
    padding: 8px 8px;
}

table.grid-table tbody tr {
    transition: background 0.14s ease;
    cursor: pointer;
}

table.grid-table tbody tr:hover {
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}

table.grid-table tbody tr:last-child td {
    border-bottom: 0;
}

/* left rail of the row tells freshness without a colour-only signal */
table.grid-table tbody td:first-child {
    box-shadow: inset 3px 0 0 0 var(--row-color, transparent);
}

tr.tone-fresh { --row-color: transparent; }
tr.tone-stale { --row-color: var(--stale); background: color-mix(in srgb, var(--stale) 7%, transparent); }
tr.tone-dead { --row-color: var(--dead); background: color-mix(in srgb, var(--dead) 9%, transparent); }

th.sortable button {
    all: unset;
    cursor: pointer;
    color: inherit;
    font: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

th.sortable.sorted {
    color: var(--text);
}

th.sortable i {
    display: inline-grid;
    place-items: center;
    color: var(--accent-2);
}

td.c-status {
    width: 120px;
}

/* addresses are the widest thing in the grid: a slightly smaller mono keeps
   the whole table on one screen without hiding the meaningful part */
table.grid-table .mono {
    font-size: 12px;
}

td.c-age,
th:last-child {
    white-space: nowrap;
}

td.c-name b {
    font-weight: 600;
}

td.c-name .sub {
    margin-top: 3px;
    font-size: 11.5px;
    color: var(--dim);
    max-width: 156px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

td.c-output {
    color: var(--dim);
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

td.c-server {
    white-space: nowrap;
}

.input-cell {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 300px;
}

.input-cell .mono {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--dim);
}

.errors {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--degraded);
    font-variant-numeric: tabular-nums;
}

.bitrate {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.bitrate b {
    min-width: 48px;
    text-align: right;
}

.bitrate .spark {
    width: 44px;
}

.trend {
    font-size: 10.5px;
    padding: 1px 4px;
}

.trend {
    font-size: 11px;
    padding: 1px 5px;
    border-radius: 6px;
}

.trend.tone-up { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.trend.tone-down { color: var(--off); background: color-mix(in srgb, var(--off) 14%, transparent); }
.trend.tone-flat { color: var(--dim); }

/* -------------------------------------------------- server cards (grid) -- */

.server-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
}

.server-card {
    display: grid;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.server-card header {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.server-card header b {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.server-stats {
    display: grid;
    grid-template-columns: repeat(3, auto);
    gap: 10px 18px;
    justify-content: start;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ------------------------------------------------------- detail pages -- */

.detail-head-main {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.kpi-body {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.stat {
    display: grid;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.stat b {
    font-size: 17px;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.stat span {
    font-size: 11.5px;
    color: var(--dim);
}

.stat.tone-ok b { color: var(--ok); }
.stat.tone-degraded b { color: var(--degraded); }
.stat.tone-off b { color: var(--off); }
.stat.tone-scrambled b { color: var(--scrambled); }

/* a table that is part of a card, not a card itself */
.table-flat {
    background: transparent;
}

.table-flat table.grid-table thead th {
    background: transparent;
    backdrop-filter: none;
}

#ov-adapters .c-name b {
    max-width: 132px;
}

#ov-adapters td.c-signal {
    min-width: 0;
    width: 84px;
}

#ov-adapters .bar {
    width: 42px;
}

/* ------------------------------------------------------------ charts --- */

.chart {
    display: grid;
    gap: 8px;
}

.chart-svg {
    display: block;
    width: 100%;
    height: 180px;
}

/* ----------------------------------------------------- filter controls -- */

.field {
    display: inline-flex;
    align-items: center;
}

.field select.input {
    min-width: 132px;
}

/* table column hints: the wide text columns truncate, the numbers do not */
td.c-addr,
td.c-output {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

td.c-name {
    min-width: 170px;
}

td.c-name b {
    display: block;
    max-width: 156px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

td.c-ca .tag {
    max-width: 64px;
}

/* the chips of a table cell must not stretch the column */
td.c-name .tag {
    max-width: 140px;
}

td.c-signal {
    min-width: 96px;
}

td.c-errors {
    min-width: 52px;
}

td.c-input {
    min-width: 0;
}

td.c-num,
td.c-pnr,
td.c-lang,
td.c-ca {
    white-space: nowrap;
    color: var(--dim);
}

td.c-kind,
td.c-flags,
td.c-signal,
td.c-bitrate,
td.c-errors {
    white-space: nowrap;
}

.input-cell {
    min-width: 0;
    max-width: 128px;
}

.input-cell .mono {
    min-width: 0;
    display: inline-block;
    max-width: 100px;
}

/* A pid is shown twice: the number on the input of the channel and the number
   on its output.  A remapped pid is marked in both cells; a pid the output does
   not carry stays dim and its input number is crossed out. */
td.c-pid {
    min-width: 54px;
    white-space: nowrap;
}

tr.row-mapped td.c-pid {
    background: color-mix(in srgb, var(--stub) 14%, transparent);
    border-radius: 6px;
}

tr.row-not-sent td {
    color: var(--dim);
    opacity: 0.72;
}

tr.row-not-sent td.c-pid-in {
    text-decoration: line-through;
    text-decoration-color: color-mix(in srgb, var(--off) 65%, transparent);
}

td.c-pid-out .pid-drop {
    font-family: var(--font);
    font-size: 11px;
    letter-spacing: 0.01em;
    color: var(--off);
}

/* ------------------------------------------------------- status marks -- */

.dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    background: var(--unknown);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--unknown) 20%, transparent);
}

.dot-solid { width: 7px; height: 7px; box-shadow: none; }

.tone-ok .dot, .dot.tone-ok, .tone-locked .dot, .dot.tone-locked { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.tone-degraded .dot, .dot.tone-degraded { background: var(--degraded); box-shadow: 0 0 0 3px color-mix(in srgb, var(--degraded) 22%, transparent); }
.tone-scrambled .dot, .dot.tone-scrambled { background: var(--scrambled); box-shadow: 0 0 0 3px color-mix(in srgb, var(--scrambled) 22%, transparent); }
.tone-stub .dot, .dot.tone-stub { background: var(--stub); box-shadow: 0 0 0 3px color-mix(in srgb, var(--stub) 22%, transparent); }
.tone-off .dot, .dot.tone-off, .tone-unlocked .dot, .dot.tone-unlocked { background: var(--off); box-shadow: 0 0 0 3px color-mix(in srgb, var(--off) 22%, transparent); }
.tone-fresh .dot { background: var(--fresh); }
.tone-stale .dot { background: var(--stale); }
.tone-dead .dot { background: var(--dead); animation: pulse 1.6s infinite; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 560;
    white-space: nowrap;
    color: var(--pill-color, var(--dim));
    background: color-mix(in srgb, var(--pill-color, var(--dim)) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--pill-color, var(--dim)) 30%, transparent);
}

.pill-ok, .pill-locked { --pill-color: var(--ok); }
.pill-degraded { --pill-color: var(--degraded); }
.pill-scrambled { --pill-color: var(--scrambled); }
.pill-stub { --pill-color: var(--stub); }
.pill-off, .pill-unlocked { --pill-color: var(--off); }
.pill-unknown { --pill-color: var(--unknown); }

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 7px;
    font-size: 11px;
    font-weight: 550;
    margin-left: 4px;
    color: var(--tag-color, var(--dim));
    background: color-mix(in srgb, var(--tag-color, var(--dim)) 13%, transparent);
    border: 1px solid color-mix(in srgb, var(--tag-color, var(--dim)) 26%, transparent);
    max-width: 260px;
    white-space: nowrap;
}

.tag > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tag > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-ok { --tag-color: var(--ok); }
.tag-warn { --tag-color: var(--degraded); }
.tag-scrambled { --tag-color: var(--scrambled); }
.tag-stub { --tag-color: var(--stub); }
.tag-off { --tag-color: var(--off); }
.tag-neutral { --tag-color: var(--dim); }

.age {
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    color: var(--dim);
    white-space: nowrap;
}

.age.tone-fresh { color: var(--dim); }
.age.tone-stale { color: var(--stale); font-weight: 600; }
.age.tone-dead { color: var(--dead); font-weight: 650; }

.signal {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 110px;
}

.signal em {
    font-style: normal;
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    color: var(--dim);
}

.bar {
    position: relative;
    display: inline-block;
    width: 74px;
    height: 6px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--line-strong) 55%, transparent);
    overflow: hidden;
}

.bar i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 65%, transparent), var(--accent-2));
}

.bar.tone-ok i { background: linear-gradient(90deg, color-mix(in srgb, var(--ok) 60%, transparent), var(--ok)); }
.bar.tone-degraded i { background: linear-gradient(90deg, color-mix(in srgb, var(--degraded) 60%, transparent), var(--degraded)); }
.bar.tone-off i { background: linear-gradient(90deg, color-mix(in srgb, var(--off) 60%, transparent), var(--off)); }

.metric {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
}

.metric b {
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.metric em {
    font-style: normal;
    font-size: 11px;
    color: var(--dim);
}

.metric.tone-ok b { color: var(--ok); }
.metric.tone-degraded b { color: var(--degraded); }

/* charts */

/*
 * Both graphs are drawn from x=0 to x=width, so the stroke of their line sticks
 * half its width past the left and the right edge - and an svg clips at its box
 * by default, which cuts the ends off.  The box has nothing beside it that the
 * half a pixel could reach, so the drawing is allowed to leave it.
 */
.spark,
.chart-svg { overflow: visible; }

.spark { display: block; }

.spark-line {
    fill: none;
    stroke: var(--accent-2);
    stroke-width: 1.4;
    vector-effect: non-scaling-stroke;
}

.spark-area {
    fill: color-mix(in srgb, var(--accent-2) 16%, transparent);
    stroke: none;
}

.spark-empty {
    display: inline-block;
    background: repeating-linear-gradient(90deg, var(--line) 0 2px, transparent 2px 6px);
    opacity: 0.5;
}

.chart-svg {
    width: 100%;
    height: 180px;
    display: block;
}

.chart-line {
    fill: none;
    stroke: var(--accent-2);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.chart-area {
    fill: color-mix(in srgb, var(--accent-2) 18%, transparent);
    stroke: none;
}

.chart-grid {
    stroke: var(--line);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.chart-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 6px;
}

.chart-title {
    font-size: 12.5px;
    color: var(--dim);
}

.chart-legend em {
    font-style: normal;
    font-variant-numeric: tabular-nums;
    margin-left: 10px;
    font-size: 12.5px;
}

.chart-legend small {
    color: var(--dim);
    font-size: 10.5px;
    text-transform: uppercase;
}

.chart-foot {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--dim);
    font-variant-numeric: tabular-nums;
}

.chart-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 18px;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--line);
    color: var(--dim);
    font-size: 13px;
}

/* ------------------------------------------------------------ filters -- */

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: var(--gap);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.filters .search {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 260px;
    flex: 1;
}

.filters .search .ic {
    position: absolute;
    left: 10px;
    pointer-events: none;
}

.input {
    appearance: none;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    border-radius: 10px;
    padding: 9px 12px;
    font: inherit;
    font-size: 13px;
}

.search .input {
    padding-left: 32px;
    width: 100%;
}

select.input {
    padding-right: 26px;
}

.switcher {
    display: inline-flex;
    flex-wrap: wrap;
    padding: 3px;
    gap: 2px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-2);
}

.switch-btn {
    white-space: nowrap;
    border: 0;
    background: transparent;
    color: var(--dim);
    font: inherit;
    font-size: 12.5px;
    padding: 6px 11px;
    border-radius: 8px;
    cursor: pointer;
}

.switch-btn.active {
    color: var(--text);
    background: color-mix(in srgb, var(--accent) 26%, transparent);
}

.filters-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--dim);
    font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------ detail pages --- */

.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--gap);
}

@media (min-width: 1180px) {
    .detail-grid {
        grid-template-columns: 1.25fr 1fr;
        align-items: start;
    }
}

.detail-col > .section,
.detail-col > div > .section {
    margin-bottom: 0;
}

.detail-col {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    /* a column of a grid may not be wider than the grid asked for: without
       this the pid table of the left column pushes the right one out of the
       page, and every value of that column reads as if it were cut */
    min-width: 0;
}

.detail-grid > * {
    min-width: 0;
}

/*
 * The narrow slot of a detail page is about 430px wide.  A table there has to
 * give its text room rather than ask for a horizontal scrollbar the operator
 * does not know about: an address, a codec or a label is broken over lines and
 * stays readable, and only a number the column cannot hold at all is broken
 * mid-token.  This does not depend on the width of the screen - the slot of a
 * detail page is narrow on a 1180px window and on a phone alike.
 */
.detail-col td.c-addr {
    max-width: none;
    white-space: normal;
    overflow-wrap: anywhere;
}

.detail-col td.c-label {
    white-space: normal;
    overflow-wrap: anywhere;
}

.detail-col td.c-codec {
    white-space: normal;
    overflow-wrap: anywhere;
}

/* a number of the narrow slot breaks rather than pushes the table sideways */
.detail-col td.c-num.mono {
    white-space: normal;
    overflow-wrap: anywhere;
}

.detail-col td.c-kind .tag {
    max-width: 100%;
}

/* the two columns of a detail page: the tighter type of the narrow slot */
@media (min-width: 1180px) {
    .detail-col table.grid-table {
        font-size: 12px;
    }

    .detail-col table.grid-table thead th {
        white-space: normal;
    }

    .detail-col table.grid-table.compact thead th,
    .detail-col table.grid-table.compact tbody td {
        padding: 7px 5px;
    }
}

.detail-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    padding: 18px;
    margin-bottom: var(--gap);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

/* the output address of a channel is one long word: on a phone it has to
   break where the box ends, not where the box overflows */
.detail-sub {
    overflow-wrap: anywhere;
}

.detail-head.tone-stale { border-color: color-mix(in srgb, var(--stale) 45%, var(--line)); }
.detail-head.tone-dead { border-color: color-mix(in srgb, var(--dead) 50%, var(--line)); }

.detail-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.detail-title h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 680;
    letter-spacing: -0.01em;
}

.detail-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
    font-size: 12.5px;
    color: var(--dim);
}

.detail-head-side {
    text-align: right;
    min-width: 0;
}

.big-bitrate {
    font-size: 24px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.age-lines {
    margin-top: 6px;
    font-size: 12px;
    color: var(--dim);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.compare {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.3fr);
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
    margin-bottom: var(--gap);
}

.compare-differs {
    border-color: color-mix(in srgb, var(--degraded) 45%, var(--line));
    background: color-mix(in srgb, var(--degraded) 7%, var(--surface));
}

.compare-col {
    min-width: 0;
}

.compare-col b {
    display: block;
    font-size: 15px;
    margin-top: 4px;
    overflow-wrap: anywhere;
}

.compare-col em {
    display: block;
    font-style: normal;
    font-size: 12px;
    color: var(--dim);
    margin-top: 3px;
}

.compare-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--dim);
}

.compare-arrow {
    color: var(--dim);
}

.compare-note {
    grid-column: 1 / -1;
}

.kv {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px 18px;
    margin: 0;
}

.kv-item dt {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--dim);
}

.kv-item dd {
    margin: 4px 0 0;
    font-size: 14px;
    word-break: break-word;
}

.kv-item.tone-ok dd { color: var(--ok); }
.kv-item.tone-off dd { color: var(--off); }
.kv-item.tone-degraded dd { color: var(--degraded); }
.kv-item.tone-scrambled dd { color: var(--scrambled); }

.dials {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--gap);
    margin-bottom: var(--gap);
}

.dial {
    padding: 14px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.dial-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--dim);
}

.dial-value {
    font-size: 22px;
    font-weight: 680;
    margin: 6px 0 10px;
    font-variant-numeric: tabular-nums;
}

/* the bar of a dial fills the card, it is a scale of the whole card width */
.dial .bar {
    display: block;
    width: 100%;
}

.adapter-strip {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 14px;
    align-items: center;
}

.strip-title {
    font-weight: 620;
}

.strip-sub {
    font-size: 12px;
    color: var(--dim);
    margin-top: 3px;
}

.strip-bars label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    color: var(--dim);
    margin-bottom: 6px;
}

.strip-bars .bar {
    width: 90px;
}

.strip-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.strip-age {
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 1100px) {
    .adapter-strip {
        grid-template-columns: 1fr;
    }
}

/* --------------------------------------------------------------- log -- */

.log-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    /*
     * A journal row is laid out for the width it is drawn in, not for the
     * width of the screen: the same list sits in the narrow column of a detail
     * page, in the wide table of the journal page and in a phone.
     */
    container-type: inline-size;
}

.log-row {
    display: grid;
    grid-template-columns: minmax(96px, 118px) minmax(0, 1fr) minmax(0, 112px) minmax(0, 460px);
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    font-size: 12.5px;
}

/*
 * The four columns need ~870px between them: in a narrower box the change
 * column takes the room the object name lives in, and the name is left a few
 * pixels wide with its icon printed over it.  Below that width the row becomes
 * two lines - time and object above, the field and what changed below - so
 * every part of the entry is still readable.
 */
@container (max-width: 880px) {
    .log-row {
        grid-template-columns: minmax(0, 104px) minmax(0, 1fr);
        gap: 4px 12px;
    }

    .log-row time {
        grid-row: 1;
        grid-column: 1;
    }

    .log-what {
        grid-row: 1;
        grid-column: 2;
    }

    .log-field {
        grid-row: 2;
        grid-column: 1;
    }

    .log-change {
        grid-row: 2;
        grid-column: 2;
    }
}

/* what the entry talks about: the object and the server it belongs to */
.log-what {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.log-server {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: none;
    max-width: 42%;
    min-width: 0;
    padding: 2px 7px;
    border-radius: 7px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--dim);
    font-size: 11px;
}

.log-server span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-row:last-child {
    border-bottom: 0;
}

.log-row time {
    white-space: nowrap;
    color: var(--dim);
    font-variant-numeric: tabular-nums;
    font-family: var(--mono);
    font-size: 11.5px;
}

.log-object {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* the name of a log row is a link: the ellipsis has to sit on the link, whose
   box would otherwise run past the span that clips it */
.log-object .nav-link {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-field {
    color: var(--dim);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.log-change {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.log-change s {
    color: var(--dim);
    text-decoration: line-through;
    text-decoration-color: color-mix(in srgb, var(--off) 60%, transparent);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 40%;
}

.log-change b {
    font-weight: 620;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-change i {
    color: var(--dim);
    display: inline-grid;
}

.log-status .log-change b {
    padding: 2px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--text);
}

/* the value a channel went to reads in the colour of that state */
.log-to-ok .log-change b { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.log-to-degraded .log-change b { background: color-mix(in srgb, var(--degraded) 16%, transparent); color: var(--degraded); }
.log-to-scrambled .log-change b { background: color-mix(in srgb, var(--scrambled) 16%, transparent); color: var(--scrambled); }
.log-to-stub .log-change b { background: color-mix(in srgb, var(--stub) 16%, transparent); color: var(--stub); }
.log-to-off .log-change b,
.log-to-unlocked .log-change b { background: color-mix(in srgb, var(--off) 16%, transparent); color: var(--off); }
.log-to-locked .log-change b { background: color-mix(in srgb, var(--locked) 16%, transparent); color: var(--locked); }

/* the narrow slot of the overview: time and object on one line, the change below */
#ov-log .log-row {
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 4px 10px;
}

#ov-log .log-row time {
    font-size: 11px;
}

#ov-log .log-field {
    display: none;
}

#ov-log .log-server {
    display: none;
}

#ov-log .log-change {
    grid-column: 2;
}

@media (max-width: 640px) {
    .switcher {
        width: 100%;
    }

    .switch-btn {
        flex: 1 1 auto;
        text-align: center;
    }

    .filters .search {
        min-width: 0;
        width: 100%;
    }

    .filters-count {
        margin-left: 0;
    }
}

/* --------------------------------------------- watching a channel ---- */

.watch {
    padding: 14px 16px;
    margin-bottom: var(--gap);
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.watch-empty {
    background: var(--surface-2);
    box-shadow: none;
}

.watch-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.watch-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 620;
}

.watch-kind {
    padding: 2px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-2);
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--dim);
    white-space: nowrap;
}

.watch-url {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12px;
    color: var(--dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.watch-state {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin: 8px 0 0;
    font-size: 12.5px;
    color: var(--dim);
    overflow-wrap: anywhere;
}

.watch-state .mono {
    font-size: 11.5px;
}

.watch-warn {
    color: var(--stale);
}

.watch-hint {
    margin: 10px 0 0;
    font-size: 12.5px;
    color: var(--dim);
    overflow-wrap: anywhere;
}

.watch-hint code {
    font-size: 11.5px;
}

.player {
    display: none;
}

.player.show {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.player-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 12px;
    color: var(--dim);
}

.player-audio {
    font-size: 11.5px;
    color: var(--dim);
    overflow-wrap: anywhere;
}

.player-head .btn {
    margin-left: auto;
}

.player-video {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #05070d;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

.player-wait,
.player-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface-2);
    font-size: 12.5px;
    color: var(--dim);
}

.player-error {
    color: var(--degraded);
    border-color: color-mix(in srgb, var(--degraded) 40%, var(--line));
}

/*
 * What this browser will not carry, and what to do instead.  The panel knows
 * the codecs of the channel and the entry point the manifest promises, so it
 * says so instead of showing a black rectangle: the limits are amber (the
 * stream is fine, the browser is not), and the address of the window is handed
 * over for a player that has a decoder of its own.
 */
.watch-limits {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 0;
}

.watch-limit {
    padding: 3px 8px;
    border: 1px solid color-mix(in srgb, var(--stale) 35%, var(--line));
    border-radius: 999px;
    background: color-mix(in srgb, var(--stale) 10%, transparent);
    font-size: 11.5px;
    color: var(--stale);
    overflow-wrap: anywhere;
}

.player-note {
    margin: 0;
    font-size: 12px;
    color: var(--dim);
    overflow-wrap: anywhere;
}

/*
 * The way out of the browser, printed above the player and not inside it: a
 * player outside the browser has decoders of its own, and the operator who is
 * told about a codec the page cannot take has to read that before pressing the
 * button, not after the box stayed black.
 */
.watch-external {
    display: grid;
    gap: 6px;
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px dashed var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    font-size: 12px;
    color: var(--dim);
}

.watch-external-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 10px;
}

.watch-external-title {
    color: var(--text);
}

.watch-external-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.player-cmd {
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 11.5px;
    color: var(--dim);
    overflow-wrap: anywhere;
    user-select: all;
}

/* ------------------------------------------------- the codecs of a stream -- */

.codec-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.codec {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface-2);
    font-size: 12px;
    /*
     * A chip is as wide as the column it was given: a long codec name takes a
     * second line inside the border rather than running over the value next to
     * it, and a single long word breaks where the column ends.  Nothing of the
     * name is hidden either way.
     */
    max-width: 100%;
    flex-wrap: wrap;
    white-space: normal;
    overflow-wrap: anywhere;
}

.codec b {
    font-weight: 620;
}

.codec i,
.codec u,
.codec em {
    font-style: normal;
    text-decoration: none;
    color: var(--dim);
    font-size: 11px;
}

.codec-off {
    opacity: 0.55;
    text-decoration: line-through;
}

td.c-codec {
    font-size: 12px;
    white-space: nowrap;
}

/* --------------------------------------------------- states & extras -- */

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 28px 16px;
    color: var(--dim);
    text-align: center;
}

.empty .ic {
    width: 30px;
    height: 30px;
    opacity: 0.6;
}

.empty b {
    color: var(--text);
    font-size: 14px;
}

.empty span {
    font-size: 12.5px;
}

.error-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid color-mix(in srgb, var(--dead) 45%, var(--line));
    background: color-mix(in srgb, var(--dead) 12%, transparent);
    color: var(--text);
    font-size: 13px;
}

.error-box .ic {
    color: var(--dead);
}

.fatal {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 40px 24px;
    color: var(--text);
}

.skeleton-line {
    display: inline-block;
    width: 100%;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--surface-2), color-mix(in srgb, var(--line-strong) 60%, transparent), var(--surface-2));
    background-size: 300% 100%;
    animation: shimmer 1.4s linear infinite;
}

.detail-skeleton {
    height: 320px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    animation: breathe 1.5s ease-in-out infinite;
}

tr.is-active td {
    background: color-mix(in srgb, var(--ok) 8%, transparent);
}

tr.row-degraded td {
    background: color-mix(in srgb, var(--degraded) 8%, transparent);
}

@keyframes shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

@keyframes breathe {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 0.85; }
}

@keyframes page-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
