:root {
  --bg: #f4f6f8;
  --panel: #fff;
  --ink: #111827;
  --muted: #64748b;
  --line: #d9e0e7;
  --blue: #1f6feb;
  --green: #12805c;
  --red: #c62828;
  --amber: #a16207;
  --sidebar: #101827;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.sidebar {
  min-height: 100vh;
  background: var(--sidebar);
  color: white;
  padding: 18px 14px;
  position: sticky;
  top: 0;
}

.brand {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  margin-bottom: 18px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 7px;
}

nav {
  display: grid;
  gap: 4px;
}

nav a {
  color: #cbd5e1;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 7px;
}

nav a.active,
nav a:hover {
  background: #1e293b;
  color: white;
}

.app {
  min-width: 0;
}

.topbar {
  height: 78px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  background: white;
  border-bottom: 1px solid var(--line);
}

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

h1 {
  font-size: 22px;
}

h2 {
  font-size: 17px;
  margin-bottom: 14px;
}

h3 {
  font-size: 15px;
  margin-bottom: 10px;
}

.topbar p,
.muted {
  color: var(--muted);
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.login-shell {
  min-height: calc(100vh - 122px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(420px, 100%);
}

#login-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.bad-text {
  color: var(--red);
  min-height: 20px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 7px;
}

#view {
  padding: 22px;
}

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

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.metric strong {
  display: block;
  font-size: 28px;
  margin-top: 12px;
}

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

.toolbar input,
.toolbar select,
.form-field {
  min-width: 190px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: white;
}

button {
  border: 0;
  border-radius: 7px;
  padding: 9px 12px;
  background: var(--blue);
  color: white;
  cursor: pointer;
}

button.secondary {
  background: #e2e8f0;
  color: #0f172a;
}

button.danger {
  background: var(--red);
}

button.green {
  background: var(--green);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  color: #475569;
  background: #f8fafc;
  font-weight: 600;
}

tr:last-child td {
  border-bottom: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
}

.pill.ok {
  background: #dcfce7;
  color: #166534;
}

.pill.warn {
  background: #fef3c7;
  color: #92400e;
}

.pill.bad {
  background: #fee2e2;
  color: #991b1b;
}

.device-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.kv {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 8px;
  font-size: 14px;
}

.kv div:nth-child(odd) {
  color: var(--muted);
}

.command-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

textarea {
  width: 100%;
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  resize: vertical;
}

.modal {
  border: 0;
  border-radius: 8px;
  padding: 18px;
  max-width: 420px;
  width: calc(100vw - 40px);
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.modal menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0;
  margin: 14px 0 0;
}

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

  .sidebar {
    min-height: auto;
    position: static;
  }

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

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