/* Monitoring Drupal — native CSS, compact light UI, no framework. */

:root {
    /* Surfaces */
    --bg: #ffffff;
    --bg-elev: #f8f9fb;
    --bg-elev-2: #f1f3f6;
    --bg-hover: #f5f7fa;
    --bg-selected: #eef4ff;
    --border: #e6e8ec;
    --border-strong: #d5d9e0;
    --border-hover: #b9c0cb;
    /* Text */
    --text: #111418;
    --text-2: #3d4450;
    --text-muted: #6b7380;
    --text-faint: #9aa1ac;
    /* Accent & semantic (contrast checked on white) */
    --accent: #2563eb;
    --accent-strong: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-soft: rgba(37, 99, 235, .10);
    --fatal: #be123c;
    --critical: #dc2626;
    --error: #ea580c;
    --warning: #b45309;
    --notice: #0284c7;
    --info: #2563eb;
    --debug: #6b7280;
    --ok: #16a34a;
    --custom: #7c3aed;
    --contrib: #0d9488;
    --core: #64748b;
    --vendor: #94a3b8;
    /* Shape & type */
    --radius: 6px;
    --radius-sm: 4px;
    --control-h: 28px;
    --appbar-h: 44px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
    --shadow-hover: 0 4px 12px -2px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .05);
    --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
    --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 13px/1.45 var(--sans);
    font-feature-settings: "cv11", "ss01", "tnum";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection { background: rgba(37, 99, 235, .18); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 18px; }
h2 { font-size: 14px; }
h3 { font-size: 13px; margin-top: 1rem; }

code, .mono, pre { font-family: var(--mono); font-size: 12px; }

.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.break { overflow-wrap: anywhere; word-break: break-word; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}
[hidden] { display: none !important; }

.kbd {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 4px;
    border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px;
    background: var(--bg-elev-2); color: var(--text-muted);
    font: 500 10.5px/1 var(--mono);
}
.kbd + .kbd { margin-left: 2px; }

/* ---- App bar ----------------------------------------------------------- */

.appbar {
    position: sticky; top: 0; z-index: 20;
    background: rgba(255, 255, 255, .88);
    border-bottom: 1px solid var(--border);
    backdrop-filter: saturate(160%) blur(10px);
}
.appbar-main {
    display: flex; align-items: center; gap: 20px;
    height: var(--appbar-h); padding: 0 16px;
}
.appbar-spacer { flex: 1; }
.appbar-sub { border-top: 1px solid var(--border); }

.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; font-size: 13px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 18px; height: 18px; border-radius: 5px;
    background: url("../img/favicon.svg") center / cover no-repeat;
    box-shadow: 0 2px 8px -2px rgba(10, 16, 30, .45);
}
.mainnav { display: flex; align-items: center; gap: 2px; }
.mainnav a {
    padding: 5px 10px; border-radius: var(--radius);
    color: var(--text-muted); font-weight: 500;
}
.mainnav a:hover { color: var(--text); background: var(--bg-elev-2); text-decoration: none; }
.mainnav a.active { color: var(--text); background: var(--bg-elev-2); }

.usermenu { display: flex; align-items: center; gap: 10px; }
.avatar {
    display: inline-grid; place-items: center;
    width: 24px; height: 24px; border-radius: 50%;
    background: linear-gradient(135deg, #eef2f7, #dfe5ee);
    border: 1px solid var(--border-strong);
    color: var(--text-2); font-size: 11px; font-weight: 600;
}
.inline-form { display: inline; margin: 0; }
.link-button {
    background: none; border: 0; padding: 0; color: var(--text-muted);
    font: inherit; cursor: pointer;
}
.link-button:hover { color: var(--text); }

/* Page bar (title + KPIs) and filter bar, both inside the sticky app bar. */
.pagebar {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px;
    min-height: 40px; padding: 6px 16px;
}
.pagebar-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pagebar-title h1 { margin: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb { color: var(--text-muted); font-weight: 500; }
.crumb:hover { color: var(--text); text-decoration: none; }
.crumb-sep { color: var(--text-faint); }
.pagebar-link { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.pagebar-link:hover { color: var(--accent); text-decoration: none; }
.pagebar-note { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.pagebar-meta { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.pagebar.is-loading .sync .dot { animation: pulse 1s ease-in-out infinite; }

.kpis { display: flex; align-items: center; gap: 6px; }
.kpi {
    display: inline-flex; align-items: baseline; gap: 5px;
    height: 24px; padding: 3px 9px;
    border: 1px solid var(--border); border-radius: 999px;
    background: var(--bg-elev); color: var(--text-muted); font-size: 12px; white-space: nowrap;
}
.kpi-value { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-new .kpi-value { color: var(--critical); }
.kpi-error .kpi-value { color: var(--error); }
.kpi-warning .kpi-value { color: var(--warning); }
.kpi-new:not(.is-zero) { border-color: rgba(220, 38, 38, .3); background: rgba(220, 38, 38, .06); }
.kpi.is-zero .kpi-value { color: var(--text-muted); }

.sync { display: inline-flex; align-items: center; gap: 6px; margin-right: 6px; color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.sync .dot { width: 6px; height: 6px; }

.filterbar {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
    padding: 6px 16px 8px;
}
.filterbar-end { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.search {
    position: relative; display: flex; align-items: center;
    flex: 1 1 280px; max-width: 460px;
}
.search input {
    height: var(--control-h); padding: 0 30px 0 28px;
    background: var(--bg-elev);
}
.search-icon { position: absolute; left: 9px; width: 13px; height: 13px; fill: var(--text-muted); pointer-events: none; }
.search .kbd { position: absolute; right: 6px; pointer-events: none; }
.search input:focus ~ .kbd, .search input:not(:placeholder-shown) ~ .kbd { display: none; }

.chip-select {
    position: relative; display: inline-flex; align-items: center;
    height: var(--control-h);
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg-elev);
    transition: border-color .12s ease, background .12s ease;
}
.chip-select:hover { border-color: var(--border-strong); background: var(--bg-elev-2); }
.chip-select:focus-within { border-color: var(--accent); }
.chip-select.is-active { border-color: rgba(37, 99, 235, .4); background: var(--accent-soft); }
.chip-label { padding-left: 9px; color: var(--text-muted); font-size: 12px; white-space: nowrap; pointer-events: none; }
.chip-select select, .chip-select input {
    width: auto; height: 100%; padding: 0 24px 0 6px;
    border: 0; background: transparent; color: var(--text); font-weight: 500;
    appearance: none; -webkit-appearance: none; cursor: pointer;
}
.chip-select input { padding-right: 8px; cursor: text; color-scheme: light; }
.chip-select select:focus, .chip-select input:focus { outline: none; }
.chip-select:has(select)::after {
    content: ""; position: absolute; right: 9px; top: 50%;
    width: 5px; height: 5px; margin-top: -4px;
    border-right: 1.5px solid var(--text-muted); border-bottom: 1.5px solid var(--text-muted);
    transform: rotate(45deg); pointer-events: none;
}
.custom-range { display: inline-flex; gap: 6px; }

/* ---- Layout ------------------------------------------------------------ */

.container { max-width: 1200px; margin: 0 auto; padding: 20px 16px 48px; }
.container-fluid { max-width: none; padding: 0; }
.container-fluid > .flash, .container-fluid > .notice { margin: 10px 16px 0; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.breadcrumb { margin: 0 0 12px; color: var(--text-muted); font-size: 12px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text); }

/* ---- Buttons & forms ---------------------------------------------------- */

.button {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 32px; padding: 0 12px;
    border: 1px solid var(--border-strong); border-radius: var(--radius);
    background: var(--bg-elev-2); color: var(--text);
    font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.button:hover { border-color: var(--border-hover); background: var(--bg-elev-2); text-decoration: none; }
.button:disabled { opacity: .55; cursor: progress; }
.button.xs { height: var(--control-h); padding: 0 10px; font-size: 12px; }
.button.primary {
    background: var(--accent-strong); border-color: transparent; color: #fff;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 1px 2px rgba(16, 24, 40, .15);
}
.button.primary:hover { background: var(--accent-hover); border-color: transparent; }
.button.ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.button.ghost:hover { background: var(--bg-elev-2); color: var(--text); border-color: var(--border); }
.button.danger { background: transparent; border-color: rgba(220, 38, 38, .45); color: var(--critical); }
.button.danger:hover { background: var(--critical); border-color: var(--critical); color: #fff; }
.icon-button { width: var(--control-h); padding: 0; }
.icon-button svg { width: 12px; height: 12px; fill: currentColor; }
.pagebar.is-loading ~ .filterbar [data-refresh] svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

input, select, textarea {
    width: 100%;
    height: 32px; padding: 0 10px;
    border: 1px solid var(--border-strong); border-radius: var(--radius);
    background: var(--bg); color: var(--text);
    font: inherit;
    transition: border-color .12s ease, box-shadow .12s ease;
}
textarea { height: auto; padding: 8px 10px; }
input:hover, select:hover, textarea:hover { border-color: var(--border-hover); }
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.button:focus-visible, a:focus-visible, summary:focus-visible, .link-button:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--critical); }
input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--accent-strong); }

.form { display: grid; gap: 4px; max-width: 680px; }
.form label { margin-top: 10px; font-weight: 500; font-size: 12px; color: var(--text-2); }
.form fieldset {
    display: grid; gap: 4px;
    margin: 0 0 16px; padding: 14px 16px 16px;
    border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elev);
}
.form legend { padding: 0 6px; font-weight: 600; font-size: 13px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400 !important; }
.field-error { margin: 2px 0 0; color: var(--critical); font-size: 12px; }
.form-actions { display: flex; gap: 8px; margin-top: 8px; }

.danger-zone { margin-top: 32px; padding: 14px 16px; border: 1px solid rgba(220, 38, 38, .25); border-radius: 8px; background: rgba(220, 38, 38, .03); }
.danger-zone h2 { color: var(--critical); }
.danger-zone .button { margin-top: 10px; justify-self: start; }

.test-connection { margin-top: 12px; }
.checks { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.checks li { display: grid; grid-template-columns: 20px 1fr; }
.checks .check-icon { font-weight: 700; }
.checks .passed .check-icon { color: var(--ok); }
.checks .failed .check-icon { color: var(--critical); }
.checks .skipped .check-icon { color: var(--text-muted); }
.checks .check-detail { grid-column: 2; color: var(--text-muted); font-size: 12px; }

/* ---- Flash / notices ---------------------------------------------------- */

.flash, .notice {
    margin: 0 0 12px; padding: 8px 12px;
    border: 1px solid var(--border); border-left-width: 3px; border-radius: var(--radius);
    background: var(--bg-elev); font-size: 12.5px;
}
.flash-success { border-left-color: var(--ok); }
.flash-error { border-left-color: var(--critical); }
.notice { border-left-color: var(--warning); }
.notice p { margin: 0; }

/* ---- Badges, levels, status -------------------------------------------- */

.badge {
    display: inline-flex; align-items: center; height: 20px; padding: 0 7px;
    border: 1px solid var(--border-strong); border-radius: 999px;
    font-size: 11px; font-weight: 500;
    color: var(--text-muted); background: var(--bg-elev-2);
    white-space: nowrap;
}
.env-production { color: #b91c1c; border-color: rgba(220, 38, 38, .25); background: #fef2f2; }
.env-staging { color: #92400e; border-color: rgba(217, 119, 6, .3); background: #fffbeb; }
.env-development { color: #1d4ed8; border-color: rgba(37, 99, 235, .25); background: #eff6ff; }

/* Legacy solid level pill (issue page) */
.level {
    display: inline-block; min-width: 64px; padding: 2px 7px;
    border-radius: var(--radius-sm); text-align: center;
    font: 700 10.5px/1.4 var(--mono); letter-spacing: .04em; text-transform: uppercase;
    color: #fff; background: var(--debug);
}
.level.small { min-width: 0; }
.level-fatal { background: var(--fatal); color: #fff; }
.level-critical { background: var(--critical); color: #fff; }
.level-error { background: var(--error); }
.level-warning { background: var(--warning); }
.level-notice { background: var(--notice); }
.level-info { background: var(--info); }
.level-debug { background: var(--debug); }
.status-resolved { color: var(--ok); }
.status-ignored { color: var(--text-muted); }

/* Soft level tag (tables) */
.lvl {
    --c: var(--debug);
    display: inline-flex; align-items: center; gap: 6px;
    height: 20px; padding: 0 7px;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--c) 13%, transparent);
    color: var(--c);
    font: 600 10.5px/1 var(--mono); letter-spacing: .03em; text-transform: uppercase;
}
.lvl-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.lvl-fatal { --c: var(--fatal); }
.lvl-critical { --c: var(--critical); }
.lvl-error { --c: var(--error); }
.lvl-warning { --c: var(--warning); }
.lvl-notice { --c: var(--notice); }
.lvl-info { --c: var(--info); }
.lvl-debug { --c: var(--debug); }
.lvl-fatal .lvl-dot, .lvl-critical .lvl-dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent); }

.status { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); white-space: nowrap; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); }
.status.status-unresolved .status-dot { background: var(--error); }
.status.status-resolved .status-dot { background: var(--ok); }
.status.status-ignored .status-dot { background: var(--text-faint); }
.status.status-unknown { color: var(--text-faint); }

.tag {
    display: inline-flex; align-items: center; height: 15px; padding: 0 4px;
    border-radius: 3px; background: var(--bg-elev-2); border: 1px solid var(--border);
    color: var(--text-muted); font-size: 10.5px; font-weight: 500;
}
.tag-new { color: #b91c1c; background: #fef2f2; border-color: rgba(220, 38, 38, .25); text-transform: uppercase; letter-spacing: .04em; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); flex: none; }
.dot-critical { background: var(--critical); box-shadow: 0 0 0 3px rgba(220, 38, 38, .15); }
.dot-error { background: var(--error); }
.dot-warning { background: var(--warning); }
.dot-ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(22, 163, 74, .15); }
.dot-muted { background: var(--vendor); }
.dot-loading { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---- Security advisories ------------------------------------------------ */

.risk-highly_critical { --c: var(--fatal); }
.risk-critical { --c: var(--critical); }
.risk-moderately_critical { --c: var(--error); }
.risk-less_critical { --c: var(--warning); }
.risk-not_critical { --c: var(--debug); }
.risk-unknown { --c: var(--info); }
.lvl.risk-highly_critical .lvl-dot, .lvl.risk-critical .lvl-dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent); }
.risk-score { margin-left: 2px; opacity: .75; font-weight: 500; }

.risk-kpi { font-family: inherit; cursor: pointer; }
.risk-kpi .kpi-value { color: var(--c); }
.risk-kpi:hover { border-color: color-mix(in srgb, var(--c) 45%, transparent); }
.risk-kpi.is-active { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); }
.risk-kpi.is-zero .kpi-value { color: var(--text-muted); }

.advisories-table th.c-risk { width: 132px; }
.advisories-table th.c-module { width: 24%; }
.advisories-table th.c-affected { width: 15%; }
.advisories-table th.c-fixed { width: 11%; }
.advisories-table th.c-sa { width: 172px; }
.advisories-table th.c-date { width: 104px; }
.advisory-row:hover td { background: var(--bg-hover); }
.advisory-row.risk-row-highly_critical td:first-child,
.advisory-row.risk-row-critical td:first-child { box-shadow: inset 2px 0 0 var(--c); }
.advisory-row.risk-row-highly_critical { --c: var(--fatal); }
.advisory-row.risk-row-critical { --c: var(--critical); }
.advisory-module { display: flex; align-items: center; gap: 6px; min-width: 0; }
.advisory-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--text); font-weight: 600; }
a.advisory-name:hover { color: var(--accent); }
.advisory-vuln { display: block; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.advisories-table .c-affected, .advisories-table .c-fixed { font-size: 11.5px; }
.advisories-table .c-sa a { font-size: 11.5px; color: var(--text-2); }
.advisories-table .c-sa a:hover { color: var(--accent); }
.advisories-table .c-date { color: var(--text-muted); font-size: 12px; }
.tag.kind-core { color: var(--accent); border-color: rgba(37, 99, 235, .3); background: var(--accent-soft); }
.tag.kind-psa { color: var(--info); }

/* ---- Data grid (logs) --------------------------------------------------- */

.datagrid { background: var(--bg); }
.issues-table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    table-layout: fixed;
}
.issues-table th.c-level { width: 116px; }
.issues-table th.c-status { width: 116px; }
.issues-table th.c-release { width: 120px; }
.issues-table th.c-count { width: 108px; }
.issues-table th.c-first { width: 104px; }
.issues-table th.c-last { width: 104px; }
.issues-table th.c-action { width: 48px; }
.issues-table td.c-action { text-align: center; overflow: visible; }
.resolve-button {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; padding: 0;
    border: 1px solid var(--border-strong); border-radius: var(--radius);
    background: var(--bg); color: var(--text-muted);
    font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.resolve-button:hover { border-color: var(--ok); background: var(--ok); color: #fff; }
.resolve-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.resolve-button:disabled { opacity: .55; cursor: progress; }

.issues-table thead th {
    position: sticky; top: var(--sticky-top, 0); z-index: 5;
    height: 30px; padding: 0 12px;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    color: var(--text-muted); font-size: 11px; font-weight: 500; text-align: left;
    text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
}
.issues-table thead th:first-child, .issues-table td:first-child { padding-left: 16px; }
.issues-table thead th:last-child, .issues-table td:last-child { padding-right: 16px; }
.issues-table thead th.num { text-align: right; }

.issues-table td {
    padding: 5px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-2);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.issue-row { cursor: pointer; transition: background .08s ease; }
.issue-row:hover td { background: var(--bg-hover); }
.issue-row.is-selected td { background: var(--bg-selected); }
.issue-row.is-selected td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.issue-row.is-new td:first-child { box-shadow: inset 2px 0 0 var(--critical); }
.issue-row.is-new.is-selected td:first-child { box-shadow: inset 2px 0 0 var(--accent); }

.issue-link { display: flex; align-items: baseline; gap: 8px; min-width: 0; color: var(--text); }
.issue-link:hover { text-decoration: none; }
.issue-row:hover .issue-type { color: var(--accent); }
.issue-type { flex: none; max-width: 60%; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: 13px; }
.issue-msg { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--text-muted); font-size: 12.5px; }
.issue-sub { display: flex; align-items: center; gap: 8px; margin-top: 1px; min-width: 0; color: var(--text-faint); font-size: 11.5px; }
.issue-sub .mono { font-size: 11px; }
.issue-sub .culprit { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--text-muted); }

.c-release { color: var(--text-muted) !important; font-size: 11.5px; }
.c-count { text-align: right; }
.count-value { display: block; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.count-bar { display: block; height: 2px; margin: 4px 0 0 auto; width: 56px; border-radius: 2px; background: var(--border); overflow: hidden; }
.count-bar span { display: block; height: 100%; margin-left: auto; border-radius: 2px; background: linear-gradient(90deg, var(--accent-strong), var(--accent)); }
.c-first, .c-last { color: var(--text-muted) !important; font-size: 12px; }
.c-last time { color: var(--text-2); }

.skeleton td { padding: 13px 16px; border-bottom: 1px solid var(--border); }
.skeleton span {
    display: block; height: 12px; border-radius: 4px; width: 70%;
    background: linear-gradient(90deg, var(--bg-elev) 0%, var(--bg-elev-2) 40%, var(--bg-elev) 80%);
    background-size: 200% 100%; animation: shimmer 1.3s linear infinite;
}
.skeleton:nth-child(3n) span { width: 55%; }
.skeleton:nth-child(3n + 1) span { width: 82%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.empty-row td { padding: 56px 16px !important; text-align: center; color: var(--text-muted); white-space: normal; cursor: default; }

.grid-footer {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 16px 24px; font-size: 12px;
}
.grid-footer .shortcuts { display: inline-flex; align-items: center; gap: 4px; }

/* ---- Dashboard ---------------------------------------------------------- */

.toolbar, .filters {
    display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px;
    margin-bottom: 16px; padding: 10px;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: 8px;
}
.field { display: grid; gap: 3px; min-width: 150px; }
.field.grow { flex: 1 1 240px; }
.field.inline { min-width: 0; }
.field.actions { display: flex; align-items: flex-end; gap: 8px; }
.field-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; margin-bottom: 12px; }

.card {
    display: block; position: relative;
    padding: 12px 14px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: border-color .12s ease, background .12s ease;
}
a.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-hover); text-decoration: none; }
.project-card::before {
    content: ""; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 2px; border-radius: 2px;
    background: transparent;
}
.project-card[data-state="critical"]::before { background: var(--critical); }
.project-card[data-state="error"]::before { background: var(--error); }
.project-card[data-state="warning"]::before { background: var(--warning); }
.project-card[data-state="ok"]::before { background: var(--ok); }
.project-card[data-state="failing"]::before { background: var(--text-muted); }
.project-card.is-disabled { opacity: .55; }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-title { min-width: 0; font-size: 13.5px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-head .badge { flex: none; }
.card-host { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-host { margin: 2px 0 10px; font-size: 12px; }
.card-host:has(+ .card-owner) { margin-bottom: 0; }
.card-owner { margin: 0 0 10px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.summary-main { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; }
.summary-sub { margin: 2px 0 10px; color: var(--text-muted); font-size: 12px; }
.summary-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12px; }
.summary-meta dt { color: var(--text-muted); font-size: 11px; }
.summary-meta dd { margin: 0; }
.summary-error { margin: 8px 0 0; color: var(--warning); font-size: 12px; }

.empty { padding: 40px; text-align: center; border: 1px dashed var(--border-strong); border-radius: 8px; color: var(--text-muted); }

/* ---- Issue detail ------------------------------------------------------- */

.issue-header { margin-bottom: 12px; }
.issue-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.issue-title { font-size: 17px; overflow-wrap: anywhere; }
.issue-actions {
    position: relative;
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    width: fit-content; max-width: 100%;
    margin: 0 0 12px; padding: 4px;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev);
}
.issue-actions form { display: contents; }
.md-popover {
    position: absolute; top: calc(100% + 8px); left: 0; z-index: 20;
    width: min(760px, calc(100vw - 32px));
    display: grid; gap: 8px; padding: 8px;
    border: 1px solid var(--border-strong); border-radius: var(--radius);
    background: var(--bg); box-shadow: var(--shadow-hover);
}
.md-popover[hidden] { display: none; }
/* Caret under the toggle button (--caret-x set by app.js). */
.md-popover::before {
    content: ""; position: absolute; top: -6px; left: var(--caret-x, 24px);
    width: 10px; height: 10px; transform: translateX(-50%) rotate(45deg);
    background: var(--bg); border-left: 1px solid var(--border-strong); border-top: 1px solid var(--border-strong);
}
.md-popover-code { margin: 0; max-height: 50vh; overflow: auto; white-space: pre; font-size: 12px; }
.md-popover-actions { display: flex; justify-content: flex-end; gap: 8px; }
.issue-message { margin: 4px 0 6px; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; white-space: pre-wrap; }

.metrics {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px;
    margin: 12px 0 4px; overflow: hidden;
    border: 1px solid var(--border); border-radius: 8px; background: var(--border);
}
.metric { display: grid; gap: 2px; padding: 10px 12px; background: var(--bg-elev); }
.metric-label { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.metric-value { font-size: 14px; font-weight: 600; }

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

pre.code, pre.source {
    margin: 8px 0 0; padding: 10px 12px;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-2);
    overflow-x: auto; line-height: 1.5;
}
pre.code.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
pre.debug { max-height: 50vh; }

.exception-type { margin: 8px 0 0; }
.frames { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.frame details { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); }
.frame summary {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px;
    padding: 6px 10px; cursor: pointer; list-style: none;
}
.frame summary:hover { background: var(--bg-hover); }
.frame summary::-webkit-details-marker { display: none; }
.frame-index { color: var(--text-faint); font: 11px var(--mono); min-width: 26px; }
.frame-fn { color: var(--text); overflow-wrap: anywhere; }
.frame-file { color: var(--text-muted); font-size: 11.5px; overflow-wrap: anywhere; flex-basis: 100%; padding-left: 34px; }
.frame details > p { margin: 0; padding: 6px 10px 8px 44px; }
.frame details pre.code { margin: 0; border: 0; border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); }
.frame.origin-custom details { border-left: 2px solid var(--custom); }
.frame.origin-contrib details { border-left: 2px solid var(--contrib); }
.frame.origin-core details, .frame.origin-vendor details { opacity: .8; }
.stacktrace.only-custom .frame:not(.origin-custom) { display: none; }

.origin-badge { padding: 0 5px; border-radius: 3px; font: 700 10px/1.6 var(--mono); letter-spacing: .05em; }
.origin-badge.origin-custom { background: rgba(124, 58, 237, .1); color: var(--custom); }
.origin-badge.origin-contrib { background: rgba(13, 148, 136, .1); color: var(--contrib); }
.origin-badge.origin-core { background: rgba(100, 116, 139, .1); color: var(--core); }
.origin-badge.origin-vendor { background: rgba(148, 163, 184, .15); color: var(--text-muted); }

.source { padding: 6px 0 !important; }
.src-line { display: block; padding: 0 12px; white-space: pre; }
.src-line.current { background: rgba(234, 88, 12, .09); box-shadow: inset 2px 0 0 var(--error); }
.src-no { display: inline-block; width: 44px; color: var(--text-faint); user-select: none; }

.kv { display: grid; grid-template-columns: minmax(120px, 220px) minmax(0, 1fr); gap: 4px 16px; margin: 8px 0 0; }
.kv dt { color: var(--text-muted); overflow-wrap: anywhere; }
.kv dd { margin: 0; }
details.sub { margin-top: 10px; }
details.sub > summary { cursor: pointer; color: var(--text-muted); }

.breadcrumbs-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 0; }
.breadcrumbs-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.breadcrumbs-list .kv { flex-basis: 100%; }

.table, .events-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12.5px; }
.table th, .table td, .events-table th, .events-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table th, .events-table th { color: var(--text-muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; background: var(--bg-elev); }
.table tbody tr:hover td, .events-table tbody tr:hover td { background: var(--bg-hover); }

/* ---- Login / errors ----------------------------------------------------- */

.login-box {
    max-width: 380px; margin: 12vh auto 0; padding: 28px;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: var(--shadow);
}
.login-box .form { max-width: none; }
.login-box .button { margin-top: 16px; width: 100%; }
.error-page { max-width: 640px; margin: 10vh auto 0; text-align: center; }
.error-code { font: 700 48px/1 var(--mono); color: var(--text-faint); margin: 0 0 8px; }
.error-page pre { text-align: left; }

/* ---- Responsive --------------------------------------------------------- */

@media (max-width: 1100px) {
    .issues-table .c-first, .issues-table .c-release { display: none; }
}

@media (max-width: 720px) {
    .container { padding: 14px 12px 32px; }
    .container-fluid { padding: 0; }
    .appbar-main, .pagebar, .filterbar { padding-left: 12px; padding-right: 12px; }
    .brand-name, .usermenu .avatar { display: none; }
    .appbar-main { gap: 10px; }
    .page-head { flex-direction: column; align-items: stretch; }
    .field, .field.grow { min-width: 0; flex: 1 1 100%; }
    .field.actions { flex-wrap: wrap; }
    .search { flex-basis: 100%; max-width: none; }
    .filterbar-end { margin-left: 0; }
    .pagebar-meta { margin-left: 0; }
    .kpis { flex-wrap: wrap; }
    /* Small screens: the header scrolls away, only the table head sticks. */
    .appbar { position: static; }
    .issues-table thead th { top: 0; }
    .issues-table .c-status { display: none; }
    .advisories-table .c-affected, .advisories-table .c-fixed, .advisories-table .c-sa, .advisories-table .c-vuln { display: none; }
    .advisories-table th.c-module { width: auto; }
    .advisory-kpis { flex-wrap: wrap; }
    .issues-table th.c-level { width: 36px; font-size: 0; }
    .issues-table td.c-level { padding-right: 0; }
    .lvl { width: 18px; padding: 0; justify-content: center; font-size: 0; gap: 0; }
    .issues-table th.c-count { width: 52px; }
    .issues-table th.c-last { width: 88px; }
    .count-bar { display: none; }
    .issues-table .c-last { font-size: 11.5px; }
    .issue-link { flex-direction: column; gap: 0; }
    .issue-type { max-width: 100%; }
    .grid-footer .shortcuts { display: none; }
    .kv { grid-template-columns: 1fr; }
    .kv dt { margin-top: 6px; }
    .events-table thead { display: none; }
    .events-table td { display: block; border: 0; padding: 2px 0; }
    .events-table tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--border); }
    .table { display: block; overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* Dashboard filters live inside the page bar. */
.filterbar.inline { flex: 1 1 420px; padding: 0; }
.footnote { margin-top: 12px; }

/* Fluid pages: content aligned with the header gutters. */
.padded { margin-left: 16px; margin-right: 16px; }
.container-fluid > .project-grid { margin-top: 16px; }
@media (max-width: 720px) { .padded { margin-left: 12px; margin-right: 12px; } }
pre.code + .button { margin-top: 8px; }

/* Login */
.login-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; font-weight: 600; color: var(--text-2); }
.login-box h1 { font-size: 17px; }
.turnstile { margin-top: 14px; min-height: 65px; }
.login-note { margin: 14px 0 0; }
