/* Custom scrollbar styling */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--bg-secondary);
}

*::-webkit-scrollbar {
    width: 10px;
    background: var(--bg-secondary);
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(120deg, var(--accent) 0%, var(--accent-soft) 100%);
    border-radius: 8px;
    min-height: 40px;
}

*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(120deg, var(--accent-soft) 0%, var(--accent) 100%);
}

*::-webkit-scrollbar-corner {
    background: var(--bg-secondary);
}
:root {
    --bg-main: #091626;
    --bg-secondary: #10283d;
    --text-main: #f2f6fb;
    --text-dim: #89a5bf;
    --accent: #00d3c7;
    --accent-soft: #20b8ff;
    --error: #f15168;
    --warning: #ffb449;
    --running: #3ddc97;
    --not-running: #7f8da1;
    --panel-border: rgba(255, 255, 255, 0.11);
    --panel-bg: rgba(14, 32, 49, 0.82);
    --shadow: 0 24px 50px rgba(0, 0, 0, 0.35);
    --radius-xl: 24px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    font-family: 'Sora', 'Space Grotesk', 'Avenir Next', 'Segoe UI', sans-serif;
    background: radial-gradient(circle at 10% 10%, #15385a 0%, var(--bg-main) 38%, #060f1a 100%);
    color: var(--text-main);
    min-height: 100vh;
    overflow-y: auto;
}

body.auth-required .layout {
    filter: blur(5px) saturate(0.85);
    pointer-events: none;
    user-select: none;
}

.auth-overlay {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 40;
    background: linear-gradient(180deg, rgba(5, 14, 25, 0.72), rgba(6, 16, 30, 0.9));
    padding: 1rem;
}

.auth-overlay[hidden] {
    display: none;
}

.auth-card {
    width: min(440px, 100%);
    background: linear-gradient(140deg, rgba(9, 30, 48, 0.96), rgba(7, 24, 39, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 1.2rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.auth-help {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.auth-label {
    font-size: 0.82rem;
    color: var(--text-dim);
}

.auth-input {
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(6, 23, 38, 0.9);
    color: var(--text-main);
    padding: 0.7rem 0.8rem;
    font-size: 0.96rem;
}

.auth-input:focus {
    outline: 2px solid rgba(0, 211, 199, 0.45);
    border-color: transparent;
}

.auth-error {
    color: #ff8f9f;
    font-size: 0.85rem;
}

.auth-submit {
    margin-top: 0.25rem;
    width: fit-content;
}

.page-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
    opacity: 0.32;
    animation: pulse 16s ease-in-out infinite;
}

.orb-a {
    width: 34rem;
    height: 34rem;
    background: #00c7aa;
    top: -9rem;
    right: -6rem;
}

.orb-b {
    width: 26rem;
    height: 26rem;
    background: #1d88d9;
    bottom: -8rem;
    left: -7rem;
    animation-delay: -8s;
}

.grid-noise {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(circle at center, black 45%, transparent 90%);
}

.layout {
    position: relative;
    z-index: 1;
    width: min(1240px, 100% - 2rem);
    margin: 2.4rem auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.header {
    background: linear-gradient(120deg, rgba(12, 32, 51, 0.9), rgba(8, 25, 45, 0.75));
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-xl);
    padding: 1.4rem 1.6rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--accent);
    font-size: 0.72rem;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: clamp(1.4rem, 2vw, 2rem);
    letter-spacing: 0.015em;
}

h2 {
    font-size: 1.08rem;
}

.header-meta {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pill {
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 0.48rem 0.84rem;
    color: var(--text-dim);
    font-size: 0.82rem;
}

.refresh-button {
    border: 1px solid rgba(0, 211, 199, 0.5);
    background: linear-gradient(120deg, rgba(0, 211, 199, 0.2), rgba(0, 138, 158, 0.12));
    color: #dff9ff;
    border-radius: 999px;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    font-weight: 600;
}

.ghost-button {
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.04);
    color: #d7e3ef;
    border-radius: 999px;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    font-weight: 600;
}

.ghost-button:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.1);
}

.dashboard {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 1rem;
    min-height: 70vh;
}

.services-panel,
.logs-panel {
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-xl);
    background: var(--panel-bg);
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow);
}

.services-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 1.1rem 1.1rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
}

.panel-header p {
    color: var(--text-dim);
    font-size: 0.84rem;
}

.services-list {
    display: flex;
    flex-direction: column;
    padding: 0.7rem;
    gap: 0.55rem;
    max-height: calc(70vh - 80px);
    overflow: auto;
}

.service-card {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    background: rgba(10, 30, 46, 0.78);
    padding: 0.82rem;
    text-align: left;
    color: var(--text-main);
    cursor: pointer;
    transition: transform 120ms ease, border-color 120ms ease, background-color 120ms ease;
}

.service-card:hover {
    border-color: rgba(0, 211, 199, 0.36);
}

.service-card.active {
    border-color: var(--accent);
    background: rgba(8, 41, 56, 0.92);
}

.service-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
}

.service-name {
    font-weight: 700;
    letter-spacing: 0.01em;
}

.service-update {
    color: var(--text-dim);
    font-size: 0.79rem;
}

.status-chip {
    padding: 0.24rem 0.56rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}

.status-running {
    background: rgba(61, 220, 151, 0.18);
    color: var(--running);
}

.status-warning {
    background: rgba(255, 180, 73, 0.18);
    color: var(--warning);
}

.status-error {
    background: rgba(241, 81, 104, 0.2);
    color: var(--error);
}

.status-not-running {
    background: rgba(127, 141, 161, 0.2);
    color: #b6c0ce;
}

.logs-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.logs-container {
    padding: 0.9rem;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.66rem;
    max-height: calc(70vh - 80px);
}

.logs-container.empty {
    display: grid;
    place-items: center;
}

.empty-state {
    color: var(--text-dim);
}

.log-row {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 4px solid transparent;
    border-radius: var(--radius-md);
    padding: 0.75rem 0.85rem;
    background: rgba(9, 26, 40, 0.88);
    animation: rise 180ms ease;
}

.log-row.error {
    border-left-color: var(--error);
}

.log-row.warning {
    border-left-color: var(--warning);
}

.log-row.info {
    border-left-color: var(--accent-soft);
}

.log-row.ignored {
    opacity: 0.6;
}

.log-row-meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-dim);
    font-size: 0.79rem;
    margin-bottom: 0.45rem;
}

.log-type {
    font-weight: 700;
    letter-spacing: 0.03em;
}

.log-message {
    margin-bottom: 0.65rem;
    line-height: 1.4;
    word-break: break-word;
}

.log-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.ignore-state {
    font-size: 0.77rem;
    color: var(--text-dim);
}

.ignore-button {
    border: 1px solid rgba(0, 211, 199, 0.4);
    background: rgba(0, 211, 199, 0.14);
    color: #d5fffb;
    border-radius: 999px;
    padding: 0.38rem 0.78rem;
    cursor: pointer;
    font-weight: 600;
}

.ignore-button[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 1020px) {
    .dashboard {
        grid-template-columns: 1fr;
    }

    .services-list,
    .logs-container {
        max-height: none;
    }
}

@media (max-width: 640px) {
    .layout {
        width: min(1240px, 100% - 1rem);
        margin: 1rem auto;
    }

    .header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .header-meta {
        width: 100%;
        justify-content: flex-start;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.12);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
