html, body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f4f6f8;
  color: #1f2933;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: #111827;
  color: #fff;
  padding: 24px 18px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #0ea5e9;
  font-weight: 700;
}

.brand span {
  display: block;
  color: #9ca3af;
  font-size: 13px;
}

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

.sidebar .nav-link {
  width: 100%;
  text-align: left;
  color: #d1d5db;
  border: 0;
  border-radius: 8px;
  padding: 11px 12px;
  background: transparent;
}

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
  color: #fff;
  background: #243244;
}

.workspace {
  min-width: 0;
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.topbar-label {
  color: #6b7280;
  font-size: 13px;
}

main {
  padding: 28px;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

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

.page-heading h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
}

.page-heading p {
  margin: 6px 0 0;
  color: #6b7280;
}

.routes-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}

.routes-toolbar .form-select,
.routes-toolbar .form-control {
  max-width: 320px;
}

.routes-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.toolbar-count {
  color: #6b7280;
}

.routes-table,
.status-panel,
.detect-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
}

.routes-table {
  padding: 0;
}

.routes-table table {
  margin: 0;
  white-space: nowrap;
}

.badge-soft {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 500;
}

.badge-on {
  color: #166534;
  background: #dcfce7;
}

.badge-off {
  color: #991b1b;
  background: #fee2e2;
}

.relay-options {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #f9fafb;
}

.app-toast {
  min-width: 260px;
}

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

.metric-card {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
}

.metric-card span {
  color: #6b7280;
  font-size: 13px;
}

.metric-card strong {
  color: #111827;
  font-size: 26px;
  line-height: 1.2;
}

.login-page {
  min-height: 100vh;
  background: #eef2f7;
}

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

.login-panel {
  width: min(100%, 420px);
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

.login-panel .brand {
  color: #111827;
}

.help-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
}

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

  .sidebar {
    position: static;
  }

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

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

  .page-heading,
  .topbar {
    align-items: stretch;
    flex-direction: column;
    height: auto;
    padding-top: 16px;
    padding-bottom: 16px;
  }
}

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