/* MQTT-Plug */
.mqtt-plug-root{
  border:1px solid #d0d7de;
  border-radius:10px;
  padding:12px;
  background:#fff;
  box-sizing:border-box;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.mqtt-plug-header{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:space-between;
  margin-bottom:10px;
}

.mqtt-plug-status{
  display:flex;
  align-items:center;
  gap:8px;
}

.mqtt-plug-dot{
  width:10px;
  height:10px;
  border-radius:50%;
  display:inline-block;
  background:#c7c7c7;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.mqtt-plug-dot.is-online{ background:#2da44e; }
.mqtt-plug-dot.is-offline{ background:#d1242f; }

.mqtt-plug-statustext{
  font-size:13px;
  font-weight:600;
}

.mqtt-plug-meta{
  display:flex;
  gap:8px;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:wrap;
}

.mqtt-plug-badge{
  font-size:11px;
  padding:2px 8px;
  border-radius:999px;
  border:1px solid #d0d7de;
  background:#f6f8fa;
  font-weight:700;
  letter-spacing:0.02em;
}

.mqtt-plug-muted{
  color:#57606a;
  font-size:12px;
}

.mqtt-plug-tabs{
  display:flex;
  align-items:center;
  gap:8px;
  margin:10px 0 10px;
  flex-wrap:wrap;
}

.mqtt-plug-spacer{ flex:1; }

.mqtt-plug-tab{
  border:1px solid #d0d7de;
  background:#f6f8fa;
  border-radius:8px;
  padding:6px 10px;
  cursor:pointer;
  font-size:13px;
}
.mqtt-plug-tab.is-active{
  background:#fff;
  font-weight:700;
}

.mqtt-plug-btn{
  border:1px solid #d0d7de;
  background:#fff;
  border-radius:8px;
  padding:6px 10px;
  cursor:pointer;
  font-size:13px;
}

/* History controls */
.mqtt-plug-historybar{
  display:flex;
  gap:10px;
  align-items:center;
  padding:10px 0;
}
.mqtt-plug-historylabel{
  display:flex;
  gap:6px;
  align-items:center;
  font-size:12px;
}
.mqtt-plug-historybar select{
  background: rgba(255,255,255,0.06);
  border:1px solid rgba(255,255,255,0.12);
  color: inherit;
  border-radius:8px;
  padding:4px 8px;
}

.mqtt-plug-pane{ margin-top:8px; }

.mqtt-plug-log{
  width:100%;
  min-height:220px;
  border:1px solid #d0d7de;
  background:#0b1020;
  color:#e6edf3;
  border-radius:10px;
  padding:10px;
  overflow:auto;
  box-sizing:border-box;
  font-size:12px;
  line-height:1.35;
}

.mqtt-plug-tablewrap{
  width:100%;
  overflow:auto;
  border:1px solid #d0d7de;
  border-radius:10px;
}

.mqtt-plug-table{
  width:100%;
  border-collapse:collapse;
  font-size:13px;
}
.mqtt-plug-table th,
.mqtt-plug-table td{
  border-bottom:1px solid #d0d7de;
  padding:8px 10px;
  vertical-align:top;
}
.mqtt-plug-table th{
  background:#f6f8fa;
  text-align:left;
  font-weight:700;
  font-size:12px;
  color:#24292f;
}

.mqtt-plug-tdtime{ white-space:nowrap; width:1%; }
.mqtt-plug-tdtopic code{ font-size:12px; }

.mqtt-plug-payload{
  margin:0;
  white-space:pre-wrap;
  word-break:break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size:12px;
}

@media (prefers-color-scheme: dark){
  .mqtt-plug-root{
    background:#0b1020;
    border-color:#30363d;
    color:#e6edf3;
  }
  .mqtt-plug-badge, .mqtt-plug-tab, .mqtt-plug-btn{
    border-color:#30363d;
  }
  .mqtt-plug-tab.is-active, .mqtt-plug-btn{
    background:#0b1020;
    color:#e6edf3;
  }
  .mqtt-plug-tablewrap{
    border-color:#30363d;
  }
  .mqtt-plug-table th{
    background:#111827;
    border-bottom-color:#30363d;
    color:#e6edf3;
  }
  .mqtt-plug-table td{
    border-bottom-color:#30363d;
  }
  .mqtt-plug-muted{
    color:#9da7b1;
  }
}


/* MQTT-Plug v0.1.0 */
.mqtt-plug-root{
  border:1px solid #d0d7de;
  border-radius:10px;
  padding:12px;
  background:#fff;
  box-sizing:border-box;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.mqtt-plug-header{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:space-between;
  margin-bottom:10px;
}

.mqtt-plug-status{
  display:flex;
  align-items:center;
  gap:8px;
}

.mqtt-plug-dot{
  width:10px;
  height:10px;
  border-radius:50%;
  display:inline-block;
  background:#c7c7c7;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.mqtt-plug-dot.is-online{ background:#2da44e; }
.mqtt-plug-dot.is-offline{ background:#d1242f; }

.mqtt-plug-statustext{
  font-size:13px;
  font-weight:600;
}

.mqtt-plug-meta{
  display:flex;
  gap:8px;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:wrap;
}

.mqtt-plug-badge{
  font-size:11px;
  padding:2px 8px;
  border-radius:999px;
  border:1px solid #d0d7de;
  background:#f6f8fa;
  font-weight:700;
  letter-spacing:0.02em;
}

.mqtt-plug-muted{
  color:#57606a;
  font-size:12px;
}

.mqtt-plug-tabs{
  display:flex;
  align-items:center;
  gap:8px;
  margin:10px 0 10px;
  flex-wrap:wrap;
}

.mqtt-plug-spacer{ flex:1; }

.mqtt-plug-tab{
  border:1px solid #d0d7de;
  background:#f6f8fa;
  border-radius:8px;
  padding:6px 10px;
  cursor:pointer;
  font-size:13px;
}
.mqtt-plug-tab.is-active{
  background:#fff;
  font-weight:700;
}

.mqtt-plug-btn{
  border:1px solid #d0d7de;
  background:#fff;
  border-radius:8px;
  padding:6px 10px;
  cursor:pointer;
  font-size:13px;
}

.mqtt-plug-pane{ margin-top:8px; }

.mqtt-plug-log{
  width:100%;
  min-height:220px;
  border:1px solid #d0d7de;
  background:#0b1020;
  color:#e6edf3;
  border-radius:10px;
  padding:10px;
  overflow:auto;
  box-sizing:border-box;
  font-size:12px;
  line-height:1.35;
}

.mqtt-plug-tablewrap{
  width:100%;
  overflow:auto;
  border:1px solid #d0d7de;
  border-radius:10px;
}

.mqtt-plug-table{
  width:100%;
  border-collapse:collapse;
  font-size:13px;
}
.mqtt-plug-table th,
.mqtt-plug-table td{
  border-bottom:1px solid #d0d7de;
  padding:8px 10px;
  vertical-align:top;
}
.mqtt-plug-table th{
  background:#f6f8fa;
  text-align:left;
  font-weight:700;
  font-size:12px;
  color:#24292f;
}

.mqtt-plug-tdtime{ white-space:nowrap; width:1%; }
.mqtt-plug-tdtopic code{ font-size:12px; }

.mqtt-plug-payload{
  margin:0;
  white-space:pre-wrap;
  word-break:break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size:12px;
}

@media (prefers-color-scheme: dark){
  .mqtt-plug-root{
    background:#0b1020;
    border-color:#30363d;
    color:#e6edf3;
  }
  .mqtt-plug-badge, .mqtt-plug-tab, .mqtt-plug-btn{
    border-color:#30363d;
  }
  .mqtt-plug-tab.is-active, .mqtt-plug-btn{
    background:#0b1020;
    color:#e6edf3;
  }
  .mqtt-plug-tablewrap{
    border-color:#30363d;
  }
  .mqtt-plug-table th{
    background:#111827;
    border-bottom-color:#30363d;
    color:#e6edf3;
  }
  .mqtt-plug-table td{
    border-bottom-color:#30363d;
  }
  .mqtt-plug-muted{
    color:#9da7b1;
  }
}



/* === Cards UI === */
.mqtt-plug-cards{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap:12px;
  margin:12px 0;
}
.mqtt-plug-card{
  border:1px solid #d0d7de;
  border-radius:10px;
  padding:12px;
  background:#fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.mqtt-plug-cardtop{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  gap:8px;
  margin-bottom:6px;
}
.mqtt-plug-cardtitle{
  font-size:13px;
  font-weight:700;
}
.mqtt-plug-cardtime{
  font-size:11px;
  color:#57606a;
  white-space:nowrap;
}
.mqtt-plug-cardmeta{
  font-size:11px;
  margin-bottom:8px;
}
.mqtt-plug-metrics{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:6px 10px;
}
.mqtt-plug-metric{
  border-top:1px dashed #d0d7de;
  padding-top:4px;
}
.mqtt-plug-mkey{
  font-size:11px;
  color:#57606a;
}
.mqtt-plug-mval{
  font-size:14px;
  font-weight:700;
}
.mqtt-plug-cardpreview{
  font-size:12px;
  white-space:pre-wrap;
  word-break:break-word;
}

.mqtt-plug-pane select{
  border:1px solid #d0d7de;
  border-radius:8px;
  padding:6px 8px;
  background:#fff;
  font-size:13px;
}

@media (prefers-color-scheme: dark){
  .mqtt-plug-card{
    background:#0b1020;
    border-color:#30363d;
  }
  .mqtt-plug-metric{
    border-top-color:#30363d;
  }
  .mqtt-plug-pane select{
    background:#0b1020;
    color:#e6edf3;
    border-color:#30363d;
  }
}
