:root {
  --bg: #0b0f14;
  --surface: #151a22;
  --surface-soft: #202735;
  --surface-strong: #0f141b;
  --text: #edf2f7;
  --muted: #98a7bb;
  --line: #2a3443;
  --primary: #38bdf8;
  --primary-strong: #0ea5e9;
  --ok: #34d399;
  --warn: #f59e0b;
  --danger: #f87171;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a {
  color: var(--primary);
  text-decoration: none;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--text);
  background: #0d1219;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  background: var(--surface-strong);
}

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

.sidebar {
  background: #080b10;
  color: #fff;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  min-height: 44px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

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

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 4px;
  margin-top: 26px;
}

.nav-link {
  color: #c6d2e1;
  padding: 10px 12px;
  border-radius: 6px;
}

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

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 15, 20, 0.9);
  backdrop-filter: blur(10px);
}

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

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

.content {
  padding: 22px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.panel-card,
.form-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 16px;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 5px 0;
  font-size: 28px;
}

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

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

.panel-card,
.form-card {
  padding: 18px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.section-head h2,
.panel-card h2 {
  margin: 0;
  font-size: 18px;
}

.section-head p,
.muted {
  color: var(--muted);
  margin: 4px 0 0;
}

.filters,
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.form-card {
  display: grid;
  gap: 16px;
}

.form-actions,
.actions,
.check-row,
.tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.check-row label,
.check-list label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  text-transform: none;
  font-size: 14px;
  font-weight: 500;
}

.check-row input,
.check-list input {
  width: auto;
}

.check-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.check-list legend {
  color: var(--muted);
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 9px 14px;
  color: #06111a;
  background: var(--primary);
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.button:hover {
  background: var(--primary-strong);
}

.button.secondary {
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.button.danger {
  background: var(--danger);
  color: #1b0808;
}

.inline-form {
  display: inline;
}

.row-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
}

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

.badge.ok {
  background: rgba(52, 211, 153, 0.16);
  color: var(--ok);
}

.badge.off,
.alert.error {
  background: rgba(248, 113, 113, 0.16);
  color: var(--danger);
}

.badge.muted {
  background: var(--surface-soft);
  color: var(--muted);
}

.alert {
  margin: 16px 22px 0;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.alert.success {
  background: rgba(52, 211, 153, 0.16);
  color: var(--ok);
}

.empty {
  margin-top: 12px;
  padding: 20px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.pagination {
  display: flex;
  gap: 6px;
  margin-top: 16px;
}

.pagination a,
.tabs a {
  padding: 8px 11px;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text);
}

.pagination a.active,
.tabs a.active {
  background: var(--primary);
  color: #fff;
}

.menu-button {
  display: none;
}

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

.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-brand {
  color: var(--text);
  margin-bottom: 22px;
}

.login-brand small {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
}

@media (max-width: 1100px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 160ms ease;
    z-index: 20;
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
  }

  .menu-button {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    padding: 9px 11px;
  }

  .topbar {
    align-items: flex-start;
  }

  .content {
    padding: 16px;
  }

  .metric-grid,
  .check-list {
    grid-template-columns: 1fr;
  }
}
