/* 呼吸系统「在线设备」页样式。所有规则以 .breath-live-root 隔离，不影响全局样式。
   目标版式：1280px 宽、600px 视口高度可用；窄至 600px 不出现横向裁剪。 */

.breath-live-root {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.breath-live-root .bl-header h2 {
  margin: 0 0 4px;
}

.breath-live-root .bl-status {
  min-height: 1.2em;
  margin: 0;
  font-size: 13px;
}

.breath-live-root .bl-error { color: #ff7a7a; }
.breath-live-root .bl-ok { color: #6fdc8c; }
.breath-live-root .bl-warn { color: #ffbf47; }
.breath-live-root .bl-note { font-size: 13px; opacity: 0.9; margin: 4px 0; }
.breath-live-root .muted { opacity: 0.75; }

.breath-live-root .bl-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 240px;
  min-width: 0;
}

.breath-live-root .bl-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.breath-live-root .bl-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

/* 列表 */
.breath-live-root .bl-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.breath-live-root .bl-empty {
  border: 1px dashed var(--line, #2a3a46);
  border-radius: 8px;
  padding: 24px 16px;
  text-align: center;
}

.breath-live-root .bl-row,
.breath-live-root .bl-panel,
.breath-live-root .bl-command,
.breath-live-root .bl-sensor,
.breath-live-root .bl-cap {
  border: 1px solid var(--line, #2a3a46);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 0;
}

.breath-live-root .bl-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.breath-live-root .bl-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.breath-live-root .bl-row-grid {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 12px;
  font-size: 13px;
}

.breath-live-root .bl-row-grid .bl-k { opacity: 0.65; white-space: nowrap; }
.breath-live-root .bl-row-grid .bl-v { overflow-wrap: anywhere; min-width: 0; }

.breath-live-root .bl-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  border: 1px solid var(--line, #2a3a46);
  white-space: nowrap;
}

.breath-live-root .bl-badge.bl-ok { border-color: #2f7d4f; color: #6fdc8c; }
.breath-live-root .bl-badge.bl-warn { border-color: #8a6d1f; color: #ffbf47; }
.breath-live-root .bl-badge.bl-danger { border-color: #8a2f2f; color: #ff7a7a; }
.breath-live-root .bl-badge.bl-muted { opacity: 0.7; }

/* 详情面板 */
.breath-live-root .bl-panel h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.breath-live-root .bl-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.breath-live-root .bl-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px 14px;
}

.breath-live-root .bl-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  min-width: 0;
}

.breath-live-root .bl-field input,
.breath-live-root .bl-field select {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--line, #2a3a46);
  background: var(--panel, #0e1c26);
  color: inherit;
  max-width: 100%;
}

.breath-live-root .bl-group {
  grid-column: 1 / -1;
  border: 1px dashed var(--line, #2a3a46);
  border-radius: 8px;
  padding: 8px 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px 14px;
}

.breath-live-root .bl-group legend { font-size: 13px; padding: 0 6px; }

.breath-live-root .bl-confirm {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.breath-live-root .bl-confirm-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.breath-live-root .bl-preview {
  border: 1px dashed var(--accent, #f15b2a);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
}

.breath-live-root .bl-preview p { margin: 4px 0; overflow-wrap: anywhere; }
.breath-live-root .bl-result { margin: 4px 0; font-size: 13px; overflow-wrap: anywhere; }

/* 传感器 */
.breath-live-root .bl-sensor-list,
.breath-live-root .bl-command-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

/* 服务器事实 vs 设备自报 */
.breath-live-root .bl-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.breath-live-root .bl-fact-box {
  border: 1px dashed var(--line, #2a3a46);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.breath-live-root .bl-cap-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* 递归 JSON 展示 */
.breath-live-root .bl-json summary {
  cursor: pointer;
  font-size: 13px;
  padding: 4px 0;
  overflow-wrap: anywhere;
}

.breath-live-root .bl-json-body {
  margin: 4px 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--panel, #0e1c26);
  border: 1px solid var(--line, #2a3a46);
  font-size: 12px;
  line-height: 1.5;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* 按钮（沿用全局按钮类，补充本页微调） */
.breath-live-root button {
  font-size: 13px;
}

.breath-live-root .primary-button,
.breath-live-root .ghost-button,
.breath-live-root .mini-button {
  border-radius: 6px;
  cursor: pointer;
  padding: 8px 14px;
  border: 1px solid var(--line, #2a3a46);
  background: transparent;
  color: inherit;
}

.breath-live-root .primary-button {
  background: var(--accent, #f15b2a);
  border-color: var(--accent, #f15b2a);
  color: #fff;
}

.breath-live-root .primary-button:disabled,
.breath-live-root .ghost-button:disabled,
.breath-live-root .mini-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.breath-live-root .mini-button {
  padding: 4px 10px;
  align-self: flex-start;
}

/* 600px 窄视口：网格降列，不横向裁剪 */
@media (max-width: 640px) {
  .breath-live-root .bl-form,
  .breath-live-root .bl-group,
  .breath-live-root .bl-sensor-list,
  .breath-live-root .bl-command-list {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* Per-device login accounts stay within the breath module. */
.breath-live-root .bl-account-row {display:grid;grid-template-columns:minmax(120px,1fr) minmax(120px,1fr) minmax(180px,1.4fr) auto auto;gap:12px;align-items:end;padding:14px 0;border-bottom:1px solid var(--border,rgba(130,160,180,.2));}
.breath-live-root .bl-account-row input:not([type=checkbox]){width:100%;box-sizing:border-box;min-width:0;}
.breath-live-root .bl-activation-steps{padding-left:22px;line-height:1.9;color:var(--muted,#91a5b0);}
@media(max-width:850px){.breath-live-root .bl-account-row{grid-template-columns:1fr 1fr;}.breath-live-root .bl-account-row .bl-field:nth-child(3){grid-column:1/-1;}}
