:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #687385;
  --line: #d9dee7;
  --accent: #136f63;
  --accent-2: #2f5d9a;
  --danger: #b42318;
  --warn: #9a6700;
  --shadow: 0 10px 28px rgba(28, 39, 55, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

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

button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.94);
}

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

textarea {
  resize: vertical;
  min-height: 92px;
  font-family: Consolas, "Courier New", monospace;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

label span,
.section-title,
.eyebrow {
  font-size: 12px;
  color: var(--muted);
}

.sidebar {
  min-height: 100vh;
  padding: 20px;
  background: #202832;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #d8b45c;
  color: #1d2430;
  font-weight: 800;
}

.brand h1,
.toolbar h2,
.table-head h2 {
  margin: 0;
}

.brand h1 {
  font-size: 19px;
}

.brand p {
  margin: 2px 0 0;
  color: #c4ccd6;
}

.panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.panel input,
.panel select,
.panel textarea {
  border-color: rgba(255, 255, 255, 0.18);
  background: #111923;
  color: #f8fafc;
}

.panel button {
  background: #2f5d9a;
}

.switch-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.switch-row input {
  width: 18px;
  height: 18px;
}

.selected-device {
  color: #c4ccd6;
  font-size: 13px;
}

.selected-device strong {
  color: #fff;
}

.main {
  min-width: 0;
  padding: 22px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.toolbar button {
  background: var(--accent-2);
}

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

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

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

.device-card {
  padding: 14px;
  border-left: 4px solid var(--muted);
  cursor: pointer;
}

.device-card.online {
  border-left-color: var(--accent);
}

.device-card.offline {
  border-left-color: var(--danger);
}

.device-card.selected {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.device-top,
.table-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.device-top h3 {
  margin: 0;
  font-size: 18px;
}

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

.status,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #edf1f5;
  color: var(--muted);
  white-space: nowrap;
}

.online .status,
.pill.success {
  background: #e7f5ef;
  color: var(--accent);
}

.offline .status,
.pill.failed {
  background: #fdecec;
  color: var(--danger);
}

.pill.running,
.pill.received,
.pill.pending {
  background: #fff5db;
  color: var(--warn);
}

dl {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
}

dl div {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 8px;
}

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

dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.table-wrap {
  overflow: hidden;
}

.table-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.table-head span {
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  font-size: 12px;
  color: var(--muted);
  background: #fafbfc;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.empty,
.empty-cell {
  color: var(--muted);
  padding: 18px;
}

.good {
  color: #9ee3c7 !important;
}

.bad {
  color: #ffb4aa !important;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #18202a;
  color: #fff;
  box-shadow: var(--shadow);
}

.bad-toast {
  background: var(--danger);
}

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

  .sidebar {
    min-height: auto;
  }

  .toolbar {
    align-items: stretch;
  }

  table {
    min-width: 760px;
  }

  .table-wrap {
    overflow-x: auto;
  }
}
