:root {
    --bg: #f3f0e8;
    --card: #fffdf8;
    --ink: #1f2430;
    --muted: #6b6e76;
    --line: #d9d2c3;
    --primary: #0f6a5b;
    --primary-ink: #f4fff6;
    --warn: #a85c00;
    --radius: 16px;
    --shadow: 0 12px 28px rgba(24, 30, 43, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    color: var(--ink);
    background: radial-gradient(circle at 15% 10%, #fff9ed 0%, var(--bg) 45%),
                radial-gradient(circle at 95% 90%, #e8f6f3 0%, transparent 42%);
    min-height: 100vh;
}

.bg-grid {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(31, 36, 48, 0.03) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(31, 36, 48, 0.03) 1px, transparent 1px);
    background-size: 28px 28px;
}

.app-shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 20px;
    max-width: 1300px;
    margin: 24px auto;
    padding: 0 18px 24px;
}

.sidebar {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    padding: 20px;
    box-shadow: var(--shadow);
    height: calc(100vh - 48px);
    position: sticky;
    top: 24px;
}

.brand h1 {
    margin: 0;
    font-size: 1.6rem;
}

.brand p {
    margin: 4px 0 0;
    color: var(--muted);
}

.tabs {
    margin-top: 24px;
    display: grid;
    gap: 10px;
}

.tab {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 999px;
    padding: 11px 14px;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
}

.tab.is-active {
    background: var(--primary);
    color: var(--primary-ink);
    border-color: var(--primary);
}

.main {
    display: grid;
    gap: 16px;
}

.topbar {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar h2 {
    margin: 0;
}

.topbar p {
    margin: 4px 0 0;
    color: var(--muted);
}

.chip {
    border-radius: 999px;
    padding: 8px 12px;
    background: #eaf7f3;
    border: 1px solid #b6dccc;
    font-weight: 600;
}

.screen {
    display: none;
    gap: 16px;
}

.screen.is-active {
    display: grid;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
    padding: 18px;
}

.card h3 {
    margin: 0 0 8px;
}

.card p {
    margin: 0;
    color: var(--muted);
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.btn {
    border-radius: 12px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font-weight: 600;
    cursor: pointer;
}

.btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-ink);
}

.icon-btn {
    border: none;
    background: transparent;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--muted);
}

.terminal {
    margin: 0;
    border: 1px solid #273042;
    border-radius: 12px;
    background: #1e2736;
    color: #d9ebff;
    min-height: 320px;
    max-height: 420px;
    overflow: auto;
    padding: 12px;
    font-family: Consolas, Menlo, monospace;
    font-size: 0.84rem;
    line-height: 1.4;
}

.jobs-list,
.logs-list,
.health-list {
    display: grid;
    gap: 8px;
}

.job-item,
.log-item,
.health-item {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 12px;
    padding: 10px;
}

.job-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.badge {
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge.running {
    background: #fff4d1;
    color: #7f5a00;
}

.badge.succeeded {
    background: #ddf6e7;
    color: #1d6c3e;
}

.badge.failed {
    background: #fde3e6;
    color: #9c2135;
}

.badge.healthy {
    background: #ddf6e7;
    color: #1d6c3e;
}

.badge.degraded {
    background: #fff4d1;
    color: #7f5a00;
}

.badge.down {
    background: #fde3e6;
    color: #9c2135;
}

.badge.completed {
    background: #e8eefc;
    color: #2a4b8d;
}

.badge.unknown {
    background: #eceff3;
    color: #4d5563;
}

.field-row {
    display: grid;
    gap: 6px;
    margin-bottom: 12px;
}

label {
    font-weight: 600;
}

input[type="text"] {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.95rem;
}

input[type="number"] {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.95rem;
}

select {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.95rem;
}

.inline-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.inline-row input,
.inline-row select {
    flex: 1;
}

.hint {
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.9rem;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease;
    z-index: 40;
}

.modal-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -48%) scale(0.98);
    width: min(560px, calc(100vw - 24px));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
    z-index: 41;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease, transform 120ms ease;
}

.modal.is-open {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.modal-header,
.modal-footer {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
}

.modal-footer {
    border-top: 1px solid var(--line);
    border-bottom: none;
    justify-content: flex-end;
    gap: 10px;
}

.modal-body {
    padding: 16px;
    display: grid;
    gap: 10px;
}

@media (max-width: 960px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .grid.two {
        grid-template-columns: 1fr;
    }

    .inline-row {
        flex-direction: column;
        align-items: stretch;
    }
}
