:root {
    --navy: #102a43;
    --blue: #0f6fb6;
    --sky: #38a3d1;
    --bg: #f4f7fb;
    --text: #17212b;
    --muted: #65758b;
    --border: #d8e2ee;
    --white: #ffffff;
    --danger: #c0392b;
    --success: #14804a;
    --warning: #b7791f;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--navy), #17456e 60%, var(--sky));
}

.login-container {
    width: min(440px, calc(100vw - 32px));
}

.login-panel,
.panel,
.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(16, 42, 67, 0.08);
}

.login-panel {
    padding: 28px;
}

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

.brand-mark {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--blue);
    color: var(--white);
    font-weight: 700;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    font-size: 28px;
    margin-bottom: 6px;
}

h2 {
    font-size: 18px;
    margin-bottom: 4px;
}

p,
small,
.muted {
    color: var(--muted);
}

.form-stack,
.action-box {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    font: inherit;
}

input:focus {
    outline: 3px solid rgba(56, 163, 209, 0.22);
    border-color: var(--sky);
}

.topbar {
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 28px;
    color: var(--white);
    background: var(--navy);
}

.topbar span {
    color: #b7c8d9;
    margin-left: 10px;
}

.topbar nav {
    display: flex;
    gap: 14px;
}

.topbar a {
    color: #eaf4ff;
}

.container {
    width: min(1180px, calc(100vw - 32px));
    margin: 26px auto 44px;
}

.page-heading,
.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.page-heading {
    margin-bottom: 18px;
}

.overall {
    min-width: 180px;
    padding: 10px 14px;
    border-radius: 6px;
    font-weight: 700;
    text-align: center;
}

.overall-ok {
    color: #0f5132;
    background: #dff7eb;
}

.overall-warning {
    color: #7a4b00;
    background: #fff2ce;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

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

.stat-card span {
    color: var(--muted);
    font-weight: 700;
}

.stat-card strong {
    font-size: 28px;
    color: var(--navy);
}

.stat-card-accent {
    border-top: 4px solid var(--sky);
}

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

.meter i {
    display: block;
    height: 100%;
    max-width: 100%;
    background: linear-gradient(90deg, var(--sky), var(--blue));
}

.panel {
    padding: 18px;
    margin-bottom: 18px;
}

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

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

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

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

td span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-top: 3px;
}

.button {
    min-height: 38px;
    border: 0;
    border-radius: 6px;
    padding: 9px 12px;
    font-weight: 700;
    cursor: pointer;
    color: var(--white);
    background: var(--blue);
}

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

.button-primary {
    background: var(--blue);
}

.button-secondary {
    color: var(--navy);
    background: #dbeaf7;
}

.button-success {
    background: var(--success);
}

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

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    min-width: 98px;
    margin: 0;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.badge-active {
    color: #0f5132;
    background: #dff7eb;
}

.badge-inactive,
.badge-unknown,
.badge-not_found,
.badge-not_configured {
    color: #56616f;
    background: #eef2f6;
}

.badge-failed {
    color: #842029;
    background: #f8d7da;
}

.badge-activating,
.badge-deactivating {
    color: #664d03;
    background: #fff3cd;
}

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

.checkbox-line {
    grid-template-columns: 20px 1fr;
    align-items: center;
    font-weight: 400;
}

.checkbox-line input {
    width: 18px;
    min-height: 18px;
}

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

.audit-list div {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.audit-list span,
.audit-list small {
    display: block;
    margin-top: 3px;
}

.alert {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.alert-danger {
    color: #842029;
    background: #f8d7da;
}

dialog {
    width: min(760px, calc(100vw - 32px));
    border: 0;
    border-radius: 8px;
    padding: 22px;
    box-shadow: 0 18px 60px rgba(16, 42, 67, 0.28);
}

dialog::backdrop {
    background: rgba(16, 42, 67, 0.55);
}

.icon-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    background: #eef2f6;
}

pre {
    max-height: 380px;
    overflow: auto;
    padding: 14px;
    color: #eaf4ff;
    background: #0b1f33;
    border-radius: 6px;
    white-space: pre-wrap;
}

@media (max-width: 980px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .split-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .topbar,
    .page-heading,
    .panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar {
        height: auto;
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        display: grid;
    }

    th,
    td {
        padding: 10px 8px;
    }
}
