/* Public status pages – standalone look, independent of admin styles */
:root {
    --sp-bg: #10151f;
    --sp-surface: #171e2b;
    --sp-line: #232c3d;
    --sp-text: #e7ebf3;
    --sp-muted: #8b95a9;
    --sp-faint: #5c6679;
    --sp-up: #3fbf8f;
    --sp-down: #f0566a;
    --sp-partial: #f2a63a;
    --sp-paused: #7c8597;
    --sp-new: #6c9cf5;
    --sp-empty: #252e40;
    --sp-rt: #5f86c9;
    --sp-brand: #c2306f;
    --sp-radius: 14px;
}

body.sp-body {
    background: var(--sp-bg);
    color: var(--sp-text);
    font-family: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    font-feature-settings: "tnum" 1;
    -webkit-font-smoothing: antialiased;
}

.sp-wrap {
    max-width: 760px;
    margin: 0 auto;
    padding: 56px 20px 32px;
}

/* Hero: the overall status is the headline */
.sp-hero {
    margin-bottom: 40px;
}
.sp-pagename {
    color: var(--sp-muted);
    font-size: 1rem;
    font-weight: 500;
    margin: 0 0 14px;
}
.sp-headline {
    display: flex;
    align-items: center;
    gap: 18px;
    margin: 0;
    font-size: clamp(1.9rem, 5vw, 2.75rem);
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.1;
}
.sp-meta {
    margin-top: 14px;
    color: var(--sp-faint);
    font-size: 0.8rem;
}

/* Pulsing heartbeat dot */
.sp-pulse {
    --c: var(--sp-up);
    position: relative;
    flex: none;
    width: 16px;
    height: 16px;
    margin-left: 5px;
    border-radius: 50%;
    background: var(--c);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 18%, transparent);
}
.sp-pulse::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--c);
    animation: sp-ping 2.4s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
}
.sp-pulse.is-partial { --c: var(--sp-partial); }
.sp-pulse.is-major { --c: var(--sp-down); }
.sp-pulse.is-paused { --c: var(--sp-paused); }
.sp-pulse.is-new { --c: var(--sp-new); }
.sp-pulse.is-paused::after { animation: none; opacity: 0; }
@keyframes sp-ping {
    0% { transform: scale(1); opacity: 0.8; }
    70%, 100% { transform: scale(3.2); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .sp-pulse::after { animation: none; opacity: 0; }
}

/* Section headings */
.sp-section-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 0 0 12px;
    font-size: 1.05rem;
    font-weight: 600;
}
.sp-section-title small {
    color: var(--sp-faint);
    font-size: 0.8rem;
    font-weight: 400;
}

/* Services panel */
.sp-panel {
    background: var(--sp-surface);
    border: 1px solid var(--sp-line);
    border-radius: var(--sp-radius);
    overflow: hidden;
    margin-bottom: 48px;
}
.sp-group + .sp-group {
    border-top: 1px solid var(--sp-line);
}
.sp-group-name {
    padding: 14px 22px 0;
    color: var(--sp-muted);
    font-size: 0.85rem;
    font-weight: 500;
}
.sp-row {
    display: block;
    padding: 16px 22px 18px;
    color: inherit;
    text-decoration: none;
    transition: background-color 0.15s ease;
}
.sp-row + .sp-row {
    border-top: 1px solid var(--sp-line);
}
.sp-row:hover {
    background: color-mix(in srgb, var(--sp-text) 3%, transparent);
    color: inherit;
}
.sp-row:focus-visible {
    outline: 2px solid var(--sp-new);
    outline-offset: -2px;
}
.sp-row-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.sp-name {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-weight: 600;
}
.sp-name span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sp-name .bi-chevron-right {
    color: var(--sp-faint);
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.sp-row:hover .sp-name .bi-chevron-right {
    opacity: 1;
    transform: translateX(2px);
}
.sp-dot {
    flex: none;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--sp-paused);
}
.sp-dot.is-up { background: var(--sp-up); }
.sp-dot.is-down { background: var(--sp-down); }
.sp-dot.is-new { background: var(--sp-new); }
.sp-state {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--sp-muted);
}
.sp-state.is-down { color: var(--sp-down); }
.sp-uptime {
    flex: none;
    text-align: right;
    font-size: 0.85rem;
    color: var(--sp-muted);
}
.sp-uptime strong {
    color: var(--sp-text);
    font-weight: 600;
}

/* Timeline bars (markup from View::renderTimeline) */
.sp-bars {
    display: flex;
    gap: 3px;
    height: 30px;
}
.sp-bars .timeline-dot {
    flex: 1;
    height: 100%;
    border-radius: 3px;
    background: var(--sp-empty);
    transition: transform 0.12s ease, filter 0.12s ease;
}
.sp-bars .timeline-dot:hover {
    transform: scaleY(1.15);
    filter: brightness(1.2);
}
.sp-bars .timeline-dot.up { background: var(--sp-up); }
.sp-bars .timeline-dot.down { background: var(--sp-down); }
.sp-bars .timeline-dot.partial { background: var(--sp-partial); }
.sp-axis {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    color: var(--sp-faint);
    font-size: 0.72rem;
}

/* Incident history */
.sp-day {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 16px;
    padding: 14px 0;
    border-top: 1px solid var(--sp-line);
}
.sp-day-date {
    color: var(--sp-muted);
    font-size: 0.85rem;
    padding-top: 2px;
}
.sp-incident + .sp-incident {
    margin-top: 10px;
}
.sp-incident-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}
.sp-incident-time {
    margin-left: 17px;
    color: var(--sp-muted);
    font-size: 0.85rem;
}
.sp-ongoing {
    color: var(--sp-down);
    font-weight: 600;
}
.sp-calm {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 0;
    border-top: 1px solid var(--sp-line);
    color: var(--sp-muted);
}
.sp-calm .bi {
    color: var(--sp-up);
    font-size: 1.1rem;
}
.sp-empty {
    padding: 40px 22px;
    text-align: center;
    color: var(--sp-muted);
}

/* Monitor detail */
.sp-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 28px;
    color: var(--sp-muted);
    font-size: 0.9rem;
    text-decoration: none;
}
.sp-back:hover {
    color: var(--sp-text);
}
.sp-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    margin: 16px 0 0;
    color: var(--sp-muted);
}
.sp-summary strong {
    color: var(--sp-text);
    font-weight: 600;
}
.sp-summary-sep {
    width: 1px;
    height: 14px;
    background: var(--sp-line);
}
.sp-state-text { font-weight: 600; color: var(--sp-up); }
.sp-state-text.is-major { color: var(--sp-down); }
.sp-state-text.is-paused { color: var(--sp-paused); }
.sp-state-text.is-new { color: var(--sp-new); }

.sp-section-title h2 {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
}
.sp-pager {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    font-weight: 400;
}
.sp-pager a,
.sp-pager .is-disabled {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    color: var(--sp-muted);
    text-decoration: none;
}
.sp-pager a:hover {
    background: var(--sp-surface);
    color: var(--sp-text);
}
.sp-pager a:focus-visible {
    outline: 2px solid var(--sp-new);
}
.sp-pager .is-disabled {
    color: var(--sp-empty);
}
.sp-pager-label {
    color: var(--sp-muted);
    padding: 0 4px;
}

.sp-month {
    padding: 16px 22px 18px;
}
.sp-month + .sp-month {
    border-top: 1px solid var(--sp-line);
}
.sp-month-head {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9rem;
    font-weight: 600;
}
.sp-month-value {
    color: var(--sp-muted);
    font-weight: 400;
}

/* Daily uptime grid (one bar per day) */
.sp-days {
    display: flex;
    gap: 3px;
    height: 34px;
}
.sp-days .uptime-day {
    flex: 1;
    border-radius: 3px;
    background: var(--sp-empty);
    cursor: pointer;
    transition: transform 0.12s ease, filter 0.12s ease;
}
.sp-days .uptime-day:hover {
    transform: scaleY(1.12);
    filter: brightness(1.2);
}
.sp-days .uptime-day.up { background: var(--sp-up); }
.sp-days .uptime-day.down { background: var(--sp-down); }
.sp-days .uptime-day.selected {
    outline: 2px solid var(--sp-text);
    outline-offset: 2px;
}

/* Response time bars – neutral tone, warning colours only when slow */
.sp-rt {
    display: flex;
    gap: 3px;
    align-items: flex-end;
    height: 72px;
}
.sp-rt .rt-bar {
    flex: 1;
    min-height: 2px;
    border-radius: 3px 3px 1px 1px;
    background: var(--sp-rt);
    transition: filter 0.12s ease;
}
.sp-rt .rt-bar:hover { filter: brightness(1.3); }
.sp-rt .rt-bar.medium { background: var(--sp-partial); }
.sp-rt .rt-bar.slow { background: var(--sp-down); }
.sp-rt .rt-bar.no-data { background: var(--sp-empty); }

/* Day detail panel */
.sp-day-detail {
    margin: -32px 0 48px;
    animation: sp-reveal 0.2s ease;
}
.sp-day-detail-body {
    padding: 18px 22px;
}
.sp-day-detail-title {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 600;
}
.sp-day-detail .sp-calm {
    border-top: 0;
    padding: 6px 0 0;
}
.sp-day-detail-count {
    margin: 0 0 8px;
    color: var(--sp-muted);
    font-size: 0.85rem;
}
.sp-day-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-top: 1px solid var(--sp-line);
}
.sp-day-detail-dur {
    color: var(--sp-muted);
}
@keyframes sp-reveal {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
    .sp-day-detail { animation: none; }
}

/* Footer */
.sp-footer {
    margin-top: 64px;
    padding-top: 20px;
    border-top: 1px solid var(--sp-line);
    color: var(--sp-faint);
    font-size: 0.8rem;
    text-align: right;
}
.sp-footer a {
    color: var(--sp-muted);
    text-decoration: none;
    border-bottom: 1px solid var(--sp-brand);
    transition: color 0.15s ease;
}
.sp-footer a:hover {
    color: var(--sp-text);
}

/* Password page */
.sp-lock {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.sp-lock-box {
    width: 100%;
    max-width: 380px;
}
.sp-lock-box h1 {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin: 0 0 6px;
}
.sp-lock-box p {
    color: var(--sp-muted);
    margin-bottom: 24px;
}
.sp-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--sp-surface);
    border: 1px solid var(--sp-line);
    border-radius: 10px;
    color: var(--sp-text);
    font: inherit;
}
.sp-input:focus {
    outline: none;
    border-color: var(--sp-new);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--sp-new) 25%, transparent);
}
.sp-btn {
    width: 100%;
    margin-top: 12px;
    padding: 12px 14px;
    border: 0;
    border-radius: 10px;
    background: var(--sp-text);
    color: var(--sp-bg);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s ease;
}
.sp-btn:hover { opacity: 0.9; }
.sp-btn:focus-visible {
    outline: 2px solid var(--sp-new);
    outline-offset: 2px;
}
.sp-btn:disabled,
.sp-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.sp-error {
    margin-bottom: 14px;
    padding: 10px 14px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--sp-down) 12%, transparent);
    color: var(--sp-down);
    font-size: 0.9rem;
}

@media (max-width: 576px) {
    .sp-wrap { padding-top: 32px; }
    .sp-row { padding: 14px 16px 16px; }
    .sp-group-name { padding: 12px 16px 0; }
    .sp-bars { gap: 2px; height: 26px; }
    .sp-day { grid-template-columns: 1fr; gap: 6px; }
    .sp-month { padding: 14px 16px 16px; }
    .sp-days, .sp-rt { gap: 2px; }
    .sp-pager-label { display: none; }
}
