/* ── KernelCI Status — Custom Theme ──
 *
 * Brand palette (from KernelCI dashboard):
 *   Navy:      #001B71
 *   Blue:      #11B3E6 / #009ADE
 *   Dark BG:   #343638
 *   Green:     #53D07C   (ok/pass)
 *   Red:       #E15739   (critical/fail)
 *   Yellow:    #FFD27C   (warning)
 *   Lt Green:  #C9FADA
 *   Lt Red:    #FFBBBB
 *   Gray:      #EAEAEA   (no data)
 */

:root {
    --kci-navy: #001B71;
    --kci-blue: #11B3E6;
    --kci-blue-dark: #1D4ED8;
    --kci-blue-light: #E7F7FC;
    --kci-dark: #343638;
    --kci-green: #53D07C;
    --kci-green-dark: #016630;
    --kci-green-light: #C9FADA;
    --kci-red: #E15739;
    --kci-red-light: #FFBBBB;
    --kci-yellow: #FFD27C;
    --kci-gray: #EAEAEA;
    --kci-gray-dim: #767676;
    --kci-text: #333333;
    --kci-text-muted: #767676;
    --kci-border: #D6D6D6;
}

/* ── Pico overrides ── */

:root {
    --pico-primary: var(--kci-navy);
    --pico-primary-hover: var(--kci-blue-dark);
    --pico-primary-focus: rgba(17, 179, 230, 0.25);
    --pico-primary-inverse: #fff;
}

a { color: var(--kci-blue-dark); }
a:hover { color: var(--kci-navy); }

/* ── Logo ── */

.status-logo {
    height: 32px;
    width: auto;
    margin-bottom: 0.25rem;
}

.nav-logo {
    height: 24px;
    width: auto;
    display: block;
    filter: brightness(0) invert(1);
}

/* ── Admin nav bar ── */

nav.admin-nav {
    background: var(--kci-dark);
    padding: 0.5rem 1.5rem;
    margin: 0;
    color: #fff;
    flex-wrap: wrap;
    gap: 0.25rem;
}

nav.admin-nav ul {
    gap: 0.15rem;
    flex-wrap: wrap;
}

nav.admin-nav a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

nav.admin-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

nav.admin-nav strong {
    color: var(--kci-blue);
    font-size: 1rem;
    letter-spacing: 0.02em;
}

nav.admin-nav .logout-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.7);
    padding: 0.25rem 0.6rem;
    font-size: 0.78rem;
    cursor: pointer;
    border-radius: 4px;
    margin: 0;
    transition: border-color 0.15s, color 0.15s;
}

nav.admin-nav .logout-btn:hover {
    border-color: #fff;
    color: #fff;
}

/* ── Status badges ── */

.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.badge-ok { background: var(--kci-green-dark); }
.badge-warning { background: #b8860b; color: #fff; }
.badge-critical { background: var(--kci-red); }
.badge-nodata { background: var(--kci-gray-dim); }
.badge-maintenance { background: var(--kci-blue-dark); }
.badge-ok-maintenance { background: linear-gradient(135deg, var(--kci-green-dark) 50%, var(--kci-blue-dark) 50%); }
.badge-warning-maintenance { background: linear-gradient(135deg, #b8860b 50%, var(--kci-blue-dark) 50%); }
.badge-critical-maintenance { background: linear-gradient(135deg, var(--kci-red) 50%, var(--kci-blue-dark) 50%); }
.badge-nodata-maintenance { background: linear-gradient(135deg, var(--kci-gray-dim) 50%, var(--kci-blue-dark) 50%); }

/* ── Admin page headings ── */

main.container > h2 {
    color: var(--kci-navy);
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--kci-border);
}

main.container > h3 {
    color: var(--kci-navy);
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

/* ── Admin dashboard counters ── */

.status-count {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.status-count.ok { color: var(--kci-green); }
.status-count.warning { color: #c28b00; }
.status-count.critical { color: var(--kci-red); }
.status-count.nodata { color: var(--kci-gray-dim); }

/* ── Login page ── */

.login-card {
    max-width: 380px;
    margin: 12vh auto 0;
}

.login-card article {
    border-top: 3px solid var(--kci-navy);
}

.login-card h2 {
    color: var(--kci-navy);
    margin-bottom: 0;
}

.login-card .subtitle {
    color: var(--kci-text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.error-message {
    color: var(--kci-red);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    background: var(--kci-red-light);
    border-radius: 4px;
    margin-bottom: 1rem;
}

.success-message {
    color: var(--kci-green-dark);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    background: var(--kci-green-light);
    border-radius: 4px;
    margin-bottom: 1rem;
}

code {
    font-size: 0.8rem;
    word-break: break-all;
}

/* ── Help tooltips ── */

.help-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--kci-border);
    color: var(--kci-text-muted);
    font-size: 0.65rem;
    font-weight: 700;
    cursor: help;
    vertical-align: middle;
    margin-left: 4px;
    line-height: 1;
    user-select: none;
    flex-shrink: 0;
}

.help-icon-th {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
}

.help-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    padding: 0.75rem 0.9rem;
    background: var(--kci-dark);
    color: #e8e8e8;
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.5;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    z-index: 100;
    text-align: left;
    white-space: normal;
    cursor: default;
}

.help-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--kci-dark);
}

.help-tooltip code {
    background: rgba(255, 255, 255, 0.12);
    padding: 0.1em 0.35em;
    border-radius: 3px;
    font-size: 0.76rem;
    color: var(--kci-blue);
    word-break: break-all;
}

.help-tooltip b {
    color: #fff;
}

/* Downward variant for tooltips near the top of the page */
.help-tooltip-down {
    bottom: auto;
    top: calc(100% + 8px);
}

.help-tooltip-down::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: var(--kci-dark);
}

.help-icon:hover .help-tooltip,
.help-icon:focus .help-tooltip {
    display: block;
}

/* ── Compact buttons & action groups ── */

.btn-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.78rem;
    line-height: 1.4;
    border-radius: 4px;
    margin: 0;
    cursor: pointer;
    width: auto;
    display: inline-block;
}

.btn-sm.outline {
    background: transparent;
    border: 1px solid var(--kci-border);
    color: var(--kci-text);
}

.btn-sm.outline:hover {
    border-color: var(--kci-navy);
    color: var(--kci-navy);
}

.btn-sm.outline.secondary {
    color: var(--kci-red);
    border-color: var(--kci-red-light);
}

.btn-sm.outline.secondary:hover {
    border-color: var(--kci-red);
    background: var(--kci-red-light);
}

.btn-sm:not(.outline) {
    background: var(--kci-navy);
    color: #fff;
    border: 1px solid var(--kci-navy);
}

.btn-sm:not(.outline):hover {
    background: var(--kci-blue-dark);
    border-color: var(--kci-blue-dark);
}

.action-group {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    margin-top: 0.4rem;
}

.input-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    height: auto;
    margin: 0;
    width: 160px;
}

/* ── Inline edit row ── */

.edit-row {
    background: var(--kci-blue-light);
    padding: 1rem 1.25rem;
    border-top: 2px solid var(--kci-blue);
}

.edit-row form {
    margin: 0;
}

.edit-row label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--kci-text);
}

.edit-row input[type="text"],
.edit-row input[type="number"],
.edit-row input[type="datetime-local"],
.edit-row select {
    font-size: 0.85rem;
    padding: 0.35rem 0.5rem;
    margin-bottom: 0.5rem;
}

.edit-row fieldset {
    margin-bottom: 0.5rem;
    padding: 0;
    border: none;
}

/* ── Checkbox grid (maintenance affected endpoints etc.) ── */

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.15rem 1.5rem;
    padding: 0.5rem 0;
}

.checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.88rem;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0;
}

.checkbox-grid label:hover {
    background: rgba(0, 0, 0, 0.04);
}

.checkbox-grid input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
}

/* ── Section cards (admin pages) ── */

.admin-section {
    border: 1px solid var(--kci-border);
    border-radius: 8px;
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.admin-section > header {
    background: #f5f6f8;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--kci-border);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--kci-navy);
}

/* ── Details/summary (Add forms) ── */

details {
    border: 1px solid var(--kci-border);
    border-radius: 8px;
    margin-bottom: 1.25rem;
    overflow: hidden;
}

details > summary {
    padding: 0.6rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--kci-navy);
    cursor: pointer;
    background: #f5f6f8;
    border: none;
    list-style: none;
}

details > summary::before {
    content: "\25B6";
    display: inline-block;
    margin-right: 0.5rem;
    font-size: 0.7rem;
    transition: transform 0.15s;
}

details[open] > summary::before {
    transform: rotate(90deg);
}

details > summary:hover {
    background: #eef0f3;
}

details[open] > summary {
    border-bottom: 1px solid var(--kci-border);
    margin-bottom: 0;
}

details > form,
details > div {
    padding: 1rem;
}

details > summary::-webkit-details-marker {
    display: none;
}

/* ── Tables ── */

table {
    border-collapse: separate !important;
    border-spacing: 0;
    border: 1px solid var(--kci-border);
    border-radius: 8px;
    overflow: hidden;
    font-size: 0.88rem;
    margin-bottom: 1.25rem;
}

table th {
    background: var(--kci-dark);
    color: #fff;
    font-weight: 500;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 0.6rem 0.75rem;
    border-bottom: 2px solid var(--kci-navy);
    border-top: none;
    white-space: nowrap;
}

table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid #eee;
    border-top: none;
    vertical-align: middle;
}

table tbody tr:last-child td {
    border-bottom: none;
}

table tbody tr:nth-child(even):not(:has(> td.edit-row)) {
    background: #f8f9fb;
}

table tbody tr:hover:not(:has(> td.edit-row)) {
    background: var(--kci-blue-light);
}

table code {
    font-size: 0.78rem;
    background: #f0f1f3;
    padding: 0.15em 0.4em;
    border-radius: 3px;
    color: var(--kci-text);
}

/* ── Test endpoint result ── */

.test-result-container {
    margin-top: 0.5rem;
    min-height: 0;
}

.test-result-container.htmx-request {
    min-height: 2rem;
    display: flex;
    align-items: center;
    color: var(--kci-text-muted);
    font-size: 0.85rem;
}

.test-result-container.htmx-request::before {
    content: "Testing...";
}

.test-result {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.5rem 0.75rem;
    background: #f5f6f8;
    border: 1px solid var(--kci-border);
    border-radius: 6px;
    font-size: 0.85rem;
}

.test-detail {
    color: var(--kci-text);
}

.test-detail strong {
    color: var(--kci-text-muted);
    font-weight: 500;
}

/* ── Public status page ── */

/* ── Help page ── */

.help-toc {
    background: var(--kci-blue-light);
    border-left: 3px solid var(--kci-blue);
    padding: 0.75rem 1rem 0.75rem 1.25rem;
    border-radius: 0 6px 6px 0;
    margin-bottom: 1.5rem;
}

.help-toc b {
    color: var(--kci-navy);
}

.help-toc ol {
    margin: 0.4rem 0 0;
    padding-left: 1.25rem;
    columns: 2;
    column-gap: 2rem;
}

.help-toc a {
    font-size: 0.9rem;
}

article[id] h3 {
    color: var(--kci-navy);
    margin-bottom: 0.5rem;
}

article[id] h4 {
    margin-top: 1.25rem;
    margin-bottom: 0.4rem;
}

article[id] pre {
    background: var(--kci-dark);
    color: #e8e8e8;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.82rem;
    overflow-x: auto;
}

article[id] pre code {
    color: var(--kci-blue);
    background: none;
    padding: 0;
}

/* ── Public status page ── */

.status-page-header {
    text-align: center;
    margin: 1rem 0 0.75rem;
}

.status-page-header h1 {
    color: var(--kci-navy);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.overall-banner {
    padding: 0.35rem 1.25rem;
    border-radius: 5px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
}

.overall-ok {
    background: var(--kci-green-light);
    color: var(--kci-green-dark);
}

.overall-warning {
    background: #fff3cd;
    color: #7a6400;
}

.overall-critical {
    background: var(--kci-red-light);
    color: #8b2010;
}

.overall-maintenance {
    background: var(--kci-blue-light);
    color: var(--kci-blue-dark);
}

/* ── Maintenance notices (public status page) ── */

.maintenance-notice {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.6rem;
    font-size: 0.85rem;
    line-height: 1.5;
}

.maintenance-active {
    background: #fff3cd;
    border-left: 4px solid #c28b00;
    color: #664d03;
}

.maintenance-upcoming {
    background: var(--kci-blue-light);
    border-left: 4px solid var(--kci-blue);
    color: var(--kci-navy);
}

.maintenance-notice-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    line-height: 1.4;
}

.maintenance-notice-body strong {
    display: block;
    margin-bottom: 0.2rem;
}

.maintenance-notice-item {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem 0.75rem;
    padding: 0.15rem 0;
}

.maintenance-notice-name {
    font-weight: 500;
}

.maintenance-notice-time {
    font-size: 0.8rem;
    opacity: 0.8;
    font-variant-numeric: tabular-nums;
}

.maintenance-notice-endpoints {
    font-size: 0.8rem;
    opacity: 0.75;
    width: 100%;
}

.changelog-details {
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.85rem;
}
.changelog-details summary {
    cursor: pointer;
    font-size: 0.82rem;
    opacity: 0.8;
}
.changelog-details .changelog-md {
    margin-top: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: var(--kci-card-bg, rgba(0,0,0,0.05));
    border-radius: 6px;
    line-height: 1.5;
}
.changelog-md h3, .changelog-md h4, .changelog-md h5 {
    margin: 0.5rem 0 0.2rem;
    font-size: 0.9rem;
}
.changelog-md ul {
    margin: 0.2rem 0;
    padding-left: 1.2rem;
}
.changelog-md li {
    margin-bottom: 0.1rem;
}
.changelog-md code {
    font-size: 0.82em;
    padding: 0.1em 0.35em;
    background: rgba(0,0,0,0.08);
    border-radius: 3px;
}
.changelog-md p {
    margin: 0.25rem 0;
}

/* Service rows */
/* ── Range toggle ── */

.range-toggle {
    display: flex;
    justify-content: center;
    gap: 2px;
    margin-bottom: 0.75rem;
}

.range-btn {
    background: var(--kci-bg);
    border: 1px solid var(--kci-border);
    padding: 0.2rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--kci-text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    width: auto;
    display: inline-block;
    margin: 0;
    line-height: 1.4;
}

.range-btn:first-child { border-radius: 4px 0 0 4px; }
.range-btn:last-child { border-radius: 0 4px 4px 0; }

.range-btn.active {
    background: var(--kci-navy);
    color: #fff;
    border-color: var(--kci-navy);
}

.range-btn:hover:not(.active) {
    background: var(--kci-gray);
}

.status-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.status-row {
    border: 1px solid var(--kci-border);
    border-bottom: none;
    padding: 0.5rem 1rem 0.3rem;
    background: #fff;
}

.status-row:first-child {
    border-radius: 8px 8px 0 0;
}

.status-row:last-child {
    border-bottom: 1px solid var(--kci-border);
    border-radius: 0 0 8px 8px;
}

.status-row:only-child {
    border-radius: 8px;
    border-bottom: 1px solid var(--kci-border);
}

.status-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.2rem;
}

.status-row-name {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.status-row-name strong {
    font-size: 0.88rem;
    color: var(--kci-text);
}

.status-row-name .subname {
    color: var(--kci-text-muted);
    font-size: 0.85rem;
}

.status-row-uptime {
    font-size: 0.75rem;
    color: var(--kci-text-muted);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* Colored dot */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-ok { background: var(--kci-green); }
.dot-warning { background: var(--kci-yellow); }
.dot-critical { background: var(--kci-red); }
.dot-nodata { background: var(--kci-border); }
.dot-maintenance { background: var(--kci-blue); }
.dot-ok-maintenance { background: linear-gradient(135deg, var(--kci-green) 50%, var(--kci-blue) 50%); }
.dot-warning-maintenance { background: linear-gradient(135deg, var(--kci-yellow) 50%, var(--kci-blue) 50%); }
.dot-critical-maintenance { background: linear-gradient(135deg, var(--kci-red) 50%, var(--kci-blue) 50%); }
.dot-nodata-maintenance { background: linear-gradient(135deg, var(--kci-gray) 50%, var(--kci-blue) 50%); }

/* Timeline bar — 96 slots, 24h */
.timeline-bar {
    display: flex;
    gap: 1px;
    height: 18px;
    border-radius: 2px;
    overflow: hidden;
}

.timeline-slot {
    flex: 1;
    min-width: 0;
    border-radius: 1px;
    transition: opacity 0.12s;
    cursor: default;
}

.timeline-slot:hover {
    opacity: 0.65;
}

.slot-ok { background: var(--kci-green); }
.slot-warning { background: var(--kci-yellow); }
.slot-critical { background: var(--kci-red); }
.slot-nodata { background: var(--kci-gray); }
.slot-maintenance { background: var(--kci-blue); }
.slot-ok-maintenance { background: linear-gradient(135deg, var(--kci-green) 50%, var(--kci-blue) 50%); }
.slot-warning-maintenance { background: linear-gradient(135deg, var(--kci-yellow) 50%, var(--kci-blue) 50%); }
.slot-critical-maintenance { background: linear-gradient(135deg, var(--kci-red) 50%, var(--kci-blue) 50%); }
.slot-nodata-maintenance { background: linear-gradient(135deg, var(--kci-gray) 50%, var(--kci-blue) 50%); }

/* .timeline-labels removed — replaced by global range toggle */

/* ── Expand/collapse checks ── */

.expand-toggle {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    line-height: 1;
    font-size: 0.7rem;
    color: var(--kci-text-muted);
    transition: transform 0.15s;
}

.expand-arrow {
    display: inline-block;
    transition: transform 0.15s;
}

.status-row.expanded .expand-arrow {
    transform: rotate(90deg);
}

.checks-detail {
    display: none;
    margin-top: 0.5rem;
    padding: 0.4rem 0 0.2rem 1.4rem;
    border-top: 1px solid var(--kci-gray);
}

.status-row.expanded .checks-detail {
    display: block;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    font-size: 0.85rem;
}

.check-name {
    color: var(--kci-text);
    flex: 1;
}

/* ── Status page footer ── */

.status-footer {
    text-align: center;
    margin-top: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--kci-gray);
    color: var(--kci-text-muted);
    font-size: 0.75rem;
}

.status-footer p {
    margin-bottom: 0.25rem;
}

.status-footer a {
    color: var(--kci-text-muted);
}

.status-footer a:hover {
    color: var(--kci-navy);
}

.status-empty {
    text-align: center;
    color: var(--kci-text-muted);
    padding: 3rem 0;
}

/* Color legend */
.status-legend {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--kci-gray);
    font-size: 0.8rem;
    color: var(--kci-text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-tz {
    font-style: italic;
    opacity: 0.7;
}

/* ── Loading spinner ── */

.status-spinner {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999;
    color: var(--kci-text-muted);
    font-size: 0.95rem;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--kci-gray);
    border-top-color: var(--kci-navy);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

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

/* ── Incident badges ── */

.badge-incident-detected { background: var(--kci-red); }
.badge-incident-acknowledged { background: #b8860b; color: #fff; }
.badge-incident-investigating { background: #7c3aed; }
.badge-incident-identified { background: var(--kci-blue-dark); }
.badge-incident-monitoring { background: #0891b2; }
.badge-incident-resolved { background: var(--kci-green-dark); }

.badge-incident-type-status_change { background: var(--kci-blue-dark); font-size: 0.65rem; }
.badge-incident-type-comment { background: var(--kci-gray-dim); font-size: 0.65rem; }
.badge-incident-type-handover { background: #7c3aed; font-size: 0.65rem; }
.badge-incident-type-auto_resolve { background: var(--kci-green-dark); font-size: 0.65rem; }
.badge-incident-type-assignment { background: #0891b2; font-size: 0.65rem; }

/* ── Incident detail: timeline ── */

.incident-timeline {
    position: relative;
    padding-left: 1.5rem;
    margin: 1rem 0;
}

.incident-timeline::before {
    content: "";
    position: absolute;
    left: 0.45rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--kci-border);
}

.incident-timeline-entry {
    position: relative;
    padding: 0.5rem 0 0.75rem 1rem;
}

.incident-timeline-dot {
    position: absolute;
    left: -1.2rem;
    top: 0.65rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--kci-border);
    border: 2px solid #fff;
}

.incident-timeline-dot.dot-ok { background: var(--kci-green); }
.incident-timeline-dot.dot-status { background: var(--kci-blue); }
.incident-timeline-dot.dot-handover { background: #7c3aed; }
.incident-timeline-dot.dot-comment { background: var(--kci-gray-dim); }

.incident-timeline-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.82rem;
    margin-bottom: 0.2rem;
}

.incident-timeline-message {
    font-size: 0.85rem;
    color: var(--kci-text);
    margin: 0.2rem 0 0;
    line-height: 1.5;
}

/* ── Incident notice on public status page ── */

.incidents-notice {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.6rem;
    font-size: 0.85rem;
    line-height: 1.5;
    background: var(--kci-red-light);
    border-left: 4px solid var(--kci-red);
    color: #8b2010;
}

.incident-notice-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem 0.5rem;
    padding: 0.2rem 0;
}

.incident-notice-title {
    font-weight: 500;
}

.incident-notice-assignee {
    color: #8b2010;
    opacity: 0.75;
}

.incident-notice-message {
    width: 100%;
    margin: 0.15rem 0 0;
    font-style: italic;
    font-size: 0.82rem;
    opacity: 0.85;
}

/* ── Incident header section ── */

.incident-header {
    margin-bottom: 1rem;
}

/* ── Public incident history (collapsed) ── */

.incident-history-section {
    margin-top: 1.25rem;
    border-color: var(--kci-border);
}

.incident-history-section > summary {
    color: var(--kci-text-muted);
    font-size: 0.85rem;
    background: #f8f9fb;
}

.incident-history-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.incident-history-row {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--kci-gray);
}

.incident-history-row:last-child {
    border-bottom: none;
}

.incident-history-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
}

.incident-history-header strong {
    color: var(--kci-text);
}

.incident-history-endpoint {
    color: var(--kci-text-muted);
    font-size: 0.8rem;
}

.incident-history-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.78rem;
    color: var(--kci-text-muted);
    margin-top: 0.15rem;
    font-variant-numeric: tabular-nums;
}

.incident-history-duration {
    font-weight: 500;
}

.badge-incident-type {
    background: var(--kci-blue-dark);
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
}

.badge-outage-type {
    background: var(--kci-red);
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
}

.incident-history-postmortem {
    font-size: 0.82rem;
    color: var(--kci-text);
    margin: 0.3rem 0 0;
    padding: 0.4rem 0.6rem;
    background: #f8f9fb;
    border-left: 3px solid var(--kci-border);
    border-radius: 0 4px 4px 0;
    line-height: 1.5;
}

/* HTMX indicator: hidden by default, shown when request in flight */
.htmx-indicator {
    display: none !important;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: flex !important;
}
