:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --ink: #1f2933;
  --muted: #64748b;
  --line: #d7dee8;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-soft: #d9f4ef;
  --warn: #b45309;
  --danger: #b91c1c;
  --idle: #94a3b8;
}

* {
  box-sizing: border-box;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

.panel__subtext {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

main {
  width: min(1180px, calc(100vw - 32px));
  margin: 24px auto 48px;
}

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.tab {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 14px;
}

.tab.is-active {
  background: var(--accent);
  color: #ffffff;
}

.tab-panel {
  display: none;
  margin-top: 14px;
}

.tab-panel.is-active {
  display: block;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

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

.metric {
  padding: 18px;
}

.metric span,
.details dt,
.agent-row small {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.panel {
  margin-top: 12px;
  overflow: hidden;
}

.split .panel {
  margin-top: 0;
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 18px;
}

.details div {
  min-width: 0;
}

.details dd {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.agent-list {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr)) auto;
  gap: 12px;
  padding: 0 18px 16px;
}

.filters label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.filters span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.filters input,
.filters select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
}

.filter-actions {
  align-self: end;
  display: inline-flex;
  gap: 8px;
}

.filter-actions button,
.filter-actions a,
.pagination a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 12px;
  text-decoration: none;
  cursor: pointer;
}

.filter-actions button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.filter-disclosure {
  border-bottom: 1px solid var(--line);
}

.filter-disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.filter-disclosure summary::-webkit-details-marker {
  display: none;
}

.filter-disclosure summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  margin-right: 8px;
}

.filter-disclosure[open] summary::before {
  content: "-";
}

.filter-disclosure summary span {
  margin-right: auto;
}

.filter-disclosure summary strong {
  border-radius: 6px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 12px;
  padding: 5px 9px;
}

.agent-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.agent-row strong,
.agent-row small {
  display: block;
}

.topbar__status,
.badge,
.link-button {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  gap: 8px;
  white-space: nowrap;
}

.dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 999px;
  background: var(--idle);
}

.dot--ok {
  background: var(--accent);
}

.dot--idle {
  background: var(--idle);
}

.badge,
.link-button {
  border-radius: 6px;
  padding: 5px 10px;
  background: #eef2f7;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.badge--online,
.badge--printed {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge--failed,
.badge--failed_perm,
.badge--error {
  background: #fee2e2;
  color: var(--danger);
}

.badge--printer_offline,
.badge--offline {
  background: #ffedd5;
  color: var(--warn);
}

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

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

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

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

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

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

.padded {
  padding: 18px;
}

.agent-table {
  display: grid;
}

.agent-card {
  border-bottom: 1px solid var(--line);
}

.agent-card:last-child {
  border-bottom: 0;
}

.agent-card summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 0 18px;
  cursor: pointer;
  list-style: none;
}

.agent-card summary::-webkit-details-marker {
  display: none;
}

.agent-card summary strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.details--wide {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding-top: 0;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
}

.pagination span {
  color: var(--muted);
  font-size: 14px;
  padding: 0 6px;
}

.pagination .is-disabled {
  color: var(--idle);
  pointer-events: none;
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 20px;
  }

  main {
    width: min(100vw - 24px, 1180px);
    margin-top: 12px;
  }

  .metrics,
  .split,
  .details,
  .details--wide,
  .filters {
    grid-template-columns: 1fr;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .tab {
    padding-inline: 8px;
  }

  .filter-actions,
  .pagination {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}
