:root {
    color-scheme: light;
    --bg: #eef2f7;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
    --line: #dbe3ee;
    --blue: #155eef;
    --blue-dark: #123b8f;
    --red: #b42318;
    --amber: #b45309;
    --green: #027a48;
    --shadow: 0 16px 40px rgba(15, 23, 42, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

header {
    align-items: center;
    background: #09111f;
    color: #fff;
    display: flex;
    justify-content: space-between;
    min-height: 64px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 10;
}

header strong {
    display: block;
    font-size: 16px;
}

header span {
    color: #93a4ba;
    display: block;
    font-size: 12px;
    margin-top: 1px;
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

nav a {
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 8px;
    color: #dbeafe;
    padding: 7px 10px;
}

main {
    margin: 0 auto;
    max-width: 1320px;
    padding: 24px;
}

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

.hero,
.page-head {
    align-items: center;
    background: linear-gradient(135deg, #0f1d35, #143d78);
    border-radius: 12px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    min-height: 145px;
    padding: 28px;
    box-shadow: var(--shadow);
}

.hero h1,
.page-head h1 {
    font-size: 30px;
    line-height: 1.1;
    margin-bottom: 8px;
}

.hero p,
.page-head p {
    color: #cbd5e1;
    margin-bottom: 0;
    max-width: 720px;
}

.eyebrow {
    color: #9cc2ff;
    display: block;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    margin-bottom: 8px;
    text-transform: uppercase;
}

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

.stat,
.details > div,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.stat,
.details > div {
    padding: 16px;
}

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

.stat span,
.details span {
    color: var(--muted);
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.stat strong {
    display: block;
    font-size: 30px;
    margin-top: 4px;
}

.details strong {
    display: block;
    margin-top: 5px;
    word-break: break-word;
}

.section-title {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin: 24px 0 12px;
}

.actions,
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.actions form {
    margin: 0;
}

.button,
.tabs a,
button {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 700;
    min-height: 38px;
    padding: 9px 13px;
}

.button.primary,
button.primary {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.table-wrap {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow-x: auto;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

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

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

th {
    background: var(--panel-soft);
    color: #475569;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

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

td small {
    color: var(--muted);
    display: block;
    margin-top: 2px;
}

.badge {
    background: #e0e7ff;
    border-radius: 999px;
    color: #3730a3;
    display: inline-flex;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 8px;
}

.badge.open,
.badge.critical,
.badge.down,
.badge.problem,
.badge.failed {
    background: #fee4e2;
    color: var(--red);
}

.badge.warning,
.badge.manual {
    background: #fef3c7;
    color: var(--amber);
}

.badge.closed,
.badge.ok,
.badge.up,
.badge.established,
.badge.sent,
.badge.automatic {
    background: #dcfae6;
    color: var(--green);
}

.details {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 20px;
}

.empty,
.alert {
    background: #fff;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    color: var(--muted);
    padding: 16px;
}

.alert {
    border-style: solid;
    margin-bottom: 14px;
}

.alert.success {
    background: #ecfdf3;
    border-color: #abefc6;
    color: var(--green);
}

.alert.error {
    background: #fef3f2;
    border-color: #fecdca;
    color: var(--red);
}

pre,
code {
    background: #0b1220;
    border-radius: 8px;
    color: #e2e8f0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

code {
    padding: 2px 5px;
}

pre {
    line-height: 1.5;
    overflow-x: auto;
    padding: 16px;
}

label {
    color: #334155;
    display: grid;
    font-weight: 800;
    gap: 7px;
}

input,
select,
textarea {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: var(--text);
    font: inherit;
    min-height: 40px;
    padding: 9px 11px;
    width: 100%;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.settings-form {
    display: grid;
    gap: 14px;
    grid-template-columns: 1fr 220px;
}

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

.login-page {
    background: radial-gradient(circle at top, #1f4d91, #09111f 55%, #060a12);
}

.login-shell {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(255,255,255,.4);
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 14px;
    max-width: 420px;
    padding: 26px;
    width: 100%;
}

.login-card h1 {
    margin-bottom: 2px;
}

.login-card p {
    color: var(--muted);
}

@media (max-width: 900px) {
    header,
    .section-title,
    .hero,
    .page-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .stats,
    .details,
    .settings-form {
        grid-template-columns: 1fr;
    }
}
