:root {
  color-scheme: dark;
  font-family: Arial, sans-serif;
  background: #111;
  color: #f2f2f2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #111;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 30px;
  border-bottom: 1px solid #303030;
  background: #181818;
}

.topbarActions {
  display: flex;
  align-items: center;
  gap: 10px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 18px;
}

p {
  color: #bdbdbd;
  margin-top: 4px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(520px, 1.1fr);
  gap: 18px;
  padding: 18px;
}

.panel {
  background: #1a1a1a;
  border: 1px solid #303030;
  border-radius: 8px;
  padding: 18px;
  min-height: 240px;
}

.wide {
  grid-column: 1 / -1;
}

.panelHeader,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

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

.eventItem,
.deviceItem {
  border: 1px solid #333;
  border-radius: 6px;
  padding: 12px;
  background: #202020;
}

.eventItem {
  cursor: pointer;
}

.eventItem:hover {
  border-color: #fff;
}

.muted {
  color: #aaa;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #333;
  color: #eee;
  font-size: 12px;
}

.badge.ok {
  background: #1d5f36;
}

.badge.warn {
  background: #7a5321;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: #d8d8d8;
  font-size: 13px;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 10px 12px;
  background: #111;
  color: #fff;
}

textarea {
  resize: vertical;
  min-height: 220px;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: #fff;
  color: #111;
  cursor: pointer;
}

button.danger {
  background: #8d2f2f;
  color: #fff;
}

button.secondary,
.downloadBtn {
  background: #303030;
  color: #fff;
}

.downloadBtn {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 6px;
  padding: 8px 12px;
  text-decoration: none;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.check {
  align-content: end;
  grid-template-columns: auto 1fr;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 59px;
}

.check input {
  width: 18px;
  height: 18px;
}

.devices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.installControls {
  display: grid;
  grid-template-columns: 140px 140px 1fr;
  gap: 12px;
  margin: 14px 0;
}

.installResult {
  margin-bottom: 14px;
}

.installResult input {
  margin-top: 6px;
}

.installerGrid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  gap: 12px;
}

.installerBox {
  border: 1px solid #333;
  border-radius: 6px;
  padding: 12px;
  background: #202020;
}

code {
  word-break: break-all;
  color: #fff;
}

.deviceEdit {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 8px;
  margin-top: 12px;
}

.screenBtn,
.deviceActions {
  margin-top: 10px;
}

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

.screenshotLink {
  display: block;
  margin-top: 10px;
  border: 1px solid #333;
  border-radius: 6px;
  overflow: hidden;
  background: #111;
}

.screenshotLink img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
}

.loginPage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #111;
}

.loginShell {
  width: min(100%, 460px);
  padding: 24px;
}

.loginCard {
  border: 1px solid #303030;
  border-radius: 8px;
  background: #1a1a1a;
  padding: 28px;
}

.loginBrand {
  margin-bottom: 24px;
}

.loginForm {
  display: grid;
  gap: 16px;
}

.loginError {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #713030;
  border-radius: 6px;
  background: #2a1515;
  color: #ffb4b4;
}

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

  .installerGrid,
  .installControls {
    grid-template-columns: 1fr;
  }
}
