:root {
    --bg: #f5f6f8;
    --card: #ffffff;
    --text: #1d2330;
    --muted: #6b7385;
    --line: #e3e6ec;
    --accent: #e8416a;
    --ok: #1f9d55;
    --warn: #d98a00;
    --bad: #d6336c;
}

* { box-sizing: border-box; }

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

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

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 24px;
    background: #1d2330;
    color: #fff;
}
.topbar a { color: #fff; }
.topbar .brand { font-weight: 700; }
.topbar nav { display: flex; gap: 16px; flex: 1; }
.topbar .logout { margin: 0; }

.container { max-width: 1180px; margin: 0 auto; padding: 24px; }

h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 28px 0 10px; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 16px;
}
.card.narrow { max-width: 380px; margin: 80px auto; }

table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafbfc; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.ok { background: #e3f6ea; color: var(--ok); }
.badge.off { background: #eceef2; color: var(--muted); }
.badge.bad { background: #fde7ef; color: var(--bad); }
.badge.warn { background: #fff3d9; color: var(--warn); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat .value { font-size: 22px; font-weight: 700; }
.stat .label { color: var(--muted); font-size: 12px; }

form.inline { display: inline; margin: 0; }
label { display: block; margin: 10px 0; color: var(--muted); font-size: 13px; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
input[type=text], input[type=password], input[type=number], textarea, select {
    display: block; width: 100%; box-sizing: border-box; margin-top: 4px; padding: 8px 10px;
    border: 1px solid var(--line); border-radius: 6px; font: inherit; color: var(--text); background: #fff;
}
textarea { min-height: 70px; resize: vertical; max-width: 100%; box-sizing: border-box; }

button, .button {
    display: inline-block; padding: 8px 14px; border: none; border-radius: 6px;
    background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
button.secondary { background: #eceef2; color: var(--text); }
button.danger { background: var(--bad); }
button.link { background: none; color: #fff; padding: 0; font-weight: 400; }

.error { color: var(--bad); font-weight: 600; }
.notice { background: #e3f6ea; border: 1px solid #b9e3c8; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.keybox { background: #fff8e1; border: 1px solid #f1d98c; padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; }
.keybox code { display: block; margin-top: 6px; font-size: 15px; word-break: break-all; user-select: all; }

code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 110px; padding: 8px 0 0; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bar .req { background: var(--accent); min-height: 1px; border-radius: 2px 2px 0 0; opacity: .85; }
.bar .err { background: #1d2330; min-height: 0; }
.barlabels { display: flex; gap: 3px; }
.barlabels span { flex: 1; text-align: center; font-size: 10px; color: var(--muted); }

details.body summary { cursor: pointer; color: var(--accent); }
details.body pre { margin: 6px 0 0; padding: 8px; background: #f2f3f6; border-radius: 6px; max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-all; font-size: 12px; }

.pager { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.filters label { margin: 0; }
