:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --ink: #17202a;
  --muted: #637083;
  --line: #d9e1ea;
  --blue: #1f6feb;
  --teal: #0f8b8d;
  --amber: #b77418;
  --red: #c43d3d;
  --green: #1f8f4d;
  --shadow: 0 16px 44px rgba(32, 48, 68, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #111827;
  color: #f9fafb;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f4b545;
  color: #111827;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #aeb8c7;
  margin-top: 2px;
  font-size: 13px;
}

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

.nav-item {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d8dee9;
  text-align: left;
  padding: 11px 12px;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: #263244;
  color: #ffffff;
}

.sidebar-foot {
  margin-top: auto;
  color: #c8d0dc;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
}

.dot.offline {
  background: var(--red);
}

.main {
  padding: 28px;
  min-width: 0;
}

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

.topbar h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.topbar p {
  margin: 8px 0 0;
  color: var(--muted);
}

.ghost-button,
button[type="submit"] {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: pointer;
}

.ghost-button {
  background: var(--surface);
  color: var(--ink);
  padding: 0 16px;
}

button[type="submit"] {
  border: 0;
  background: var(--blue);
  color: #ffffff;
  padding: 0 16px;
  font-weight: 700;
}

button:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

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

.metric {
  min-height: 96px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 18px;
  box-shadow: var(--shadow);
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
}

.metric.accent {
  border-top: 4px solid var(--amber);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two {
  grid-template-columns: minmax(320px, 0.85fr) minmax(360px, 1.15fr);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 16px;
}

.panel h2 {
  margin: 0;
  font-size: 18px;
}

.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

.form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: #3c4655;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.checkline input {
  width: 16px;
  height: 16px;
}

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

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.row-title {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

.row-title strong {
  overflow-wrap: anywhere;
}

.row-meta {
  color: var(--muted);
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: #ffffff;
  background: var(--muted);
}

.badge.online,
.badge.succeeded,
.badge.enabled {
  background: var(--green);
}

.badge.queued {
  background: var(--amber);
}

.badge.running {
  background: var(--teal);
}

.badge.failed,
.badge.offline,
.badge.disabled {
  background: var(--red);
}

.empty {
  color: var(--muted);
  padding: 30px;
  text-align: center;
  background: var(--surface-2);
  border-radius: 8px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 44px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #111827;
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-item {
    text-align: center;
    padding: 10px 6px;
  }

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

  .main {
    padding: 18px;
  }
}

@media (max-width: 560px) {
  .topbar {
    display: grid;
  }

  .topbar h1 {
    font-size: 22px;
  }

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

  .row {
    grid-template-columns: 1fr;
  }
}
