:root {
    color-scheme: dark;
    --bg: #0a1017;
    --panel: #121a24;
    --panel-soft: #101823;
    --border: #243142;
    --text: #e8eef5;
    --muted: #95a7ba;
    --accent: #6ec6ff;
    --ok: #74d99c;
    --warn: #ff8b8b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 1rem;
    color: var(--text);
    font-family: 'Chivo Mono', 'Space Grotesk', system-ui, sans-serif;
    background:
        radial-gradient(circle at 0% 0%, rgba(110, 198, 255, 0.12), transparent 32%),
        radial-gradient(circle at 100% 100%, rgba(116, 217, 156, 0.1), transparent 30%),
        var(--bg);
}

.is-hidden {
    display: none !important;
}

.live-meta {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    flex-wrap: wrap;
    margin-bottom: 0.8rem;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    padding: 0.45rem 0.65rem;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warn);
}

.status-indicator.live .status-dot {
    background: var(--ok);
}

.remote-access-state {
    border-color: rgba(116, 217, 156, 0.35);
    color: var(--ok);
}

.remote-access-state.remote-off {
    border-color: rgba(255, 139, 139, 0.35);
    color: var(--warn);
}

header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

header > div:first-child {
    align-self: flex-start;
}

h1 {
    margin: 0;
    font-size: clamp(1.8rem, 3.2vw, 2.6rem);
    line-height: 1;
    letter-spacing: 0.02em;
}

.subtitle {
    margin: 0.3rem 0 0;
    color: var(--muted);
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

button,
.nav-link,
.row-action {
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #111a25;
    color: var(--text);
    padding: 0.55rem 0.8rem;
    font: inherit;
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

button:hover,
.nav-link:hover,
.row-action:hover {
    border-color: var(--accent);
    background: #132133;
}

button:disabled,
.row-action:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

button.is-loading {
    opacity: 0.7;
    cursor: progress;
}

.control-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.32rem 0.5rem;
}

.control-pill select,
.control-pill input[type="number"] {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #0e1621;
    color: var(--text);
    padding: 0.3rem 0.4rem;
    font: inherit;
    font-size: 0.82rem;
}

.control-pill input[type="number"] {
    width: 68px;
}

.control-pill select:focus,
.control-pill input[type="number"]:focus,
input[type="password"]:focus {
    outline: 2px solid rgba(110, 198, 255, 0.45);
    outline-offset: 1px;
}

.control-pill .chevron {
    display: none;
}

.launch-progress {
    width: 140px;
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.12);
}

.launch-progress__fill {
    width: 0%;
    height: 100%;
    background: var(--accent);
    transition: width 0.2s ease;
}

.launch-progress.is-hidden {
    display: none !important;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.55rem;
    margin-bottom: 0.75rem;
}

.stat-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, var(--panel), var(--panel-soft));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem;
}

.stat-label {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.stat-value {
    margin-top: 0.35rem;
    font-size: 1.65rem;
}

.stat-trend {
    position: absolute;
    inset: 0;
    opacity: 0.5;
    pointer-events: none;
}

.stat-trend svg {
    width: 100%;
    height: 100%;
}

.trend-line {
    fill: none;
    stroke-width: 1.2;
}

.trend-area {
    opacity: 0.3;
}

.trend-line-cpu,
.trend-line-mem {
    stroke: var(--accent);
}

.trend-area-cpu,
.trend-area-mem {
    fill: rgba(110, 198, 255, 0.22);
}

.section-title {
    margin: 0 0 0.5rem;
    color: var(--muted);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: linear-gradient(180deg, var(--panel), var(--panel-soft));
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

thead {
    background: rgba(255, 255, 255, 0.02);
}

th,
td {
    padding: 0.7rem 0.65rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.82rem;
}

th {
    color: var(--muted);
    user-select: none;
}

th[data-sort-key] {
    cursor: pointer;
}

tbody tr:last-child td {
    border-bottom: none;
}

.status-pill,
.health-pill,
.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 0.72rem;
    padding: 0.22rem 0.55rem;
    border: 1px solid transparent;
    text-transform: uppercase;
}

.running,
.health-healthy {
    background: rgba(116, 217, 156, 0.15);
    color: var(--ok);
}

.exited,
.health-unhealthy {
    background: rgba(255, 139, 139, 0.15);
    color: var(--warn);
}

.health-starting {
    background: rgba(255, 220, 129, 0.16);
    color: #ffdc81;
}

.pill-outline-python,
.pill-outline-java,
.pill-outline-service {
    border-width: 1px;
    border-style: solid;
}

.pill-outline-python {
    border-color: rgba(116, 217, 156, 0.9);
    color: #8bf0b4;
    background: rgba(116, 217, 156, 0.12);
}

.pill-outline-java {
    border-color: rgba(255, 173, 102, 0.9);
    color: #ffc48b;
    background: rgba(255, 173, 102, 0.12);
}

.pill-outline-service {
    border-color: rgba(110, 198, 255, 0.85);
    color: #9bd9ff;
    background: rgba(110, 198, 255, 0.12);
}

.pill-code {
    margin-left: 0.3rem;
    font-size: 0.75rem;
    color: var(--muted);
}

.container-name {
    font-size: 0.95rem;
}

.container-subtitle {
    color: var(--muted);
    font-size: 0.72rem;
}

.row-action {
    margin-right: 0.35rem;
    padding: 0.35rem 0.58rem;
}

.row-action.danger {
    border-color: rgba(255, 139, 139, 0.4);
    color: var(--warn);
}

.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 1.4rem;
}

footer {
    margin-top: 0.9rem;
    color: var(--muted);
    font-size: 0.78rem;
    text-align: center;
}

.chip {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    font-size: 0.7rem;
    color: var(--muted);
    text-transform: uppercase;
}

.auth-layer {
    position: fixed;
    inset: 0;
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(7, 11, 17, 0.82);
}

.auth-card {
    width: min(420px, 100%);
    background: linear-gradient(180deg, var(--panel), var(--panel-soft));
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem;
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    margin-top: 0.75rem;
}

.auth-card label {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

input[type="password"] {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #0d1520;
    color: var(--text);
    font: inherit;
    padding: 0.48rem 0.55rem;
}

.auth-hint {
    min-height: 1rem;
    color: var(--muted);
    font-size: 0.78rem;
    margin-top: 0.45rem;
}

.tutorial-layer {
    position: fixed;
    inset: 0;
    z-index: 110;
    pointer-events: none;
}

.tutorial-scrim {
    position: absolute;
    inset: 0;
    background: rgba(8, 12, 18, 0.55);
}

.tutorial-card {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    width: min(430px, calc(100vw - 2rem));
    pointer-events: auto;
    background: linear-gradient(180deg, var(--panel), var(--panel-soft));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.9rem;
}

.tutorial-card h2 {
    margin: 0.35rem 0 0;
}

.tutorial-actions {
    display: flex;
    gap: 0.45rem;
    margin-top: 0.75rem;
}

.tutorial-actions button {
    flex: 1;
}

body.tutorial-active .tutorial-dim-target,
body.tutorial-active .live-meta {
    filter: blur(2px) brightness(0.65);
}

body.tutorial-active .tutorial-dim-target.tutorial-focus {
    filter: none;
    position: relative;
    z-index: 120;
    outline: 1px solid rgba(110, 198, 255, 0.45);
    border-radius: 10px;
}

@media (max-width: 900px) {
    body {
        padding: 0.8rem;
    }

    .toolbar {
        width: 100%;
    }

    th,
    td {
        font-size: 0.76rem;
        padding: 0.55rem 0.45rem;
    }
}
