:root {
    --bg: #f5f7f6;
    --surface: #ffffff;
    --surface-soft: #eef5f2;
    --ink: #17201d;
    --muted: #65716c;
    --line: #dbe3df;
    --accent: #087c6b;
    --accent-dark: #065d51;
    --success: #0b7a4b;
    --warning: #a15c08;
    --danger: #b42318;
    --sidebar: #18211e;
    --shadow: 0 18px 45px rgba(23, 32, 29, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

a {
    color: var(--accent-dark);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

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

code {
    display: inline-block;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
    color: #263a34;
}

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

.sidebar {
    background: var(--sidebar);
    color: #f7fbf9;
    padding: 22px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
    margin-bottom: 28px;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    height: 42px;
    border-radius: 8px;
    background: #0ba37f;
    color: #ffffff;
    font-weight: 800;
}

.brand small {
    display: block;
    color: #aec3bb;
    margin-top: 2px;
}

.nav {
    display: grid;
    gap: 4px;
}

.nav a {
    color: #d9e7e2;
    padding: 10px 12px;
    border-radius: 7px;
}

.nav a:hover,
.nav a.active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    text-decoration: none;
}

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

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

.topbar h1,
.login-head h1,
.panel h2,
.panel h3 {
    margin: 0;
    letter-spacing: 0;
}

.topbar h1 {
    font-size: 26px;
}

.eyebrow {
    margin: 0 0 3px;
    color: var(--muted);
    font-size: 13px;
}

.user-actions,
.inline-actions,
.form-actions,
.inline-form,
.section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.section-head {
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-head p,
.compact-panel p,
.login-head p {
    margin: 4px 0 0;
    color: var(--muted);
}

.panel,
.login-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 18px;
}

.compact-panel {
    justify-content: space-between;
}

.stack {
    display: grid;
    gap: 16px;
}

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

.settings-grid {
    display: grid;
    gap: 18px;
}

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

.metric-grid.compact {
    grid-template-columns: repeat(6, minmax(110px, 1fr));
}

.metric {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    min-height: 92px;
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    min-height: 20px;
}

.metric strong {
    display: block;
    font-size: 24px;
    margin-top: 10px;
    overflow-wrap: anywhere;
}

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

.status-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--line);
    border-left-width: 5px;
    background: var(--surface);
    border-radius: 8px;
    padding: 14px 16px;
}

.status-line.ok {
    border-left-color: var(--success);
}

.status-line.warn {
    border-left-color: var(--warning);
}

.form-grid {
    display: grid;
    gap: 14px;
}

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

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

label,
fieldset {
    min-width: 0;
}

label span,
legend {
    display: block;
    color: #34413d;
    font-weight: 650;
    margin-bottom: 6px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cfd9d4;
    border-radius: 7px;
    background: #ffffff;
    color: var(--ink);
    padding: 10px 12px;
    min-height: 42px;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(8, 124, 107, 0.22);
    border-color: var(--accent);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid var(--accent);
    border-radius: 7px;
    background: var(--accent);
    color: #ffffff;
    padding: 9px 14px;
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.button:hover {
    background: var(--accent-dark);
    color: #ffffff;
    text-decoration: none;
}

.button.secondary {
    background: #ffffff;
    color: #1d4039;
    border-color: #b9c9c4;
}

.button.secondary:hover {
    background: var(--surface-soft);
    color: #1d4039;
}

.button.danger {
    background: var(--danger);
    border-color: var(--danger);
}

.button.small {
    min-height: 32px;
    padding: 6px 9px;
    font-size: 13px;
}

.button.full {
    width: 100%;
}

.button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

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

th {
    color: #46534f;
    font-size: 12px;
    text-transform: uppercase;
}

.detail-row td {
    background: #f8faf9;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 800;
    background: #edf2f0;
    color: #49524f;
    white-space: nowrap;
}

.badge.success {
    background: #e5f6ee;
    color: var(--success);
}

.badge.warning {
    background: #fff3dd;
    color: var(--warning);
}

.badge.danger {
    background: #fde8e5;
    color: var(--danger);
}

.badge.muted {
    background: #edf1ef;
    color: var(--muted);
}

.alert {
    border: 1px solid var(--line);
    border-left-width: 5px;
    background: #ffffff;
    border-radius: 8px;
    padding: 13px 14px;
    margin-bottom: 16px;
}

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

.alert.warning,
.alert.warn {
    border-left-color: var(--warning);
}

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

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

.meta-list div {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    min-width: 0;
}

.meta-list dt {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 4px;
}

.meta-list dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.code-block {
    margin: 10px 0 0;
    max-height: 460px;
    overflow: auto;
    background: #121816;
    color: #e8f2ee;
    border-radius: 8px;
    padding: 14px;
    font-size: 13px;
}

.small-code {
    max-height: 220px;
}

.check-grid {
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 10px;
    padding: 14px;
}

.check-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.check-grid input {
    width: auto;
    min-height: auto;
}

.summary-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.summary-list span {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 10px;
}

.message-list {
    display: grid;
    gap: 10px;
}

.message-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.message-item div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.message-item span,
.message-item small,
.muted {
    color: var(--muted);
}

.center {
    text-align: center;
}

.search-form {
    display: flex;
    gap: 8px;
    min-width: min(100%, 420px);
}

.runner-status {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 16px;
}

.pulse {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 6px rgba(8, 124, 107, 0.12);
}

.runner-log {
    min-height: 140px;
    max-height: 300px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fbfcfc;
    margin-bottom: 16px;
}

.runner-log div {
    border-bottom: 1px solid var(--line);
    padding: 7px 0;
}

.guest {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-wrap {
    width: min(100%, 420px);
}

.login-card {
    margin: 0;
}

.login-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.empty-state {
    text-align: center;
    padding: 42px 20px;
}

@media (max-width: 1100px) {
    .metric-grid,
    .metric-grid.compact {
        grid-template-columns: repeat(3, minmax(130px, 1fr));
    }

    .two-columns,
    .status-grid {
        grid-template-columns: 1fr;
    }
}

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

    .sidebar {
        position: static;
        height: auto;
    }

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

    .main {
        padding: 16px;
    }

    .topbar,
    .section-head,
    .user-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .form-grid.two,
    .meta-list,
    .check-grid,
    .metric-grid,
    .metric-grid.compact {
        grid-template-columns: 1fr;
    }

    .search-form {
        width: 100%;
        flex-direction: column;
    }

    .inline-actions,
    .form-actions {
        width: 100%;
    }

    .button {
        width: 100%;
    }
}
