:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #657084;
  --line: #dfe5ef;
  --brand: #1769e0;
  --brand-dark: #0f4ea8;
  --ok: #19a35b;
  --warn: #e2a100;
  --bad: #d83434;
  --idle: #8d99aa;
  --curve-temperature: #dc2626;
  --curve-power: #16a34a;
  --curve-anomaly: #7c3aed;
}

* {
  box-sizing: border-box;
}

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

[hidden] {
  display: none !important;
}

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

.auth-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: #eef3fb;
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 24px;
  box-shadow: 0 18px 46px rgba(23, 32, 51, 0.12);
}

.login-brand {
  margin-bottom: 22px;
  color: var(--ink);
}

.login-card label {
  margin-bottom: 12px;
}

.login-card input {
  width: 100%;
}

.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  background: #101827;
  color: #ffffff;
  padding: 24px 18px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--brand);
  font-weight: 800;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: #aeb8c8;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  background: transparent;
  color: #cbd5e3;
  text-align: left;
  cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
  background: #22304a;
  color: #ffffff;
}

.site-icp {
  color: #8793a7;
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

.site-icp span,
.site-icp a {
  display: block;
}

.site-icp a {
  color: inherit;
  text-decoration: none;
}

.site-icp a:hover {
  color: #ffffff;
  text-decoration: underline;
}

.login-icp {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.login-icp a:hover {
  color: var(--brand-dark);
}

.sidebar-icp {
  margin-top: auto;
  padding-top: 24px;
}

.main {
  padding: 24px;
  overflow: hidden;
}

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

.userbar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 5px;
  font-size: 26px;
}

h2 {
  margin-bottom: 12px;
  font-size: 18px;
}

.topbar p,
.section-head p {
  margin-bottom: 0;
  color: var(--muted);
}

.connection {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--panel);
  color: var(--muted);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--warn);
}

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

.view {
  display: none;
}

.view.active {
  display: block;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

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

.summary-card {
  padding: 16px;
}

.summary-card span {
  color: var(--muted);
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.summary-card small {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-summary-total {
  border-color: #b8c9df;
  background: #f2f6fb;
  color: #294b75;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

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

input,
select,
textarea {
  min-width: 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #ffffff;
  color: var(--ink);
}

.device-grid {
  display: grid;
  gap: 10px;
}

.device-grid.layout-5x5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.device-grid.layout-10x5,
.device-grid.layout-10x10 {
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 6px;
}

.device-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.dashboard-card {
  min-width: 0;
  padding: 12px;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.dashboard-card.state-aging {
  border-color: #77c994;
  background: #e4f7eb;
}

.dashboard-card.state-failed {
  border-color: #ef8585;
  background: #ffe5e5;
}

.dashboard-card.state-paused {
  border-color: #e6ad44;
  background: #fff4d6;
}

.dashboard-card.state-idle {
  border-color: #8bb5f2;
  background: #eaf2ff;
}

.dashboard-card.state-offline {
  border-color: #aeb6c2;
  background: #e4e8ed;
  color: #626d7b;
}

.dashboard-card.state-aging .dashboard-card-head span,
.dashboard-summary-running {
  color: #117a43;
}

.dashboard-summary-running {
  border-color: #b8dfc9;
  background: #f0faf5;
}

.dashboard-card.state-failed .dashboard-card-head span,
.dashboard-summary-failed {
  color: #b42323;
}

.dashboard-summary-failed {
  border-color: #f0b9b9;
  background: #fff2f2;
}

.dashboard-card.state-paused .dashboard-card-head span,
.dashboard-summary-paused {
  color: #8a4b00;
}

.dashboard-summary-paused {
  border-color: #e7c277;
  background: #fff8e8;
}

.dashboard-card.state-idle .dashboard-card-head span,
.dashboard-summary-idle {
  color: #175eb5;
}

.dashboard-summary-idle {
  border-color: #bfd3f1;
  background: #f1f6fd;
}

.dashboard-card.state-offline .dashboard-card-head span,
.dashboard-summary-offline {
  color: #596270;
}

.dashboard-summary-offline {
  border-color: #cbd1d9;
  background: #f0f2f5;
}

.dashboard-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.dashboard-card-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-card-head span {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 6px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 700;
}

.dashboard-meta,
.dashboard-foot {
  margin-top: 6px;
  overflow: hidden;
  color: #5f6c7b;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.dashboard-metrics span {
  min-width: 0;
  border-radius: 6px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.62);
}

.dashboard-metrics small,
.dashboard-metrics strong {
  display: block;
}

.dashboard-metrics small {
  color: #657282;
  font-size: 10px;
}

.dashboard-metrics strong {
  margin-top: 2px;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
}

.dashboard-record-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(74, 86, 101, 0.16);
}

.dashboard-record-stats span {
  min-width: 0;
  text-align: center;
}

.dashboard-record-stats small,
.dashboard-record-stats strong {
  display: block;
}

.dashboard-record-stats small {
  color: #657282;
  font-size: 10px;
}

.dashboard-record-stats strong {
  margin-top: 1px;
  font-size: 14px;
}

.dashboard-record-stats .record-pass strong {
  color: #167446;
}

.dashboard-record-stats .record-fail strong {
  color: #b42318;
}

.health-good,
.health-stable {
  color: #167446 !important;
}

.health-warning {
  color: #9a6700 !important;
}

.health-risk {
  color: var(--bad) !important;
}

.health-unknown {
  color: var(--muted) !important;
}

.dashboard-error {
  margin-top: 8px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layout-10x5 .dashboard-card,
.layout-10x10 .dashboard-card {
  padding: 7px;
}

.layout-10x5 .dashboard-card-head strong,
.layout-10x10 .dashboard-card-head strong {
  display: -webkit-box;
  min-height: 30px;
  overflow: hidden;
  font-size: 12px;
  line-height: 15px;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.layout-10x5 .dashboard-card-head,
.layout-10x10 .dashboard-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
}

.layout-10x5 .dashboard-card-head span,
.layout-10x10 .dashboard-card-head span {
  justify-self: start;
  padding: 2px 4px;
  font-size: 9px;
}

.layout-10x5 .dashboard-meta,
.layout-10x10 .dashboard-meta {
  font-size: 9px;
}

.layout-10x5 .dashboard-metrics,
.layout-10x10 .dashboard-metrics {
  gap: 4px;
  margin-top: 6px;
}

.layout-10x5 .dashboard-metrics span,
.layout-10x10 .dashboard-metrics span {
  padding: 4px;
}

.layout-10x5 .dashboard-metrics strong,
.layout-10x10 .dashboard-metrics strong {
  font-size: 11px;
}

.layout-10x5 .dashboard-record-stats,
.layout-10x10 .dashboard-record-stats {
  gap: 2px;
  margin-top: 5px;
  padding-top: 4px;
}

.layout-10x5 .dashboard-record-stats small,
.layout-10x10 .dashboard-record-stats small {
  font-size: 8px;
}

.layout-10x5 .dashboard-record-stats strong,
.layout-10x10 .dashboard-record-stats strong {
  font-size: 11px;
}

.layout-10x5 .dashboard-secondary,
.layout-10x10 .dashboard-secondary {
  display: none;
}

.layout-10x5 .dashboard-error,
.layout-10x10 .dashboard-error {
  margin-top: 5px;
  font-size: 9px;
}

.dashboard-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.dashboard-pager > div {
  display: flex;
  gap: 8px;
}

.device-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.device-head strong {
  display: block;
  margin-bottom: 4px;
}

.device-head small {
  color: var(--muted);
}

.badge {
  align-self: start;
  border-radius: 999px;
  padding: 5px 9px;
  background: #e8f3ff;
  color: var(--brand-dark);
  font-size: 12px;
}

.channel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 14px;
}

.channel {
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.channel.running {
  border-color: #b4d9c6;
  background: #f0fbf5;
}

.channel.done {
  border-color: #a9c7ff;
  background: #eef5ff;
}

.channel.alarm {
  border-color: #ffb4b4;
  background: #fff0f0;
  animation: pulse 1.1s ease-in-out infinite;
}

.channel.paused {
  border-color: #e7bf6b;
  background: #fff7e2;
  color: #7a4800;
}

.channel.idle {
  background: #f4f6f9;
  color: var(--idle);
}

.channel-top {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 7px;
  font-weight: 700;
}

.channel-top span:last-child {
  font-size: 12px;
}

.channel-data {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.section-head {
  margin-bottom: 16px;
}

.devices-section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.devices-section-head .primary {
  flex: none;
}

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

.devices-head-actions select {
  min-width: 120px;
}

.devices-head-actions label {
  gap: 4px;
  font-size: 12px;
}

.device-search-field input {
  width: 220px;
  padding: 8px 10px;
}

#deviceFilterCount {
  padding: 10px 0;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

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

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

th {
  background: #f7f9fc;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.table-sort {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-weight: inherit;
  white-space: nowrap;
}

.table-sort:hover,
.table-sort.active {
  color: var(--brand-dark);
}

.table-sort span {
  min-width: 10px;
  color: var(--brand);
}

td {
  font-size: 14px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef5ff;
  color: var(--brand-dark);
  white-space: nowrap;
}

.status.pass {
  background: #eaf8f0;
  color: #0c7d43;
}

.status.pass.attention {
  background: #fff0bd;
  color: #835600;
}

.status.paused {
  background: #fff0bd;
  color: #835600;
}

.status.incomplete {
  background: #fff6dd;
  color: #8a5a00;
}

.status.fail {
  background: #fff0f0;
  color: var(--bad);
}

.status.running {
  background: #fff7df;
  color: #9a6700;
}

.device-imei {
  display: grid;
  gap: 3px;
  white-space: nowrap;
}

.device-imei small {
  color: var(--muted);
}

.device-imei.mismatch strong,
.device-imei.mismatch small {
  color: var(--bad);
}

.device-imei .credential-mode {
  width: fit-content;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 11px;
}

.device-imei .credential-mode.device {
  background: #e6f7ee;
  color: #087443;
}

.device-imei .credential-mode.legacy {
  background: #fff3d6;
  color: #835600;
}

.device-name-editor {
  display: flex;
  min-width: 180px;
}

.device-name-editor input {
  width: 100%;
  min-width: 150px;
  padding: 7px 9px;
}

.device-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 68px;
}

.device-actions .secondary-button {
  padding: 6px 8px;
}

.device-action-menu {
  position: relative;
}

.device-action-menu summary {
  min-width: 58px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 9px;
  background: #ffffff;
  color: var(--brand);
  cursor: pointer;
  list-style: none;
  text-align: center;
  white-space: nowrap;
}

.device-action-menu summary::-webkit-details-marker {
  display: none;
}

.device-action-menu summary::after {
  margin-left: 5px;
  color: var(--muted);
  content: "▾";
}

.device-action-menu[open] summary {
  border-color: var(--brand);
  background: #eaf3ff;
}

.device-action-menu > div {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  display: grid;
  width: 126px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px;
  box-shadow: 0 8px 24px rgba(18, 36, 65, 0.16);
  background: #ffffff;
}

.device-action-menu button {
  border: 0;
  border-radius: 4px;
  padding: 8px 9px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.device-action-menu button:hover {
  background: #edf4ff;
  color: var(--brand-dark);
}

.device-action-menu button.danger-button {
  color: var(--bad);
}

.device-action-menu button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.device-pager,
.record-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 2px 0;
  color: var(--muted);
  font-size: 13px;
}

.device-pager > div,
.record-pager > div {
  display: flex;
  gap: 6px;
}

.device-pager .secondary-button,
.record-pager .secondary-button {
  padding: 6px 9px;
}

.device-empty-row {
  padding: 36px 16px;
  color: var(--muted);
  text-align: center;
}

.curve-panel {
  margin-bottom: 16px;
  min-height: 260px;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
}

.modal.open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
}

.modal-dialog {
  position: relative;
  width: min(1040px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  margin: 24px auto;
  overflow: auto;
  border-radius: 8px;
  background: var(--panel);
  padding: 20px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.24);
}

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  z-index: 1;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--ink);
  border-color: var(--brand);
}

.device-create-dialog {
  width: min(680px, calc(100vw - 32px));
}

.device-create-head {
  padding-right: 46px;
  margin-bottom: 18px;
}

.device-create-head h2 {
  margin: 4px 0 7px;
  font-size: 22px;
}

.device-create-head p,
.device-create-fields small {
  margin: 0;
  color: var(--muted);
}

.device-create-product {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px;
  background: #f7f9fc;
  font-size: 13px;
}

.device-create-product span {
  color: var(--muted);
}

.device-create-fields input,
.device-create-fields select,
.device-create-fields textarea {
  width: 100%;
  min-width: 0;
}

.device-create-fields textarea {
  resize: vertical;
}

.device-create-description {
  grid-column: 1 / -1;
}

.device-create-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.device-create-actions .primary {
  margin-top: 0;
}

.claim-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.claim-button span {
  min-width: 20px;
  border-radius: 999px;
  padding: 2px 6px;
  background: #d83434;
  color: #ffffff;
  font-size: 11px;
  text-align: center;
}

.device-claims-dialog {
  width: min(900px, calc(100vw - 32px));
}

.device-claim-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fc;
}

.device-claim-summary span {
  padding: 10px 14px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.device-claim-summary span:last-child {
  border-right: 0;
}

.device-claim-summary strong {
  margin-right: 4px;
  color: var(--ink);
  font-size: 17px;
}

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

.device-claim-card {
  border: 1px solid var(--line);
  border-left: 4px solid #90a0b8;
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.device-claim-card.status-pending {
  border-left-color: #e59b00;
}

.device-claim-card.status-approved,
.device-claim-card.status-delivered {
  border-left-color: #159455;
}

.device-claim-card.status-rejected,
.device-claim-card.status-expired,
.device-claim-card.status-revoked {
  border-left-color: #c44848;
}

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

.device-claim-head > div {
  display: grid;
  gap: 3px;
}

.device-claim-head span,
.device-claim-meta,
.device-claim-result {
  color: var(--muted);
  font-size: 12px;
}

.claim-status {
  border-radius: 999px;
  padding: 5px 9px;
  background: #f1f4f8;
  white-space: nowrap;
}

.device-claim-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 9px;
}

.device-claim-fields {
  display: grid;
  grid-template-columns: minmax(180px, 0.75fr) minmax(0, 1fr) minmax(180px, 0.55fr);
  gap: 10px;
  margin-top: 12px;
}

.device-claim-fields input,
.device-claim-fields select {
  width: 100%;
  min-width: 0;
}

.device-claim-fields small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.device-claim-fields input[readonly] {
  background: #f1f4f8;
  color: var(--muted);
}

.device-claim-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

.device-claim-result {
  margin-top: 11px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.device-claim-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 36px 18px;
  color: var(--muted);
  text-align: center;
}

.message.success {
  color: var(--ok);
}

.message.warning {
  color: #8a5a00;
}

.curve-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 12px;
}

.curve-head p,
.curve-empty {
  color: var(--muted);
}

.curve-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.curve-stat {
  border-radius: 8px;
  background: #f4f7fb;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 13px;
}

.curve-stat strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 16px;
}

.analysis-loading {
  min-height: 220px;
  display: grid;
  place-items: center;
}

.curve-error {
  border: 1px solid #f1b5b5;
  border-radius: 8px;
  padding: 18px;
  background: #fff3f3;
  color: var(--bad);
}

.ai-analysis {
  margin: 14px 0;
  border: 1px solid #cdd9ea;
  border-left: 5px solid var(--brand);
  border-radius: 8px;
  padding: 15px;
  background: #f7faff;
}

.ai-analysis.normal,
.ai-analysis.running {
  border-left-color: var(--ok);
  background: #f3fbf7;
}

.ai-analysis.warning {
  border-left-color: var(--warn);
  background: #fffbef;
}

.ai-analysis.fault {
  border-left-color: var(--bad);
  background: #fff5f5;
}

.ai-analysis.insufficient {
  border-left-color: var(--idle);
  background: #f7f8fa;
}

.ai-analysis-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.ai-analysis-head h3 {
  margin: 4px 0 0;
  font-size: 20px;
}

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

.ai-confidence {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
}

.ai-summary {
  margin: 10px 0 12px;
  line-height: 1.65;
}

.ai-thermal-profile {
  margin: 0 0 12px;
  border: 1px solid rgba(29, 119, 78, 0.2);
  border-radius: 6px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.ai-thermal-profile-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.ai-thermal-profile-head span {
  color: var(--muted);
  font-size: 12px;
}

.ai-thermal-profile-head strong {
  font-size: 14px;
}

.ai-phase-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ai-phase {
  min-width: 0;
  border-left: 3px solid #df9700;
  padding: 6px 8px;
  background: #fff9eb;
}

.ai-phase.regulated {
  border-left-color: #2784d8;
  background: #f1f8ff;
}

.ai-phase.holding {
  border-left-color: var(--ok);
  background: #eefaf3;
}

.ai-phase small,
.ai-phase strong,
.ai-phase em {
  display: block;
}

.ai-phase small,
.ai-phase em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.ai-phase strong {
  margin: 2px 0 3px;
  font-size: 13px;
}

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

.ai-metrics span {
  min-width: 0;
  border: 1px solid rgba(99, 115, 140, 0.16);
  border-radius: 6px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.ai-metrics small,
.ai-metrics strong {
  display: block;
}

.ai-metrics small {
  color: var(--muted);
  font-size: 11px;
}

.ai-metrics strong {
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.ai-report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 16px;
  margin-top: 14px;
}

.ai-report-grid h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.ai-anomaly-list {
  display: grid;
  gap: 7px;
}

.ai-anomaly {
  border-left: 3px solid var(--warn);
  padding: 7px 9px;
  background: rgba(255, 255, 255, 0.8);
}

.ai-anomaly.fault {
  border-left-color: var(--bad);
}

.ai-anomaly > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.ai-anomaly time,
.ai-anomaly small,
.ai-empty,
.ai-notice {
  color: var(--muted);
  font-size: 12px;
}

.ai-anomaly p {
  margin: 4px 0;
  font-size: 13px;
}

.ai-recommendations {
  margin: 0;
  padding-left: 20px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.65;
}

.ai-notice {
  margin: 12px 0 0;
  border-top: 1px solid rgba(99, 115, 140, 0.14);
  padding-top: 9px;
}

.error-list {
  display: grid;
  gap: 4px;
}

.error-item {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 3px 8px;
  background: #fff0f0;
  color: var(--bad);
  font-size: 12px;
}

.error-item.ok {
  background: #eaf8f0;
  color: #0c7d43;
}

.status-code {
  color: var(--muted);
  font-size: 12px;
}

.record-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.category-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: #ffffff;
  color: var(--muted);
  cursor: pointer;
}

.category-button.active,
.category-button:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: #eaf3ff;
}

#records .toolbar {
  gap: 8px 10px;
  margin-bottom: 10px;
}

#records .toolbar label {
  gap: 4px;
}

#records .toolbar input,
#records .toolbar select {
  min-width: 130px;
  padding: 7px 9px;
}

#records #recordPsn {
  width: 210px;
}

#records #recordFault {
  width: 180px;
}

#records #recordStartDate,
#records #recordEndDate {
  width: 150px;
}

#recordFilterCount {
  padding: 9px 0;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.record-table-wrap {
  max-height: calc(100vh - 290px);
  min-height: 320px;
}

.record-management-table {
  min-width: 930px;
  table-layout: fixed;
}

.record-management-table th:nth-child(1) {
  width: 4%;
}

.record-management-table th:nth-child(2) {
  width: 9%;
}

.record-management-table th:nth-child(3) {
  width: 11%;
}

.record-management-table th:nth-child(4) {
  width: 14%;
}

.record-management-table th:nth-child(5) {
  width: 12%;
}

.record-management-table th:nth-child(6) {
  width: 12%;
}

.record-management-table th:nth-child(7) {
  width: 16%;
}

.record-management-table th:nth-child(8) {
  width: 9%;
}

.record-management-table th:nth-child(9) {
  width: 5%;
}

.record-management-table th:nth-child(10) {
  width: 8%;
}

#records .record-management-table th,
#records .record-management-table td {
  padding: 6px 9px;
}

#records .record-management-table td {
  height: 50px;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.25;
}

.record-management-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
}

.record-management-table th:last-child,
.record-management-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 4;
  background: #ffffff;
  box-shadow: -8px 0 12px -12px rgba(18, 36, 65, 0.45);
  text-align: center;
}

.record-management-table thead th:last-child {
  z-index: 7;
  background: #f7f9fc;
}

.record-management-table tr.record-quality-perfect td {
  background: #f2fbf5;
}

.record-management-table tr.record-quality-attention td {
  background: #fff8dc;
}

.record-management-table tr.record-quality-perfect td:last-child {
  background: #f2fbf5;
}

.record-management-table tr.record-quality-attention td:last-child {
  background: #fff8dc;
}

.record-select-column {
  text-align: center;
}

.record-select-column input {
  width: 16px;
  min-width: 16px;
  max-width: 16px;
  height: 16px;
  padding: 0;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.record-batch-actions {
  display: flex;
  min-height: 50px;
  margin: 0 0 10px;
  align-items: center;
  gap: 10px;
  border: 1px solid #cbd8eb;
  border-radius: 8px;
  padding: 8px 12px;
  background: #f7faff;
}

.record-batch-actions > div {
  display: grid;
  margin-right: auto;
  gap: 2px;
}

.record-batch-actions > div span {
  color: var(--muted);
  font-size: 12px;
}

.record-batch-actions > div b {
  color: var(--brand-dark);
}

.record-batch-analysis-dialog {
  width: min(1180px, calc(100vw - 32px));
}

.record-batch-analysis-head span,
.record-batch-result-head span {
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.record-batch-analysis-head h2,
.record-batch-result-head h3 {
  margin: 3px 0 6px;
}

.record-batch-analysis-head p {
  margin: 0;
  color: var(--muted);
}

.record-batch-analysis-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 12px;
  margin-top: 18px;
  align-items: end;
}

.record-batch-selection-summary {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 14px;
  background: #f8fafc;
  white-space: nowrap;
}

.record-batch-loading {
  margin-top: 16px;
  border: 1px dashed #b8c7dc;
  border-radius: 8px;
  padding: 32px 16px;
  color: var(--muted);
  text-align: center;
}

.record-batch-result {
  display: grid;
  gap: 16px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.record-batch-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.record-batch-result-head > strong {
  border-radius: 999px;
  padding: 7px 12px;
  background: #eaf3ff;
  color: var(--brand-dark);
}

.record-batch-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.record-batch-totals span {
  display: grid;
  gap: 3px;
  border-right: 1px solid var(--line);
  padding: 10px 14px;
}

.record-batch-totals span:last-child {
  border-right: 0;
}

.record-batch-totals small,
.record-batch-parameter-head p,
.record-batch-parameter-grid article > small {
  color: var(--muted);
}

.record-batch-summary {
  margin: 0;
  border-left: 4px solid var(--brand);
  padding: 12px 14px;
  background: #f4f8ff;
  line-height: 1.7;
}

.record-batch-findings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.record-batch-findings section,
.record-batch-result > section.wide {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
}

.record-batch-findings h4,
.record-batch-result > section.wide h4,
.record-batch-parameters h4 {
  margin: 0 0 8px;
}

.record-batch-findings ul,
.record-batch-result > section.wide ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.65;
}

.record-batch-findings li small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.record-batch-findings section > p,
.record-batch-result > section.wide > p {
  margin: 0;
  color: var(--muted);
}

.record-batch-parameter-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.record-batch-parameter-head p {
  margin: 0;
}

.record-batch-parameter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.record-batch-parameter-grid article {
  display: grid;
  align-content: start;
  gap: 8px;
  border: 1px solid #cbd8e8;
  border-top: 3px solid #4d8bd8;
  border-radius: 7px;
  padding: 12px;
  background: #fff;
}

.record-batch-parameter-grid article.adjust {
  border-top-color: var(--warn);
  background: #fffdf5;
}

.record-batch-parameter-grid article.insufficient {
  border-top-color: #94a3b8;
  background: #f8fafc;
}

.record-batch-parameter-grid article.accepted {
  border-color: #8fd2aa;
  border-top-color: var(--ok);
  background: #f2fbf6;
}

.record-batch-parameter-grid article.rejected {
  border-color: #cbd5e1;
  border-top-color: #94a3b8;
  background: #f8fafc;
}

.record-batch-parameter-grid header,
.record-batch-parameter-values {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.record-batch-parameter-grid header span {
  color: var(--muted);
  font-size: 11px;
}

.record-batch-parameter-values {
  border-radius: 5px;
  padding: 7px 9px;
  background: #f3f6fa;
  font-size: 12px;
}

.record-batch-parameter-grid article > p {
  margin: 0;
  line-height: 1.55;
}

.record-batch-parameter-grid article > small {
  line-height: 1.45;
}

.record-batch-bulk-actions,
.record-batch-parameter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.record-batch-bulk-actions {
  flex: 0 0 auto;
}

.record-batch-parameter-actions {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.record-batch-parameter-actions button {
  min-width: 0;
  flex: 1;
  padding: 7px 9px;
}

.record-batch-decision {
  margin-top: auto;
  border-radius: 5px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.record-batch-decision.accepted {
  background: #dff5e8;
  color: #18743b;
}

.record-batch-notice {
  margin: 0;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 820px) {
  .record-batch-actions,
  .record-batch-result-head {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .record-batch-analysis-form,
  .record-batch-findings,
  .record-batch-parameter-grid {
    grid-template-columns: 1fr;
  }

  .record-batch-parameter-head {
    display: grid;
  }

  .record-batch-totals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .record-batch-totals span:nth-child(2) {
    border-right: 0;
  }

  .record-batch-totals span:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
}

.table-help-mark {
  display: inline-flex;
  width: 16px;
  height: 16px;
  margin-left: 3px;
  align-items: center;
  justify-content: center;
  border: 1px solid #aebbd0;
  border-radius: 50%;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
  cursor: help;
}

.table-help-mark:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.ui-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.record-evaluation-header,
.record-evaluation-cell {
  text-align: center;
}

.record-evaluation-status {
  display: inline-flex;
  width: 26px;
  height: 26px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: help;
}

.record-evaluation-status.normal {
  border-color: #a7dfbc;
  background: #eaf8ef;
  color: #15803d;
}

.record-evaluation-status.problem {
  border-color: #f3b6b6;
  background: #fff0f0;
  color: #c62828;
}

.record-evaluation-status.pending {
  border-color: #d5dce8;
  background: #f4f6f9;
  color: #718096;
}

.record-icon-button {
  display: inline-flex;
  width: 32px;
  height: 30px;
  padding: 0;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd9ee;
  border-radius: 6px;
  background: #ffffff;
  color: var(--primary);
  cursor: pointer;
}

.record-icon-button:hover {
  border-color: var(--primary);
  background: #eef5ff;
}

.record-icon-button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.record-batch-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-device-cell,
.record-identity-cell,
.record-time-cell,
.record-metric-cell {
  min-width: 0;
}

.record-device-cell strong,
.record-identity-cell strong,
.record-time-cell strong,
.record-metric-cell strong,
.record-issue strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-device-cell span,
.record-identity-cell span,
.record-time-cell span,
.record-metric-cell span,
.record-issue > span {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-issue strong {
  display: flex;
  align-items: center;
  gap: 5px;
}

.record-issue.alarm strong,
.record-issue.alarm > span {
  color: var(--bad);
}

.record-issue.ok strong {
  color: #0c7d43;
}

.record-issue.perfect strong {
  color: #0c7d43;
}

.record-issue.attention strong,
.record-issue.attention > span {
  color: #835600;
}

.record-empty-row {
  padding: 36px 16px !important;
  color: var(--muted);
  text-align: center;
}

.record-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.record-summary span {
  border-radius: 999px;
  padding: 4px 8px;
  background: #f4f7fb;
  color: var(--muted);
  font-size: 12px;
}

.group-editor {
  display: grid;
  grid-template-columns: minmax(150px, 1fr);
  min-width: 170px;
}

.group-editor select {
  min-width: 0;
  width: 100%;
  padding: 8px 9px;
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.settings-layout > .panel {
  padding: 18px;
}

.settings-layout form button {
  margin-top: 14px;
}

.dingtalk-settings {
  margin-top: 16px;
}

.dingtalk-head,
.dingtalk-form-title,
.dingtalk-fieldset > div:first-child,
.dingtalk-robot-head,
.dingtalk-robot-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.dingtalk-head {
  align-items: flex-start;
  margin-bottom: 18px;
}

.dingtalk-head h2 {
  margin: 4px 0 6px;
}

.dingtalk-head p,
.dingtalk-form-title small,
.dingtalk-fieldset small,
.dingtalk-robot-meta,
.dingtalk-robot-status,
.dingtalk-form label > small {
  color: var(--muted);
}

#dingtalkRobotCount {
  border-radius: 999px;
  padding: 6px 10px;
  background: #eef5ff;
  color: var(--brand-dark);
  font-size: 12px;
  white-space: nowrap;
}

.dingtalk-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(380px, 1.1fr);
  gap: 16px;
  align-items: start;
}

.dingtalk-form {
  display: grid;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #f8faff;
}

.dingtalk-form-title > div {
  display: grid;
  gap: 3px;
}

.toggle-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 7px;
  color: var(--ink);
}

.toggle-row input,
.dingtalk-events input,
.dingtalk-targets input {
  min-width: 0;
}

.dingtalk-fieldset {
  display: grid;
  gap: 9px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.dingtalk-targets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-height: 230px;
  overflow: auto;
}

.dingtalk-targets .check-row {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
  background: #ffffff;
}

.dingtalk-events {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dingtalk-events label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 9px;
  background: #ffffff;
  color: var(--ink);
}

.dingtalk-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.dingtalk-form-actions .primary {
  margin-top: 0;
}

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

.dingtalk-robot {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.dingtalk-robot.disabled {
  background: #f7f8fa;
  opacity: 0.76;
}

.dingtalk-robot-head strong {
  font-size: 15px;
}

.dingtalk-robot-head .status {
  font-size: 12px;
}

.dingtalk-robot-meta {
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.7;
}

.dingtalk-event-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 8px 0 10px;
}

.dingtalk-event-tags span {
  border-radius: 999px;
  padding: 3px 7px;
  background: #edf4ff;
  color: #315f9d;
  font-size: 11px;
}

.dingtalk-robot-status {
  margin: 0 0 10px;
  font-size: 12px;
}

.dingtalk-robot-status.failed {
  color: var(--bad);
}

.dingtalk-robot-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.dingtalk-robot-actions button {
  padding: 7px 9px;
}

.analysis-admin {
  display: grid;
  grid-template-columns: minmax(340px, 0.75fr) minmax(360px, 1.25fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 24px;
}

.analysis-form .section-head {
  margin-bottom: 14px;
}

.section-head.compact h2,
.analysis-report-head h2 {
  margin-bottom: 4px;
}

.cycle-options {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  min-height: 42px;
  align-items: center;
}

.analysis-scope-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 220px;
}

.analysis-check-row span {
  display: grid;
  min-width: 0;
}

.analysis-check-row strong,
.analysis-check-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-check-row small {
  color: var(--muted);
}

.analysis-plan-list,
.analysis-report-list,
.analysis-issues,
.analysis-trend {
  display: grid;
  gap: 10px;
}

.analysis-plan {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.analysis-plan:last-child {
  border-bottom: 0;
}

.analysis-plan > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.analysis-plan .analysis-plan-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.analysis-plan-actions button {
  white-space: nowrap;
}

.analysis-plan small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-report-head {
  align-items: end;
}

.analysis-report-head label {
  width: 150px;
}

.analysis-report {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
}

.analysis-report-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.analysis-report-header h3 {
  display: inline;
  margin: 0 0 0 8px;
}

.analysis-report-header p {
  margin: 7px 0 0;
  color: var(--muted);
}

.analysis-cycle {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eaf3ff;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
}

.analysis-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 18px 0 12px;
  border-block: 1px solid var(--line);
}

.analysis-metric {
  display: grid;
  gap: 4px;
  padding: 13px 14px;
  border-right: 1px solid var(--line);
}

.analysis-metric:last-child {
  border-right: 0;
}

.analysis-metric span,
.analysis-metric small {
  color: var(--muted);
}

.analysis-metric strong {
  font-size: 24px;
}

.analysis-metric small {
  margin-left: 4px;
  font-size: 12px;
  font-weight: 400;
}

.analysis-extra-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  color: var(--muted);
  font-size: 13px;
}

.analysis-extra-metrics strong {
  color: var(--ink);
}

.analysis-summary {
  margin: 14px 0;
  color: var(--ink);
  line-height: 1.7;
}

.latent-risk {
  margin: 16px 0;
  padding: 14px;
  border: 1px solid #cdd8e5;
  border-left: 4px solid #3977b9;
  border-radius: 6px;
  background: #f7faff;
}

.latent-risk.unknown {
  border-color: #d4dbe4;
  border-left-color: #7a8796;
  background: #f8fafc;
}

.latent-risk.medium {
  border-color: #e4c47e;
  border-left-color: #b7791f;
  background: #fffaf0;
}

.latent-risk.high {
  border-color: #e6abab;
  border-left-color: #c53030;
  background: #fff7f7;
}

.latent-risk-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.latent-risk-head h4,
.latent-risk-head p {
  margin: 0;
}

.latent-risk-head p {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.6;
}

.latent-risk-badge {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: #dcecff;
  color: #245b91;
  font-size: 12px;
  font-weight: 700;
}

.latent-risk.unknown .latent-risk-badge {
  background: #e8edf2;
  color: #536171;
}

.latent-risk.medium .latent-risk-badge {
  background: #f9e8bd;
  color: #805612;
}

.latent-risk.high .latent-risk-badge {
  background: #f8d7d7;
  color: #9d2525;
}

.latent-comparison,
.latent-product-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
}

.latent-product-metrics {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 12px 0;
}

.latent-comparison > div,
.latent-product-metrics > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px;
  background: var(--panel);
}

.latent-comparison span,
.latent-product-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.latent-comparison strong,
.latent-product-metrics strong {
  overflow-wrap: anywhere;
}

.latent-details {
  margin-top: 12px;
  border-top: 1px solid rgba(106, 123, 143, 0.22);
  padding-top: 10px;
}

.latent-details summary {
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 700;
}

.latent-signals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.latent-signal {
  padding: 10px 11px;
  border: 1px solid #d4deea;
  border-radius: 6px;
  background: var(--panel);
}

.latent-signal.warning {
  border-color: #e1bf73;
}

.latent-signal.critical {
  border-color: #df9999;
}

.latent-signal > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.latent-signal > div span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.latent-signal.warning > div span {
  color: #946716;
}

.latent-signal.critical > div span {
  color: #b22e2e;
}

.latent-signal p {
  margin: 7px 0 4px;
  line-height: 1.55;
}

.latent-signal small,
.latent-data-note,
.latent-no-signal {
  color: var(--muted);
}

.latent-data-note,
.latent-no-signal {
  margin: 12px 0;
}

.analysis-details {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.analysis-details summary {
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 700;
}

.analysis-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 16px;
}

.analysis-detail-grid h4 {
  margin: 0 0 10px;
}

.analysis-issue-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.analysis-issue-row small,
.analysis-trend-row small {
  color: var(--muted);
}

.analysis-trend-row {
  display: grid;
  grid-template-columns: 44px minmax(80px, 1fr) 80px;
  gap: 8px;
  align-items: center;
}

.analysis-trend-track {
  height: 8px;
  border-radius: 4px;
  background: #edf1f6;
  overflow: hidden;
}

.analysis-trend-track span {
  display: block;
  height: 100%;
  background: var(--brand);
}

.analysis-device-table {
  margin-top: 16px;
}

.analysis-device-table table {
  min-width: 520px;
}

.analysis-report footer {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

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

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

.group-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 90px auto auto;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.group-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.group-item input {
  width: 100%;
  min-width: 0;
}

.group-item > span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.danger-button {
  color: var(--bad);
}

#devices table {
  min-width: 900px;
}

#devices th:nth-child(1),
#devices td:nth-child(1) {
  min-width: 120px;
}

.device-management-table {
  min-width: 1040px;
  table-layout: fixed;
}

.device-management-table th:nth-child(1) {
  width: 11%;
}

.device-management-table th:nth-child(2) {
  width: 13%;
}

.device-management-table th:nth-child(3) {
  width: 9%;
}

.device-management-table th:nth-child(4) {
  width: 13%;
}

.device-management-table th:nth-child(5) {
  width: 6%;
}

.device-management-table th:nth-child(6) {
  width: 9%;
}

.device-management-table th:nth-child(7) {
  width: 19%;
}

.device-management-table th:nth-child(8) {
  width: 14%;
}

.device-management-table th:nth-child(9) {
  width: 6%;
}

#devices th,
#devices td {
  padding: 7px 10px;
}

#devices td {
  height: 48px;
  min-width: 0;
  overflow: hidden;
  line-height: 1.25;
  text-overflow: ellipsis;
  font-size: 13px;
}

#devices td:nth-child(1),
#devices td:nth-child(3),
#devices td:nth-child(5),
#devices td:nth-child(6) {
  white-space: nowrap;
}

.device-firmware {
  display: grid;
  gap: 2px;
}

.device-firmware strong,
.device-firmware small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-firmware small {
  color: var(--muted);
  font-size: 11px;
}

.device-table-wrap {
  max-height: calc(100vh - 250px);
  min-height: 320px;
}

.device-management-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
}

.device-management-table th:last-child,
.device-management-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 4;
  background: #ffffff;
  box-shadow: -8px 0 12px -12px rgba(18, 36, 65, 0.45);
  overflow: visible;
}

#devices .device-management-table td:last-child {
  overflow: visible;
}

#devices .device-actions {
  justify-content: flex-end;
  min-width: 0;
}

.device-management-table thead th:last-child {
  z-index: 7;
  background: #f7f9fc;
}

.device-management-table td:last-child:has(.device-action-menu[open]) {
  z-index: 30;
}

#devices .group-editor {
  grid-template-columns: minmax(120px, 1fr);
  min-width: 130px;
}

#devices .group-editor select {
  padding: 6px 8px;
}

.current-parameters {
  display: grid;
  gap: 2px;
  line-height: 1.25;
  white-space: nowrap;
}

.current-parameters span,
.current-parameters small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  font-size: 12px;
}

.device-record-summary {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  font-size: 12px;
}

.device-record-summary > strong {
  color: var(--ink);
}

.device-record-summary .record-pass {
  color: var(--ok);
}

.device-record-summary .record-fail {
  color: var(--bad);
}

.secondary-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--brand);
  cursor: pointer;
  white-space: nowrap;
}

.secondary-button:hover {
  border-color: var(--brand);
  background: #eaf3ff;
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  background: #f4f7fb;
}

.config-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.config-template-manager {
  margin: 14px 0 16px;
  border-block: 1px solid var(--line);
  padding: 14px 0;
}

.config-template-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.config-template-head h3,
.config-template-head small {
  display: block;
  margin: 0;
}

.config-template-head h3 {
  font-size: 15px;
}

.config-template-head small,
.config-template-head > span {
  color: var(--muted);
  font-size: 12px;
}

.config-template-head small {
  margin-top: 3px;
}

.config-template-head > span {
  flex: 0 0 auto;
  font-weight: 700;
}

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

.config-template-fields select,
.config-template-fields input {
  width: 100%;
  min-width: 0;
}

.config-ai-guidance {
  display: grid;
  gap: 5px;
  margin-top: 10px;
}

.config-ai-guidance > span {
  color: #344258;
  font-size: 12px;
  font-weight: 700;
}

.config-ai-guidance textarea {
  width: 100%;
  min-height: 58px;
  resize: vertical;
}

.config-ai-guidance small {
  color: #6e7b8d;
  font-size: 11px;
}

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

.config-template-actions .ai-button:not(:disabled) {
  border-color: #168a62;
  background: #ecf9f3;
  color: #116646;
}

.config-template-locked .config-template-fields input[readonly],
.config-template-locked .form-grid input[readonly] {
  border-color: #d6dde8;
  background: #edf1f6;
  color: #647084;
  cursor: not-allowed;
  box-shadow: none;
}

.config-template-locked .form-grid label {
  color: #697588;
}

.config-template-locked .form-grid input[name="password"] {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
  cursor: text;
}

.config-template-manager .message {
  min-height: 18px;
  margin-bottom: 0;
}

.config-ai-recommendation {
  margin-top: 10px;
  border: 1px solid #bfd4f0;
  border-left: 4px solid #2f77d0;
  border-radius: 6px;
  padding: 12px;
  background: #f5f9ff;
}

.config-ai-recommendation[hidden] {
  display: none;
}

.config-ai-recommendation.changed {
  border-color: #9fc5ed;
  border-left-color: #1677d2;
  background: #f3f8ff;
}

.config-ai-recommendation.loaded {
  border-color: #89c7ae;
  border-left-color: #168a62;
  background: #f2fbf7;
}

.config-ai-recommendation.unchanged {
  border-color: #b5d9c8;
  border-left-color: #25835e;
  background: #f3faf7;
}

.config-ai-recommendation.empty {
  border-color: #d5dde8;
  border-left-color: #8b98a9;
  background: #f7f9fc;
}

.config-ai-recommendation-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.config-ai-recommendation-head > div {
  display: grid;
  gap: 2px;
}

.config-ai-recommendation-head strong {
  font-size: 14px;
}

.config-ai-recommendation-head small {
  color: var(--muted);
  font-size: 11px;
}

.config-ai-recommendation-head > span {
  flex: 0 0 auto;
  border-radius: 12px;
  padding: 3px 8px;
  background: #e5eef9;
  color: #315c8d;
  font-size: 11px;
  font-weight: 700;
}

.config-ai-recommendation.loaded .config-ai-recommendation-head > span,
.config-ai-recommendation.unchanged .config-ai-recommendation-head > span {
  background: #dff2e9;
  color: #176b4a;
}

.config-ai-recommendation > p {
  margin: 9px 0 0;
  color: #47566a;
  font-size: 12px;
  line-height: 1.6;
}

.config-ai-manual-guidance {
  margin-top: 10px;
  border-left: 3px solid #6f54a8;
  padding: 8px 10px;
  background: #f7f4fb;
}

.config-ai-manual-guidance strong {
  color: #5b428c;
  font-size: 11px;
}

.config-ai-manual-guidance p {
  margin: 3px 0 0;
  color: #4f4563;
  font-size: 12px;
  line-height: 1.55;
}

.config-ai-parameter-empty {
  margin-top: 10px;
  border: 1px dashed #c4cfdd;
  padding: 10px;
  background: #fff;
  color: #687589;
  font-size: 12px;
  line-height: 1.6;
}

.config-ai-parameter-review {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #d8e4f1;
}

.config-ai-parameter-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.config-ai-parameter-title strong {
  font-size: 13px;
}

.config-ai-parameter-title small {
  color: #6d7b8e;
  font-size: 11px;
}

.config-ai-parameter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 9px;
  margin-top: 9px;
}

.config-ai-parameter-item {
  min-width: 0;
  border: 1px solid #d7e1ed;
  border-top: 3px solid #5b9b7d;
  border-radius: 5px;
  padding: 10px;
  background: #fff;
}

.config-ai-parameter-item.adjust {
  border-top-color: #d89a16;
  background: #fffdf7;
}

.config-ai-parameter-item.insufficient {
  border-top-color: #8794a5;
  background: #fafbfc;
}

.config-ai-parameter-item header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.config-ai-parameter-item header > div {
  display: grid;
  gap: 1px;
}

.config-ai-parameter-item header strong {
  font-size: 13px;
}

.config-ai-parameter-item header small {
  color: #7b8797;
  font-size: 10px;
}

.config-ai-parameter-item header > span {
  flex: 0 0 auto;
  border-radius: 10px;
  padding: 2px 7px;
  background: #e5f3ec;
  color: #236c4e;
  font-size: 10px;
  font-weight: 700;
}

.config-ai-parameter-item.adjust header > span {
  background: #fff0ca;
  color: #8b5b00;
}

.config-ai-parameter-item.insufficient header > span {
  background: #e9edf2;
  color: #596678;
}

.config-ai-parameter-values {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  border-block: 1px solid #e6ecf3;
  padding: 7px 0;
}

.config-ai-parameter-values span {
  display: grid;
  gap: 1px;
}

.config-ai-parameter-values small {
  color: #7a8797;
  font-size: 10px;
}

.config-ai-parameter-values b {
  color: #213047;
  font-size: 13px;
}

.config-ai-parameter-values span:last-child b {
  color: #126b4a;
}

.config-ai-parameter-values i {
  color: #8a96a5;
  font-style: normal;
}

.config-ai-detection-impact {
  margin-top: 7px;
  border-radius: 3px;
  padding: 4px 6px;
  background: #edf1f5;
  color: #5b687a;
  font-size: 10px;
  font-weight: 700;
}

.config-ai-detection-impact.enhanced {
  background: #e7f5ed;
  color: #176b49;
}

.config-ai-detection-impact.reduced {
  background: #fff0e4;
  color: #a04a0a;
}

.config-ai-parameter-item > p {
  margin: 8px 0 0;
  color: #3f4d61;
  font-size: 11px;
  line-height: 1.55;
}

.config-ai-parameter-item dl {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 5px;
  margin: 7px 0 0;
  font-size: 10px;
  line-height: 1.5;
}

.config-ai-parameter-item dt {
  color: #758296;
  font-weight: 700;
}

.config-ai-parameter-item dd {
  min-width: 0;
  margin: 0;
  color: #47566a;
}

.config-ai-parameter-evidence {
  margin-top: 7px;
  border-top: 1px dashed #d9e1eb;
  padding-top: 7px;
}

.config-ai-parameter-evidence > strong {
  color: #667489;
  font-size: 10px;
}

.config-ai-parameter-evidence ul {
  margin: 4px 0 0;
  padding-left: 16px;
  color: #536176;
  font-size: 10px;
  line-height: 1.5;
}

.config-ai-safety-note {
  margin: 9px 0 0;
  border-left: 3px solid #d89a16;
  padding: 7px 9px;
  background: #fff9e9;
  color: #73551b;
  font-size: 11px;
}

.config-ai-diff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.config-ai-diff-item {
  border: 1px solid #d8e4f2;
  border-radius: 5px;
  padding: 8px 10px;
  background: #fff;
}

.config-ai-diff-item > span {
  display: block;
  color: #5e6d81;
  font-size: 11px;
}

.config-ai-diff-item > span small {
  margin-left: 3px;
  color: #8a96a5;
}

.config-ai-diff-item > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 4px;
}

.config-ai-diff-item del {
  color: #7e8998;
  font-size: 13px;
}

.config-ai-diff-item b {
  color: #8b98a9;
  font-weight: 400;
}

.config-ai-diff-item strong {
  color: #0f6d4b;
  font-size: 15px;
}

.config-ai-recommendation .config-ai-step {
  padding-top: 8px;
  border-top: 1px solid #dce6f1;
  color: #315c8d;
  font-weight: 600;
}

.form-grid label.ai-suggested-field {
  color: #126b4a;
  font-weight: 700;
}

.form-grid label.ai-suggested-field input {
  border-color: #1a9368;
  background: #effaf5;
  color: #124e3b;
  box-shadow: 0 0 0 2px rgba(26, 147, 104, 0.12);
}

@media (max-width: 720px) {
  .config-ai-parameter-title {
    display: grid;
  }

  .config-ai-parameter-grid {
    grid-template-columns: 1fr;
  }
}

.config-default-note {
  margin: -2px 0 14px;
  padding: 9px 11px;
  border-left: 3px solid #2f77d0;
  background: #f3f8ff;
  color: #45617f;
  font-size: 12px;
}

.raw-query {
  margin-top: 0;
}

.raw-list {
  display: grid;
  gap: 6px;
}

.raw-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.raw-row {
  display: grid;
  grid-template-columns: 16px 92px 120px 120px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  cursor: pointer;
  list-style: none;
}

.raw-row::-webkit-details-marker {
  display: none;
}

.raw-row::before {
  content: "›";
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.raw-item[open] .raw-row::before {
  transform: rotate(90deg);
}

.raw-time,
.raw-device,
.raw-brief {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.raw-time {
  color: var(--muted);
}

.raw-device {
  color: var(--ink);
}

.raw-brief {
  color: var(--muted);
}

.raw-brief.alarm {
  color: var(--bad);
  font-weight: 700;
}

.raw-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.raw-head strong {
  display: block;
  margin-bottom: 4px;
}

.raw-head small,
.raw-summary {
  color: var(--muted);
}

.raw-interpretation {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  background: #fbfdff;
  border-bottom: 1px solid var(--line);
}

.raw-interpretation-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.raw-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.raw-field {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
}

.raw-field small {
  color: var(--muted);
}

.raw-field strong {
  color: var(--ink);
  font-size: 14px;
  word-break: break-word;
}

.raw-status-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.raw-type {
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef5ff;
  color: var(--brand-dark);
  font-size: 12px;
  white-space: nowrap;
  text-align: center;
}

.raw-details {
  background: #ffffff;
}

.raw-details summary {
  padding: 11px 14px;
  color: var(--brand);
  cursor: pointer;
  font-weight: 700;
}

.raw-json {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  padding: 12px 14px;
  background: #0f172a;
  color: #dbeafe;
  font-size: 12px;
  line-height: 1.55;
}

.curve-chart-wrap {
  position: relative;
}

.curve-chart {
  display: block;
  width: 100%;
  height: auto;
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.curve-legend {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  margin: 8px 0 10px;
}

.legend-item {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--curve-temperature);
}

.legend-dot.power {
  background: var(--curve-power);
}

.legend-dot.anomaly {
  background: var(--curve-anomaly);
}

.curve-line {
  fill: none;
  stroke: var(--curve-temperature);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.curve-line.power {
  stroke: var(--curve-power);
}

.curve-axis,
.curve-grid {
  stroke: #d7dfeb;
  stroke-width: 1;
}

.curve-grid {
  stroke-dasharray: 3 4;
}

.curve-grid-vertical {
  stroke: #e6ebf2;
}

.curve-tick {
  stroke: #9aa7b8;
  stroke-width: 1;
}

.curve-label {
  fill: var(--muted);
  font-size: 11px;
}

.curve-label-left {
  text-anchor: end;
}

.curve-time-label {
  font-size: 10px;
}

.curve-label.power {
  fill: var(--curve-power);
}

.curve-axis-title {
  fill: var(--curve-temperature);
  font-size: 12px;
  font-weight: 700;
}

.curve-axis-title.power {
  fill: var(--curve-power);
}

.curve-point {
  fill: #ffffff;
  stroke: var(--curve-temperature);
  stroke-width: 1.4;
}

.curve-point.power {
  stroke: var(--curve-power);
}

.curve-anomalies {
  pointer-events: none;
}

.curve-anomaly-line {
  stroke: rgba(124, 58, 237, 0.55);
  stroke-width: 1.2;
  stroke-dasharray: 4 4;
}

.curve-anomaly-point {
  fill: #ffffff;
  stroke: var(--curve-anomaly);
  stroke-width: 3;
}

.curve-hover {
  pointer-events: none;
  opacity: 0;
  transition: opacity 80ms ease;
}

.curve-hover.visible {
  opacity: 1;
}

.curve-crosshair {
  stroke: #64748b;
  stroke-width: 1;
  stroke-dasharray: 4 3;
}

.curve-hover-point {
  fill: #ffffff;
  stroke: var(--curve-temperature);
  stroke-width: 3;
}

.curve-hover-point.power {
  stroke: var(--curve-power);
}

.curve-hit-area {
  fill: transparent;
  cursor: crosshair;
  pointer-events: all;
}

.curve-tooltip {
  position: absolute;
  z-index: 2;
  display: grid;
  gap: 5px;
  min-width: 190px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 9px 11px;
  transform: translate(-50%, -100%);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.16);
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
}

.curve-tooltip strong {
  color: var(--ink);
}

.curve-tooltip span {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 6px;
  align-items: center;
}

.curve-tooltip .tooltip-secondary {
  grid-template-columns: 1fr auto;
  padding-left: 16px;
}

.curve-tooltip .tooltip-anomaly {
  grid-template-columns: 42px minmax(0, 1fr);
  border-top: 1px solid #f2c7c7;
  padding-top: 5px;
  color: var(--bad);
}

.curve-tooltip .tooltip-anomaly b {
  color: var(--bad);
}

.curve-tooltip b {
  color: var(--ink);
}

.tooltip-dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--curve-temperature);
}

.tooltip-dot.power {
  background: var(--curve-power);
}

.link-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  background: #ffffff;
  color: var(--brand);
  cursor: pointer;
}

.link-button:disabled {
  cursor: not-allowed;
  color: var(--muted);
  background: #f7f9fc;
}

.config-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 16px;
}

.user-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.45fr) minmax(0, 1fr);
  gap: 16px;
}

.user-stack {
  display: grid;
  gap: 16px;
  align-content: start;
}

.panel {
  padding: 18px;
}

.form-row,
.form-grid {
  display: grid;
  gap: 12px;
}

.form-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 12px;
}

#groupReadDeviceField {
  grid-column: 1 / -1;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid input,
.form-row select {
  min-width: 0;
  width: 100%;
}

.primary {
  margin-top: 16px;
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  background: var(--brand);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.primary:hover {
  background: var(--brand-dark);
}

.primary:disabled {
  cursor: not-allowed;
  background: #a9b4c4;
}

.message {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
}

.message.error {
  color: var(--bad);
}

.command-confirmed {
  color: var(--ok);
  font-weight: 700;
}

.form-title {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 14px;
}

.device-checkboxes {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
}

.check-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
}

.check-row input {
  min-width: 0;
  width: auto;
}

.user-list {
  display: grid;
  gap: 12px;
}

.user-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.user-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.user-head strong {
  display: block;
  margin-bottom: 4px;
}

.user-head small {
  color: var(--muted);
}

.user-edit {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compact-primary {
  margin-top: 0;
  padding-inline: 18px;
}

.user-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.user-summary > div {
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.user-summary > div:last-child {
  border-right: 0;
}

.user-summary span,
.user-summary strong {
  display: block;
}

.user-summary span {
  color: var(--muted);
  font-size: 12px;
}

.user-summary strong {
  margin-top: 4px;
  font-size: 22px;
}

.user-management-grid {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.user-directory {
  padding: 0;
  overflow: hidden;
}

.user-directory-head,
.user-panel-head,
.permission-title,
.permission-group-head,
.user-editor-actions,
.user-form-actions,
.admin-security summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.user-directory-head {
  padding: 16px 16px 10px;
}

.user-directory-head h2,
.user-panel-head h2 {
  margin: 0;
}

.user-directory-head p,
.user-panel-head p,
.user-editor-empty p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

#userDirectoryCount {
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef4fd;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.user-search {
  display: block;
  padding: 0 14px 12px;
}

.user-search span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.user-search input {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  background: #f8fafc;
}

.user-list {
  border-top: 1px solid var(--line);
}

.user-list-row {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.user-list-row:last-child {
  border-bottom: 0;
}

.user-list-row:hover {
  background: #f7faff;
}

.user-list-row.selected {
  background: #edf4ff;
}

.user-list-row.selected::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--brand);
  content: "";
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #dceaff;
  color: #0f4ea8;
  font-size: 15px;
  font-weight: 800;
}

.user-avatar.large {
  width: 48px;
  height: 48px;
  font-size: 19px;
}

.user-list-copy,
.user-list-copy strong,
.user-list-copy small {
  display: block;
  min-width: 0;
}

.user-list-copy strong,
.user-list-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-list-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.account-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--idle);
}

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

.user-list-empty,
.user-editor-empty {
  padding: 32px 18px;
  color: var(--muted);
  text-align: center;
}

.user-list-empty p {
  margin: 5px 0 0;
  font-size: 12px;
}

.user-detail-column {
  min-width: 0;
}

.user-editor,
.user-create-panel {
  min-height: 420px;
}

.user-panel-head {
  align-items: flex-start;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.panel-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
}

.user-identity-large {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-state {
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 700;
}

.account-state.active {
  background: #e7f7ef;
  color: #117a43;
}

.account-state.disabled {
  background: #eef1f5;
  color: var(--muted);
}

.user-access-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.user-access-overview span {
  padding: 11px 12px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.user-access-overview span:last-child {
  border-right: 0;
}

.user-access-overview strong {
  color: var(--ink);
  font-size: 17px;
}

.user-account-fields {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(280px, 1.3fr);
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

.user-account-fields input,
.user-account-fields select,
.user-credentials input,
.user-credentials select,
.admin-password-form input {
  width: 100%;
}

.role-access-note {
  padding: 11px 13px;
  border: 1px solid #bfd5f4;
  border-radius: 6px;
  background: #f2f7ff;
  color: #365b8d;
  font-size: 12px;
  line-height: 1.5;
}

.role-access-note[hidden] {
  display: none;
}

.permission-section {
  margin-top: 14px;
}

.permission-title {
  align-items: flex-end;
  margin-bottom: 10px;
}

.permission-title strong,
.permission-title small {
  display: block;
}

.permission-title small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.permission-title > span {
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.permission-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: 430px;
  overflow: auto;
  padding-right: 2px;
}

.permission-group {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.permission-group.full-access {
  border-color: #9bbcf0;
  background: #f4f8ff;
}

.permission-group-head {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.permission-group.full-access .permission-group-head {
  background: #e7f0ff;
}

.permission-group-head strong,
.permission-group-head small {
  display: block;
}

.permission-group-head small,
.ungrouped-label {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.group-access-toggle {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 6px;
  color: var(--brand);
  font-weight: 700;
  cursor: pointer;
}

.group-access-toggle input,
.permission-device input {
  width: auto;
  min-width: 0;
}

.permission-device-list {
  display: grid;
}

.permission-device {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border-bottom: 1px solid #edf0f5;
  color: var(--ink);
  cursor: pointer;
}

.permission-device:last-child {
  border-bottom: 0;
}

.permission-device:hover {
  background: #f8fafc;
}

.permission-device span,
.permission-device strong,
.permission-device small {
  display: block;
  min-width: 0;
}

.permission-device strong,
.permission-device small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.permission-device small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.permission-device em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
}

.permission-device:has(input:disabled) {
  cursor: default;
  opacity: 0.58;
}

.user-editor-actions,
.user-form-actions {
  justify-content: flex-start;
  margin-top: 16px;
}

.user-editor-actions .primary,
.user-form-actions .primary {
  margin-top: 0;
}

.user-form-actions .message {
  margin: 0;
}

.admin-security {
  margin-top: 16px;
  padding: 0;
}

.admin-security summary {
  padding: 15px 18px;
  cursor: pointer;
  list-style: none;
}

.admin-security summary::-webkit-details-marker {
  display: none;
}

.admin-security summary span,
.admin-security summary strong,
.admin-security summary small {
  display: block;
}

.admin-security summary small,
.admin-security summary > span:last-child {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.admin-password-form {
  max-width: 760px;
  padding: 0 18px 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.command-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.command {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.command.failed {
  border-left: 3px solid var(--bad);
}

.command.confirmed {
  border-left: 3px solid var(--good);
}

.command > summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 11px;
  cursor: pointer;
  list-style-position: inside;
}

.command > summary span:first-child {
  display: grid;
  gap: 3px;
}

.command > summary small,
.config-history-head small {
  color: var(--muted);
  font-size: 12px;
}

.command-result {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
}

.command-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 0 11px 9px;
  color: var(--muted);
  font-size: 12px;
}

.command > .raw-summary,
.command > .raw-details,
.command > .message {
  margin-right: 11px;
  margin-left: 11px;
}

.command > .raw-details:last-child {
  margin-bottom: 11px;
}

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

.config-history-head h2 {
  margin-bottom: 3px;
}

.config-history-head > span,
.config-history-pager {
  color: var(--muted);
  font-size: 12px;
}

.config-history-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 0.55fr);
  gap: 10px;
  margin-top: 14px;
}

.config-history-filters label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.config-history-filters select {
  width: 100%;
}

.config-history-pager {
  justify-content: center;
  margin-top: 14px;
}

.auto-config-panel {
  margin-top: 16px;
}

.auto-config-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.7fr) minmax(0, 1.3fr);
  gap: 20px;
}

.auto-config-form {
  display: grid;
  gap: 12px;
  align-content: start;
}

.auto-config-form > label:not(.check-row) {
  display: grid;
  gap: 6px;
}

.auto-config-list-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
}

.auto-config-list-head small {
  color: var(--muted);
  font-size: 12px;
}

.auto-config-plan-list {
  display: grid;
  gap: 10px;
}

.auto-config-plan {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.auto-config-plan.disabled {
  background: #f7f8fa;
}

.auto-config-plan-title,
.auto-config-plan-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.auto-config-plan-title > div {
  display: grid;
  gap: 3px;
}

.auto-config-plan-title small,
.auto-config-plan-meta {
  color: var(--muted);
  font-size: 12px;
}

.auto-config-plan-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  margin: 9px 0;
}

.auto-config-last-run {
  margin: 8px 0;
  border-left: 3px solid var(--line);
  padding: 7px 9px;
  background: #f8fafc;
  font-size: 12px;
}

.auto-config-last-run.confirmed,
.auto-config-last-run.simulated-sent {
  border-left-color: var(--good);
}

.auto-config-last-run.failed {
  border-left-color: var(--bad);
}

.auto-config-last-run.skipped {
  border-left-color: var(--warn);
}

.auto-config-plan-actions {
  justify-content: flex-start;
}

.help-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(140px, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
}

.help-search input {
  width: 100%;
}

.help-search-result {
  align-self: center;
  color: var(--muted);
  font-size: 13px;
}

.help-actions {
  display: flex;
  gap: 8px;
}

.help-layout {
  display: grid;
  grid-template-columns: 218px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.help-toc {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 3px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 14px;
}

.help-toc > strong {
  padding: 5px 8px 10px;
  color: var(--ink);
  font-size: 14px;
}

.help-toc button {
  border: 0;
  border-radius: 6px;
  padding: 8px;
  background: transparent;
  color: #445066;
  text-align: left;
  cursor: pointer;
}

.help-toc button:hover,
.help-toc button:focus-visible {
  background: #eaf2ff;
  color: var(--brand-dark);
}

.help-document {
  min-width: 0;
  max-width: 1040px;
  margin: 0 auto;
  color: #263248;
  line-height: 1.72;
}

.help-document code {
  border-radius: 4px;
  padding: 1px 5px;
  background: #edf2f8;
  color: #193b69;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em;
}

.help-cover {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 30px;
  background: var(--panel);
}

.help-cover h2 {
  margin: 7px 0 10px;
  color: #173a68;
  font-size: 30px;
}

.help-cover > p {
  max-width: 760px;
  color: var(--muted);
  font-size: 15px;
}

.help-kicker {
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

.help-role-grid,
.help-status-grid,
.help-checklist-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.help-role-grid {
  margin: 22px 0 16px;
}

.help-role-grid > div {
  border-left: 3px solid var(--brand);
  padding: 8px 12px;
  background: #f4f7fb;
}

.help-role-grid strong,
.help-role-grid span {
  display: block;
}

.help-role-grid span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.help-section {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 18px;
  scroll-margin-top: 20px;
  padding: 34px 4px;
  border-bottom: 1px solid var(--line);
}

.help-section-number {
  color: #9aa7ba;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.help-section h2 {
  margin-bottom: 8px;
  color: #173a68;
  font-size: 23px;
}

.help-section h3 {
  margin: 22px 0 8px;
  color: #254d80;
  font-size: 16px;
}

.help-section p,
.help-section li {
  font-size: 14px;
}

.help-section ul,
.help-steps {
  margin: 12px 0 18px;
  padding-left: 22px;
}

.help-section li + li {
  margin-top: 7px;
}

.help-admin-badge {
  display: inline-block;
  margin-left: 7px;
  border-radius: 999px;
  padding: 2px 8px;
  background: #e7effb;
  color: #225eaa;
  font-size: 11px;
  vertical-align: middle;
}

.help-note {
  margin: 16px 0;
  border-left: 3px solid var(--brand);
  padding: 11px 14px;
  background: #eef4fc;
  font-size: 13px;
}

.help-note-warning {
  border-left-color: #c49100;
  background: #fff7dc;
}

.help-note-danger {
  border-left-color: var(--bad);
  background: #fff0f0;
  color: #8d2424;
}

.help-figure {
  margin: 20px 0;
}

.help-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f9fc;
}

.help-figure figcaption {
  margin-top: 7px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.help-status-grid {
  margin: 16px 0;
}

.help-state {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 13px;
}

.help-state strong,
.help-state span {
  display: block;
}

.help-state span {
  margin-top: 3px;
  font-size: 12px;
}

.help-state-aging {
  border-color: #9bd4b0;
  background: #eaf8ef;
  color: #126c3d;
}

.help-state-idle {
  border-color: #a9c8ef;
  background: #edf4fd;
  color: #225d9f;
}

.help-state-paused {
  border-color: #e7c277;
  background: #fff6dd;
  color: #845000;
}

.help-state-failed {
  border-color: #efa2a2;
  background: #fff0f0;
  color: #a52727;
}

.help-state-offline {
  border-color: #c2c8d1;
  background: #eef0f3;
  color: #5d6673;
}

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

.help-table {
  width: 100%;
  margin: 16px 0;
  border-collapse: collapse;
  background: #ffffff;
  font-size: 13px;
}

.help-table th,
.help-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.help-table th {
  background: #eaf0f8;
  color: #27486f;
}

.help-status-table td:first-child,
.help-status-table td:nth-child(2) {
  white-space: nowrap;
}

.help-faq-list {
  border-top: 1px solid var(--line);
}

.help-faq-list details {
  border-bottom: 1px solid var(--line);
}

.help-faq-list summary {
  padding: 13px 4px;
  color: #264c7b;
  font-weight: 700;
  cursor: pointer;
}

.help-faq-list details p {
  margin: 0;
  padding: 0 4px 14px;
  color: var(--muted);
}

.help-checklist-grid > section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
}

.help-checklist-grid h3 {
  margin-top: 0;
}

.help-checklist-grid label {
  display: flex;
  grid-template-columns: none;
  gap: 9px;
  align-items: flex-start;
  padding: 6px 0;
  color: #35425a;
}

.help-checklist-grid input {
  min-width: 0;
  margin-top: 3px;
}

.help-updated {
  margin-top: 20px;
  color: var(--muted);
  text-align: right;
}

.help-no-results::after {
  display: block;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 42px 20px;
  background: #ffffff;
  color: var(--muted);
  text-align: center;
  content: "没有找到相关说明，请尝试更短的关键词";
}

@keyframes pulse {
  50% {
    box-shadow: 0 0 0 3px rgba(216, 52, 52, 0.16);
  }
}

@media (max-width: 900px) {
  .devices-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .devices-head-actions {
    justify-content: flex-start;
  }

  .device-search-field,
  .device-search-field input {
    width: 100%;
  }

  .device-pager,
  .record-pager {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 14px;
  }

  .nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .brand {
    margin-bottom: 12px;
  }

  .sidebar-icp {
    margin-top: 12px;
    padding-top: 8px;
  }

  .summary-grid,
  .config-layout,
  .auto-config-layout,
  .user-layout,
  .user-management-grid,
  .settings-layout,
  .dingtalk-layout,
  .analysis-admin,
  .analysis-detail-grid,
  .ai-report-grid,
  .form-row,
  .form-grid,
  .config-template-fields,
  .user-account-fields {
    grid-template-columns: 1fr;
  }

  .dingtalk-targets {
    grid-template-columns: 1fr;
  }

  .user-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-summary > div:nth-child(2) {
    border-right: 0;
  }

  .user-summary > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .permission-groups {
    grid-template-columns: 1fr;
  }

  .analysis-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .latent-comparison,
  .latent-product-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .latent-signals {
    grid-template-columns: 1fr;
  }

  .analysis-plan {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .analysis-plan-copy,
  .analysis-plan .analysis-plan-actions {
    grid-column: 1 / -1;
  }

  .analysis-plan .analysis-plan-actions {
    justify-content: flex-start;
  }

  .analysis-metric:nth-child(2) {
    border-right: 0;
  }

  .analysis-metric:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .analysis-scope-options {
    grid-template-columns: 1fr;
  }

  .ai-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ai-phase-list {
    grid-template-columns: 1fr;
  }

  .group-item {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .group-item > span {
    grid-column: 1 / -1;
    grid-row: 2;
    text-align: left;
  }

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

  .modal-dialog {
    width: calc(100vw - 20px);
    margin: 10px auto;
    max-height: calc(100vh - 20px);
    padding: 14px;
  }

  .device-claim-fields,
  .device-claim-summary {
    grid-template-columns: 1fr;
  }

  .device-claim-summary span {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .device-claim-summary span:last-child {
    border-bottom: 0;
  }

  .help-toolbar,
  .help-layout {
    grid-template-columns: 1fr;
  }

  .help-actions {
    flex-wrap: wrap;
  }

  .help-toc {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
    overflow: visible;
  }

  .help-toc > strong {
    grid-column: 1 / -1;
  }

  .help-cover {
    padding: 22px;
  }

  .help-cover h2 {
    font-size: 25px;
  }

  .help-role-grid,
  .help-status-grid,
  .help-checklist-grid {
    grid-template-columns: 1fr;
  }

  .help-section {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 28px 0;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .sidebar,
  .topbar,
  .help-toolbar,
  .help-toc {
    display: none !important;
  }

  .shell,
  .main,
  .help-layout {
    display: block;
  }

  .main {
    padding: 0;
    overflow: visible;
  }

  .view {
    display: none !important;
  }

  #help.view {
    display: block !important;
  }

  .help-document {
    max-width: none;
    color: #111827;
  }

  .help-cover,
  .help-checklist-grid > section {
    break-inside: avoid;
    box-shadow: none;
  }

  .help-section {
    break-before: auto;
  }

  .help-figure img {
    max-height: 620px;
    object-fit: contain;
  }
}

.ai-settings {
  margin-top: 18px;
}

.ai-settings-form {
  display: grid;
  gap: 14px;
  max-width: 900px;
}

.record-evaluation-panel {
  margin: 14px 0;
  padding: 16px;
  border: 1px solid #cfdced;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: #f8fbff;
}

.record-evaluation-head,
.record-ai-adjustment > div,
.ai-report-insight-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.record-evaluation-head span:first-child,
.ai-report-insight-head span {
  color: var(--muted);
  font-size: 12px;
}

.record-evaluation-head h3,
.ai-report-insight-head h4 {
  margin: 3px 0 0;
}

.record-learning-progress {
  margin: 10px 0 14px;
  color: #31547c;
  font-size: 13px;
}

.record-evaluation-form {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(220px, 0.8fr) minmax(300px, 1.5fr);
  gap: 12px;
  align-items: end;
}

.record-evaluation-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.record-evaluation-choice label {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid #d6dfeb;
  border-radius: 6px;
  background: #f8fafc;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

.record-evaluation-choice input[type="radio"] {
  width: 16px;
  height: 16px;
  min-width: 0;
  margin: 0;
  padding: 0;
}

.record-evaluation-option.normal:has(input:checked) {
  border-color: #57b87b;
  background: #eaf8ef;
  color: #18743b;
}

.record-evaluation-option.problem:has(input:checked) {
  border-color: #df6a6a;
  background: #fff0f0;
  color: #b42323;
}

.record-evaluation-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
}

.record-ai-adjustment {
  margin-top: 14px;
  padding: 13px;
  border: 1px solid #b9dfca;
  border-radius: 6px;
  background: #f0faf4;
}

.record-ai-adjustment p {
  margin: 8px 0;
}

.ai-report-insight {
  margin: 16px 0;
  padding: 16px;
  border: 1px solid #cfdced;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  background: #f8fbff;
}

.ai-report-insight.high,
.ai-report-insight.failed {
  border-left-color: var(--bad);
  background: #fff7f7;
}

.ai-report-insight.medium {
  border-left-color: var(--warn);
  background: #fffaf0;
}

.ai-report-insight.low {
  border-left-color: var(--ok);
  background: #f2fbf6;
}

.ai-report-insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.ai-report-insight-grid h5 {
  margin: 0 0 6px;
}

.ai-report-insight-grid ul {
  margin: 0;
  padding-left: 20px;
  color: #43516a;
}

@media (max-width: 960px) {
  .record-evaluation-form,
  .ai-report-insight-grid {
    grid-template-columns: 1fr;
  }
}
