:root {
    color-scheme: light;
    --bg: #f4f7f9;
    --panel: #ffffff;
    --ink: #16212b;
    --muted: #5d6b78;
    --line: #d8e0e7;
    --accent: #1f7a6d;
    --accent-strong: #155a50;
    --warning: #f8d348;
    --warning-ink: #2d2500;
    --danger-bg: #fdeceb;
    --danger-ink: #8d241d;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
}

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

.auth-panel,
.status-panel,
.module-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(21, 39, 53, 0.08);
}

.auth-panel {
    width: min(100%, 440px);
    padding: 28px;
}

.preview-banner {
    display: block;
    width: 100%;
    margin-bottom: 20px;
    padding: 10px 12px;
    background: var(--warning);
    color: var(--warning-ink);
    border: 1px solid rgba(45, 37, 0, 0.18);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    text-align: center;
}

.preview-banner.compact {
    display: inline-block;
    width: auto;
    margin-bottom: 10px;
}

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

h1 {
    margin-bottom: 8px;
    font-size: 30px;
    line-height: 1.15;
}

h2 {
    margin-bottom: 16px;
    font-size: 21px;
}

h3 {
    margin-bottom: 8px;
    font-size: 17px;
}

.lede,
.dev-note,
.module-card p,
.status-list dt,
.muted {
    color: var(--muted);
}

.login-form {
    display: grid;
    gap: 10px;
    margin-top: 24px;
}

label {
    font-weight: 700;
}

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

input:focus {
    border-color: var(--accent);
    outline: 3px solid rgba(31, 122, 109, 0.16);
}

button,
.logout-link,
.secondary-link,
.card-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

button:hover,
.logout-link:hover,
.secondary-link[aria-current="page"],
.card-link:hover {
    background: var(--accent-strong);
    color: #ffffff;
}

button:disabled {
    background: #d8e0e7;
    color: #5d6b78;
    cursor: not-allowed;
}

.secondary-link {
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--accent-strong);
}

.secondary-link:hover {
    background: #edf4f2;
}

.alert {
    margin-top: 18px;
    padding: 12px;
    background: var(--danger-bg);
    color: var(--danger-ink);
    border: 1px solid rgba(141, 36, 29, 0.2);
    border-radius: 6px;
}

.dev-note {
    margin: 18px 0 0;
    font-size: 14px;
}

code {
    font-family: Consolas, Monaco, monospace;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px clamp(18px, 4vw, 48px);
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.topbar h1 {
    margin-bottom: 0;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard {
    width: min(1160px, 100%);
    margin: 0 auto;
    padding: 28px clamp(18px, 4vw, 48px) 48px;
}

.status-panel {
    margin-bottom: 28px;
    padding: 22px;
}

.status-list {
    display: grid;
    gap: 14px;
    margin: 0;
}

.status-list div {
    display: grid;
    grid-template-columns: minmax(120px, 180px) 1fr;
    gap: 12px;
}

.status-list dt {
    font-weight: 700;
}

.status-list dd {
    margin: 0;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.module-card {
    min-height: 170px;
    padding: 20px;
}

.registry-link-card {
    border-color: rgba(31, 122, 109, 0.4);
}

.registry-card {
    display: grid;
    gap: 14px;
}

.module-card-header,
.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.module-card-header h3,
.section-heading h2 {
    margin-bottom: 0;
}

.secondary-link.inline {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 13px;
}

.card-link.inline-action {
    min-height: 38px;
    padding: 8px 12px;
}

.module-meta {
    display: grid;
    gap: 10px;
    margin: 0;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.module-meta div {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 10px;
}

.module-meta dt {
    color: var(--muted);
    font-weight: 700;
}

.module-meta dd {
    margin: 0;
}

.badge {
    display: inline-flex;
    margin-top: 12px;
    padding: 6px 8px;
    border-radius: 999px;
    background: #edf4f2;
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 700;
}

.module-card-header .badge,
.module-meta .badge {
    margin-top: 0;
}

.badge.success {
    background: #e7f6ec;
    color: #1d6b35;
}

.badge.warning {
    background: #fff4d6;
    color: #6d4b00;
}

.runtime-alerts {
    margin-top: 28px;
}

.alert-list {
    display: grid;
    gap: 12px;
}

.alert-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fbfcfd;
}

.status-card-grid .module-card {
    min-height: 150px;
}

.backup-jobs-panel {
    margin-top: 28px;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.backup-action-message {
    min-height: 20px;
    margin-bottom: 12px;
}

.table-wrap {
    width: 100%;
    margin-top: 18px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.data-table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.data-table th {
    color: var(--muted);
    font-weight: 700;
    background: #fbfcfd;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

@media (max-width: 640px) {
    .topbar,
    .status-list div {
        grid-template-columns: 1fr;
    }

    .topbar {
        display: grid;
        align-items: start;
    }

    .logout-link {
        width: 100%;
    }

    .topbar-actions,
    .secondary-link,
    .card-link {
        width: 100%;
    }

    .topbar-actions {
        display: grid;
    }

    .module-card-header,
    .section-heading,
    .alert-row {
        display: grid;
    }
}
