:root {
  --bg: #0f1420;
  --panel: #171e2e;
  --panel-soft: #1f2940;
  --text: #e8edf7;
  --muted: #9aa8c2;
  --line: #2a3650;
  --accent: #5b9dff;
  --ok: #2fb37a;
  --warn: #d8a13a;
  --err: #e05d5d;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 0.75rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }
h3 { font-size: 1rem; margin: 0; }
p { margin: 0.4rem 0; }
.top {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 0.9rem 1.2rem; border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.brand { font-weight: 600; color: var(--text); }
nav { display: flex; gap: 0.9rem; flex-wrap: wrap; }
nav a { color: var(--muted); }
nav a:hover { color: var(--text); }
.wrap { max-width: 980px; margin: 0 auto; padding: 1.4rem 1.2rem 3rem; }
.foot { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 1rem; border-top: 1px solid var(--line); }
.auth { display: grid; place-items: center; min-height: 100vh; }
.auth-card { width: min(380px, 92vw); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1.6rem; }
.stack { display: flex; flex-direction: column; gap: 0.9rem; }
.stack.narrow { max-width: 460px; }
label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--panel-soft);
  border: 1px solid var(--line); border-radius: 8px; padding: 0.55rem 0.7rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button, .button {
  font: inherit; cursor: pointer; border-radius: 8px; padding: 0.55rem 1rem;
  border: 1px solid var(--line); background: var(--panel-soft); color: var(--text);
  display: inline-block;
}
button:hover, .button:hover { border-color: var(--accent); text-decoration: none; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #08111f; font-weight: 600; }
button.danger, .button.danger { color: var(--err); border-color: #5a2a2a; }
button.link { background: none; border: none; color: var(--muted); padding: 0.2rem; }
button.small, .small { font-size: 0.82rem; }
.inline { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; }
.row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.row input[type="email"], .row input[name="label"] { flex: 1 1 240px; }
.short { width: 5rem; }
.muted { color: var(--muted); }
.notice { border-radius: 10px; padding: 0.7rem 0.9rem; border: 1px solid var(--line); margin: 0.8rem 0; }
.notice.ok { border-color: #1f5c44; background: #12281f; }
.notice.err { border-color: #5c2323; background: #2a1414; }
.notice.info { border-color: #2c3f68; background: #151f33; }
.linkbox { display: inline-block; margin-top: 0.3rem; word-break: break-all; color: var(--text); }
.cards { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-top: 1rem; }
.card, .incident { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; }
.card-top { display: flex; justify-content: space-between; gap: 0.6rem; align-items: flex-start; }
.badge { font-size: 0.75rem; padding: 0.2rem 0.5rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.active { color: var(--ok); border-color: #1f5c44; }
.badge.pending, .badge.revoking { color: var(--warn); border-color: #6a5220; }
.badge.failed { color: var(--err); border-color: #5c2323; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.8rem; }
.banner { border-radius: 12px; padding: 1rem 1.2rem; border: 1px solid var(--line); background: var(--panel); }
.banner h2 { margin-top: 0; }
.banner.ok { border-color: #1f5c44; }
.banner.partial_exit, .banner.partial_ru { border-color: #6a5220; }
.banner.down { border-color: #5c2323; }
.banner.unknown { border-color: #3a4660; }
.table { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 500; }
.warning { border-left: 3px solid var(--warn); background: #241d10; padding: 0.6rem 0.8rem; border-radius: 8px; margin: 1rem 0; }
.qr { display: block; width: 220px; max-width: 100%; background: #fff; padding: 8px; border-radius: 10px; margin: 1rem 0; }
.steps { padding-left: 1.2rem; }
.steps li { margin: 0.4rem 0; }
.timeline { margin: 0.5rem 0 0; padding-left: 1.1rem; }
.incidents { display: grid; gap: 0.8rem; margin-top: 1rem; }
.incident.critical { border-color: #5c2323; }
.incident.warning { border-color: #6a5220; }
.empty { color: var(--muted); margin-top: 1.2rem; }
.head-row { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.tabs { display: flex; gap: 0.9rem; flex-wrap: wrap; margin: 0.2rem 0 1rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--line); }
.tabs a { color: var(--muted); }
.tabs a:hover { color: var(--text); }

.top nav a.active, .brand.active { color: var(--text); font-weight: 600; }
.top nav a.active { border-bottom: 2px solid var(--accent); padding-bottom: 2px; }
.tabs a.active { color: var(--text); font-weight: 600; border-bottom: 2px solid var(--accent); padding-bottom: 4px; }

.progress { height: 6px; background: var(--panel-soft); border-radius: 999px; overflow: hidden; margin: 0.8rem 0; }
.progress-bar { height: 100%; width: 35%; background: var(--accent); border-radius: 999px; animation: panel-progress 1.2s ease-in-out infinite; }
@keyframes panel-progress {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

.table-wrap { overflow-x: auto; }
.table td.actions { white-space: nowrap; flex-wrap: nowrap; }
.table td.actions .inline { margin-right: 0.25rem; }
