:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #637083;
  --line: #dfe5ee;
  --accent: #0f766e;
  --accent-dark: #0b5d57;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #067647;
  --unknown: #475467;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
}

button:hover {
  border-color: #a9b7c8;
}

button.primary,
#dialogSubmit {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.primary:hover,
#dialogSubmit:hover {
  background: var(--accent-dark);
}

.login-body {
  display: grid;
  place-items: center;
  background: #eef3f8;
}

.login-panel {
  width: min(420px, calc(100vw - 32px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 50px rgba(16, 24, 40, 0.08);
}

.login-panel h1 {
  margin: 0 0 22px;
  font-size: 24px;
}

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

.login-form label,
.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.login-form input,
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fff;
  color: var(--text);
}

#app {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #111827;
  color: #e5e7eb;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  padding: 8px 10px 18px;
}

.nav,
.logout {
  width: 100%;
  text-align: left;
  border-color: transparent;
  color: #cbd5e1;
  background: transparent;
}

.nav.active,
.nav:hover,
.logout:hover {
  background: #1f2937;
  color: #fff;
}

.logout {
  margin-top: auto;
}

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

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

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1 {
  margin: 4px 0 0;
  font-size: 28px;
}

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

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

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

.card {
  padding: 14px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
}

.metric-value {
  margin-top: 6px;
  font-weight: 750;
  font-size: 24px;
}

.panel {
  padding: 14px;
  margin-bottom: 16px;
}

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

.toolbar input,
.toolbar select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

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

th {
  background: #f8fafc;
  color: #475467;
  font-weight: 650;
  position: sticky;
  top: 0;
  z-index: 1;
}

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

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 650;
  background: #eef2f6;
  color: var(--unknown);
  white-space: nowrap;
}

.status.usable {
  background: #dcfae6;
  color: var(--ok);
}

.status.quarantined,
.status.disabled {
  background: #fee4e2;
  color: var(--danger);
}

.status.degraded {
  background: #fef0c7;
  color: var(--warn);
}

.status.unknown {
  background: #e4e7ec;
  color: var(--unknown);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.actions button {
  padding: 5px 8px;
  font-size: 12px;
}

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

.pre {
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 540px;
}

dialog {
  width: min(560px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 24px 80px rgba(16, 24, 40, 0.25);
}

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

#actionForm {
  display: grid;
  gap: 12px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

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

.hidden {
  display: none !important;
}

.alert {
  border: 1px solid #fdb022;
  background: #fffaeb;
  color: #93370d;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    flex-direction: row;
    overflow-x: auto;
  }

  .brand {
    padding: 8px 10px;
    white-space: nowrap;
  }

  .nav,
  .logout {
    width: auto;
    white-space: nowrap;
  }

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

  .main {
    padding: 16px;
  }
}
