:root {
  --bg: #edf5ff;
  --bg-strong: #dce9fb;
  --card: #ffffff;
  --line: #cad8ee;
  --text: #11213c;
  --muted: #5f7393;
  --accent: #1f64d6;
  --accent-strong: #173c8c;
  --danger: #8f2f2f;
  --warn: #8a5b14;
  --good: #1263c9;
  --shadow: 0 18px 48px rgba(23, 60, 140, 0.12);
  --radius: 18px;
  --font: "Segoe UI", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(31, 100, 214, 0.16), transparent 36%),
    radial-gradient(circle at bottom right, rgba(111, 182, 255, 0.16), transparent 34%),
    linear-gradient(180deg, var(--bg), #f7fbff 56%, #ffffff);
  color: var(--text);
  font-family: var(--font);
}

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

code,
pre,
input,
button {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  background: linear-gradient(180deg, #153b7a, #0f2f64 62%, #0d2857);
  color: #f4f8ff;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  background: linear-gradient(135deg, #ffffff, #8fc0ff);
  color: #133777;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: 0 12px 30px rgba(9, 30, 66, 0.18);
}

.muted {
  color: var(--muted);
}

.sidebar .muted {
  color: rgba(244, 248, 255, 0.72);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav a {
  padding: 12px 14px;
  border-radius: 14px;
  color: rgba(244, 248, 255, 0.92);
}

.nav a.active,
.nav a:hover {
  background: rgba(255, 255, 255, 0.12);
}

.content {
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 20px;
}

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

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

h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}

h2 {
  font-size: 1.1rem;
}

h3 {
  font-size: 1rem;
}

.user-chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(31, 100, 214, 0.08);
  color: var(--accent-strong);
  font-weight: 600;
  border: 1px solid rgba(31, 100, 214, 0.12);
}

.cards {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(202, 216, 238, 0.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: grid;
  gap: 14px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(31, 100, 214, 0.08);
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 700;
}

.badge.good {
  background: rgba(31, 100, 214, 0.12);
  color: var(--good);
}

.badge.bad {
  background: rgba(143, 47, 47, 0.12);
  color: var(--danger);
}

.badge.warn {
  background: rgba(138, 91, 20, 0.14);
  color: var(--warn);
}

pre {
  margin: 0;
  background: #0f1f3a;
  color: #eef5ff;
  border-radius: 14px;
  padding: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 380px;
  overflow: auto;
}

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

.control-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.action-tile,
.form-grid,
.filter-grid {
  display: grid;
  gap: 12px;
}

.action-tile {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(237, 245, 255, 0.82), rgba(255, 255, 255, 0.98));
}

.control-tile {
  border-radius: 18px;
  padding: 18px;
  display: grid;
  gap: 12px;
  border: 1px solid rgba(21, 59, 122, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.control-up {
  background: linear-gradient(180deg, rgba(31, 100, 214, 0.16), rgba(255, 255, 255, 0.98));
}

.control-down {
  background: linear-gradient(180deg, rgba(143, 47, 47, 0.14), rgba(255, 255, 255, 0.98));
}

.control-restart {
  background: linear-gradient(180deg, rgba(77, 136, 224, 0.18), rgba(255, 255, 255, 0.98));
}

.control-kicker {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.control-button {
  width: 100%;
  background: linear-gradient(135deg, #1f64d6, #3e8fff);
  color: #fff;
}

.utility-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.utility-tile {
  min-height: 100%;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(31, 100, 214, 0.1);
  background: linear-gradient(180deg, rgba(237, 245, 255, 0.86), rgba(255, 255, 255, 0.98));
  display: grid;
  gap: 6px;
}

.metric strong {
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.status-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(237, 245, 255, 0.86), rgba(255, 255, 255, 0.98));
  border: 1px solid rgba(31, 100, 214, 0.12);
}

.status-copy {
  display: grid;
  gap: 6px;
}

.bot-signal {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  flex: 0 0 auto;
  position: relative;
}

.bot-signal::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.bot-signal.running {
  background: #1f64d6;
  box-shadow: 0 0 0 6px rgba(31, 100, 214, 0.12);
}

.bot-signal.running::after {
  animation: bot-pulse 1.8s ease-out infinite;
  background: rgba(31, 100, 214, 0.28);
}

.bot-signal.warn {
  background: #8a5b14;
  box-shadow: 0 0 0 6px rgba(138, 91, 20, 0.12);
}

.bot-signal.bad {
  background: #8f2f2f;
  box-shadow: 0 0 0 6px rgba(143, 47, 47, 0.12);
}

@keyframes bot-pulse {
  0% {
    transform: scale(1);
    opacity: 0.9;
  }

  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

.resource-topline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

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

.resource-card {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(31, 100, 214, 0.1);
  background: linear-gradient(180deg, rgba(237, 245, 255, 0.82), rgba(255, 255, 255, 0.98));
  display: grid;
  gap: 10px;
}

.resource-card.good {
  box-shadow: inset 0 0 0 1px rgba(31, 100, 214, 0.08);
}

.resource-card.warn {
  box-shadow: inset 0 0 0 1px rgba(138, 91, 20, 0.12);
}

.resource-card.bad {
  box-shadow: inset 0 0 0 1px rgba(143, 47, 47, 0.12);
}

.resource-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.resource-head strong {
  font-size: 1.15rem;
}

.resource-bar {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(17, 33, 60, 0.09);
}

.resource-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1f64d6, #67b7ff);
}

.resource-card.warn .resource-bar span {
  background: linear-gradient(90deg, #a86d19, #e3b44e);
}

.resource-card.bad .resource-bar span {
  background: linear-gradient(90deg, #9c3434, #d46a6a);
}

label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--text);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  background: linear-gradient(135deg, var(--accent), #4a97ff);
  color: white;
}

.button.ghost {
  background: rgba(31, 100, 214, 0.08);
  color: var(--accent-strong);
  border: 1px solid rgba(31, 100, 214, 0.12);
}

.sidebar .button.ghost {
  background: rgba(255, 255, 255, 0.14);
  color: #f4f8ff;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.sidebar .button.ghost:hover {
  background: rgba(255, 255, 255, 0.22);
}

.button.full,
.logout,
.link-list {
  width: 100%;
}

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

.flash {
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 18px;
  font-weight: 600;
}

.flash.success {
  background: rgba(31, 100, 214, 0.12);
  color: var(--good);
}

.flash.error {
  background: rgba(143, 47, 47, 0.12);
  color: var(--danger);
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(199, 211, 189, 0.8);
  vertical-align: top;
}

summary {
  cursor: pointer;
  color: var(--accent);
  margin-top: 8px;
}

.filter-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.filter-actions {
  display: flex;
  gap: 10px;
  align-items: end;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(100%, 430px);
  background: rgba(251, 252, 248, 0.96);
  border: 1px solid rgba(199, 211, 189, 0.9);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-brand {
  margin-bottom: 18px;
}

.login-copy {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding-bottom: 16px;
  }

  .two-up {
    grid-template-columns: 1fr;
  }

  .control-strip {
    grid-template-columns: 1fr;
  }

  .resource-topline,
  .resource-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .status-hero {
    align-items: flex-start;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
