:root {
  color-scheme: light;
  --ink: #182230;
  --muted: #667085;
  --line: #d0d5dd;
  --soft: #f2f4f7;
  --panel: #ffffff;
  --blue: #175cd3;
  --green: #067647;
  --red: #b42318;
  --amber: #b54708;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background: #f8fafc;
  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: 22px 32px;
  background: #101828;
  color: white;
  border-bottom: 1px solid #344054;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

.eyebrow {
  color: #98a2b3;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

select,
input,
button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
}

button {
  cursor: pointer;
  border-color: #84adff;
  background: #155eef;
  color: white;
  font-weight: 800;
}

button:disabled {
  cursor: wait;
  opacity: 0.78;
}

.secondary-action {
  border-color: #b2ccff;
  background: #eff4ff;
  color: #175cd3;
}

main {
  padding: 24px 32px 40px;
}

.status-row,
.metrics,
.content-grid {
  display: grid;
  gap: 14px;
}

.status-row {
  grid-template-columns: 1.3fr 1fr 1.5fr;
  margin-bottom: 16px;
}

.status-row > div,
.metric,
.panel {
  background: var(--panel);
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.status-row > div {
  padding: 14px 16px;
}

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

.status-value {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.tab {
  min-height: 38px;
  background: white;
  color: #344054;
  border: 1px solid var(--line);
}

.tab.active {
  background: #155eef;
  border-color: #155eef;
  color: white;
}

.metrics {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-bottom: 16px;
}

.metric {
  padding: 18px;
}

.metric p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1.1;
}

.monitor-panel {
  margin-bottom: 16px;
}

.monitor-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.monitor-metric {
  min-width: 0;
  padding: 12px;
  border: 1px solid #eaecf0;
  border-radius: 8px;
  background: #f9fafb;
}

.monitor-metric p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.monitor-metric strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  line-height: 1.1;
}

.monitor-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.event-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.monitor-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 16px;
  margin-top: 16px;
}

.monitor-detail-grid h3 {
  margin: 0;
  color: #344054;
  font-size: 13px;
  line-height: 1.2;
}

.event-row {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid #eaecf0;
  color: var(--muted);
  font-size: 12px;
}

.event-row strong {
  color: var(--ink);
}

.event-row em {
  font-style: normal;
}

.event-row.detailed,
.event-row.device {
  grid-template-columns: 150px 1fr 170px auto;
}

.event-row small {
  color: #475467;
  font-weight: 700;
}

.content-grid {
  grid-template-columns: 1.3fr 1fr;
  margin-bottom: 16px;
}

.panel {
  padding: 18px;
}

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

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

.bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 60px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  background: #eaecf0;
  border-radius: 999px;
}

.bar-fill {
  height: 100%;
  background: #155eef;
  border-radius: inherit;
}

.list-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #eaecf0;
  font-size: 13px;
}

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

.approval-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid #eaecf0;
}

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

.approval-row strong {
  color: var(--ink);
  font-size: 14px;
}

.approval-description {
  margin-top: 3px;
  color: #475467;
  font-size: 13px;
}

.approval-row small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.approval-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.approval-actions button {
  min-height: 34px;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 12px;
}

.danger-action {
  border-color: #fecdca;
  background: #fef3f2;
  color: var(--red);
}

.table-panel {
  padding: 0;
  overflow: hidden;
}

.table-head {
  padding: 18px;
  margin: 0;
  border-bottom: 1px solid #eaecf0;
}

.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.table-actions input {
  width: min(380px, 100%);
}

.table-actions select {
  width: min(180px, 100%);
}

.table-edit-action {
  min-height: 30px;
  padding: 0 10px;
  border-color: #b2ccff;
  background: #eff4ff;
  color: #175cd3;
  font-size: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 24, 40, 0.45);
}

.edit-modal {
  width: min(920px, 100%);
  max-height: min(88vh, 760px);
  overflow: auto;
  padding: 18px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: white;
  box-shadow: 0 24px 60px rgba(16, 24, 40, 0.24);
}

.modal-head,
.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.icon-action {
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border-color: #d0d5dd;
  background: white;
  color: #344054;
  font-size: 24px;
  line-height: 1;
}

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

.edit-grid label {
  display: grid;
  gap: 6px;
  color: #475467;
  font-size: 12px;
  font-weight: 800;
}

.edit-grid .wide {
  grid-column: span 3;
}

.edit-readonly {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  background: #f9fafb;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

.table-wrap {
  overflow: auto;
  max-height: 58vh;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1060px;
  font-size: 13px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid #eaecf0;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #f9fafb;
  color: #475467;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  z-index: 1;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  text-transform: capitalize;
}

.approval-status {
  justify-self: end;
  align-self: start;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 14px;
  font-size: 12px;
}

.pill.ok {
  background: #dcfae6;
  color: var(--green);
}

.pill.warn {
  background: #fef0c7;
  color: var(--amber);
}

.pill.bad {
  background: #fee4e2;
  color: var(--red);
}

.error-banner {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 18px;
  padding: 14px 16px;
  border-radius: 8px;
  background: #fef3f2;
  border: 1px solid #fecdca;
  color: var(--red);
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.16);
}

@media (max-width: 900px) {
  .topbar,
  .toolbar,
  .table-head,
  .table-actions {
    align-items: stretch;
    flex-direction: column;
  }

  main,
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .status-row,
  .metrics,
  .content-grid,
  .monitor-grid,
  .monitor-detail-grid {
    grid-template-columns: 1fr;
  }

  .edit-grid {
    grid-template-columns: 1fr;
  }

  .edit-grid .wide {
    grid-column: span 1;
  }

  .event-row,
  .event-row.detailed,
  .event-row.device,
  .approval-row {
    grid-template-columns: 1fr;
  }
}
