:root {
    color-scheme: light;
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-strong: #f9fbfd;
    --line: #d9e1ea;
    --line-strong: #bdc9d7;
    --text: #17202a;
    --muted: #66758a;
    --soft: #eef3f8;
    --accent: #0f8f83;
    --accent-strong: #0b6f67;
    --blue: #2869d8;
    --warn: #a86500;
    --danger: #b42335;
    --success: #157347;
    --shadow: rgba(31, 45, 61, 0.12);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
.button,
.primary,
.secondary,
.danger-btn {
    border: 0;
    border-radius: 7px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 14px;
    text-decoration: none;
    font-weight: 750;
}

.primary {
    background: var(--accent);
    color: #fff;
}

.primary:hover {
    background: var(--accent-strong);
}

.secondary,
.button {
    background: var(--soft);
    color: var(--text);
    border: 1px solid var(--line);
}

.danger-btn {
    background: #fff1f2;
    color: var(--danger);
    border: 1px solid #ffc9d0;
}

.full {
    width: 100%;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    background: #fff;
    color: var(--text);
    padding: 10px 11px;
    outline: none;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 143, 131, 0.16);
}

label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 7px;
}

code,
pre {
    font-family: "Cascadia Mono", "Consolas", ui-monospace, Menlo, monospace;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 10% 18%, rgba(15, 143, 131, 0.13), transparent 28%),
        radial-gradient(circle at 90% 12%, rgba(40, 105, 216, 0.11), transparent 32%),
        var(--bg);
}

.login-card {
    width: min(440px, 100%);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 24px 70px var(--shadow);
    padding: 28px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.login-brand h1 {
    font-size: 22px;
    margin: 0 0 3px;
}

.login-brand p,
.login-note {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.login-card form {
    display: grid;
    gap: 12px;
}

.login-note {
    margin-top: 18px;
    text-align: center;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
    background: #ffffff;
    border-right: 1px solid var(--line);
    padding: 20px;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 22px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: inline-grid;
    place-items: center;
    background: var(--accent);
    color: #fff;
    font-weight: 900;
    flex: 0 0 auto;
}

.brand strong {
    display: block;
    font-size: 15px;
}

.brand small {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

.nav-list {
    display: grid;
    align-content: start;
    gap: 6px;
}

.nav-list a,
.nav-terminal {
    min-height: 40px;
    border-radius: 7px;
    padding: 10px 12px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 750;
    background: transparent;
    border: 0;
    text-align: left;
}

.nav-list a:hover,
.nav-terminal:hover,
.nav-list a.active {
    background: var(--soft);
    color: var(--text);
}

.logout-box {
    border-top: 1px solid var(--line);
    padding-top: 14px;
    display: grid;
    gap: 10px;
}

.logout-box span {
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.logout-box button {
    background: transparent;
    border: 1px solid var(--line-strong);
    color: var(--text);
}

.main {
    padding: 28px;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.topbar h1 {
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.1;
    margin: 0;
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.terminal-launch {
    background: #111827;
    color: #fff;
}

.notice {
    border: 1px solid var(--line);
    border-left-width: 4px;
    background: #fff;
    border-radius: 7px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.notice.success {
    border-left-color: var(--success);
}

.notice.info {
    border-left-color: var(--blue);
}

.notice.danger {
    border-left-color: var(--danger);
    color: var(--danger);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric-card,
.panel,
.table-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 14px 42px rgba(31, 45, 61, 0.06);
}

.metric-card {
    padding: 18px;
    min-height: 134px;
    display: grid;
    align-content: space-between;
    gap: 10px;
}

.metric-card span,
.metric-card small {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.metric-card strong {
    font-size: 22px;
    overflow-wrap: anywhere;
}

.meter {
    height: 8px;
    overflow: hidden;
    border-radius: 99px;
    background: #e6edf5;
}

.meter span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--blue));
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    margin-bottom: 18px;
}

.panel {
    padding: 18px;
}

.panel + .panel,
.table-panel + .panel {
    margin-top: 18px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.panel-head h2 {
    margin: 0;
    font-size: 18px;
}

.soft-link {
    color: var(--accent);
    font-weight: 800;
    text-decoration: none;
}

.service-list,
.path-list {
    display: grid;
    gap: 10px;
}

.service-list div,
.path-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    border-bottom: 1px solid var(--line);
}

.service-list div:last-child,
.path-list div:last-child {
    border-bottom: 0;
}

.service-list span,
.path-list span {
    color: var(--muted);
    font-weight: 750;
}

.path-list code {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 6px 8px;
    overflow-wrap: anywhere;
}

.status {
    border-radius: 99px;
    padding: 4px 8px;
    background: var(--soft);
}

.status.active {
    color: var(--success);
    background: #edf9f2;
}

.status.failed,
.status.inactive {
    color: var(--danger);
    background: #fff1f2;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.action-tile {
    min-height: 72px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    border-radius: 8px;
    padding: 14px;
    color: var(--text);
    text-decoration: none;
    font-weight: 850;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.action-tile:hover {
    border-color: var(--accent);
}

.vterm-overlay {
    position: fixed;
    inset: 24px;
    z-index: 80;
    display: grid;
    grid-template-rows: 48px minmax(0, 1fr);
    background: #070b10;
    border: 1px solid #273241;
    border-radius: 8px;
    box-shadow: 0 24px 90px rgba(0, 0, 0, 0.42);
    overflow: hidden;
}

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

.vterm-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    color: #e7edf6;
    background: #121a25;
    border-bottom: 1px solid #273241;
}

.vterm-bar button {
    background: #263241;
    color: #e7edf6;
}

.vterm-overlay iframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: #070b10;
}

.overlay-open {
    overflow: hidden;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-grid .wide {
    grid-column: 1 / -1;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.table-wrap {
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 11px 10px;
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

td code {
    background: var(--soft);
    border-radius: 5px;
    padding: 4px 6px;
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        grid-template-rows: auto auto auto;
    }

    .nav-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .metric-grid,
    .content-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .terminal-launch {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .main,
    .sidebar {
        padding: 16px;
    }

    .action-grid,
    .nav-list {
        grid-template-columns: 1fr;
    }

    .service-list div,
    .path-list div {
        align-items: flex-start;
        flex-direction: column;
        padding-bottom: 10px;
    }

    .vterm-overlay {
        inset: 0;
        border-radius: 0;
    }
}
