:root {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #d8dde2;
  --primary: #007aff;
  --primary-dark: #0062cc;
  --success: #248a3d;
  --warning: #b26a00;
  --danger: #d70015;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", Arial, sans-serif;
  overflow-x: hidden;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  min-height: 68px;
  background: rgba(251, 251, 253, 0.86);
  backdrop-filter: blur(18px);
  color: var(--text);
  padding: 10px 18px;
  z-index: 30;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  flex: 0 0 auto;
  min-width: 196px;
}

.mark {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: contain;
  flex: 0 0 42px;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-toggle,
.mobile-menu-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.sidebar-toggle {
  display: none;
}

.mobile-menu-btn {
  display: none;
  flex: 0 0 auto;
  padding: 8px 12px;
}

.side-nav {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-width: 0;
  margin: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.nav-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.nav-group > span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.side-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 9px 10px;
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
}

.side-nav a.active,
.side-nav a:hover {
  color: var(--text);
  background: rgba(0, 122, 255, 0.12);
}

main {
  margin-left: 0;
  padding: 18px 22px 24px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  min-width: 0;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 25px;
}

.topbar p {
  margin-top: 6px;
  color: var(--muted);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  white-space: nowrap;
}

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

button.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

button.secondary:hover {
  background: #f3f6fb;
}

button.danger-btn {
  background: var(--danger);
}

button.danger-btn:hover {
  background: #8f1212;
}

.icon-button {
  width: 38px;
  min-width: 38px;
  min-height: 34px;
  padding: 0;
  border-radius: 6px;
  font-size: 17px;
  line-height: 1;
}

body[data-ui-mode="helper"] {
  --bg: #e9eef5;
  --panel: #f8fbff;
  --text: #10243d;
  --muted: #526579;
  --line: #aebdcb;
  --primary: #2d76c4;
  --primary-dark: #1f5f9f;
  --shadow: 0 1px 2px rgba(20, 45, 75, 0.12);
  background: #dfe7f0;
}

body[data-ui-mode="helper"] [data-qingmu-brand-icon="true"] {
  display: none;
}

body[data-ui-mode="helper"] .sidebar {
  min-height: 46px;
  padding: 5px 8px;
  gap: 8px;
  background: linear-gradient(#f9fcff, #d9e5f1);
  border-bottom: 1px solid #9fb2c5;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .75) inset;
}

body[data-ui-mode="helper"] .brand {
  min-width: 126px;
  gap: 6px;
}

body[data-ui-mode="helper"] .brand strong {
  font-size: 15px;
}

body[data-ui-mode="helper"] .brand span {
  margin-top: 1px;
  font-size: 11px;
}

body[data-ui-mode="helper"] .side-nav {
  justify-content: flex-start;
  gap: 4px;
}

body[data-ui-mode="helper"] .nav-group {
  gap: 2px;
  padding-right: 4px;
  border-right: 1px solid #bcc9d5;
}

body[data-ui-mode="helper"] .nav-group > span {
  padding: 0 4px;
  color: #526579;
}

body[data-ui-mode="helper"] .side-nav a {
  border: 1px solid #a9b8c7;
  border-radius: 4px;
  padding: 5px 8px;
  color: #163655;
  background: linear-gradient(#ffffff, #e1ebf5);
}

body[data-ui-mode="helper"] .side-nav a.active,
body[data-ui-mode="helper"] .side-nav a:hover {
  color: #ffffff;
  background: linear-gradient(#3f8bd5, #1f66ad);
}

body[data-ui-mode="helper"] main {
  padding: 8px;
}

body[data-ui-mode="helper"] .topbar {
  min-height: 42px;
  margin-bottom: 8px;
  padding: 5px 7px;
  border: 1px solid #a9b8c7;
  border-radius: 5px;
  background: linear-gradient(#ffffff, #e5edf6);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset;
}

body[data-ui-mode="helper"] .topbar h1 {
  font-size: 18px;
}

body[data-ui-mode="helper"] .topbar p {
  display: none;
}

body[data-ui-mode="helper"] .topbar-actions,
body[data-ui-mode="helper"] .automation-toolbar,
body[data-ui-mode="helper"] .task-control-actions,
body[data-ui-mode="helper"] .settings-actions,
body[data-ui-mode="helper"] .outcome-toolbar {
  gap: 5px;
  padding: 4px;
  border: 1px solid #b3c0cc;
  border-radius: 5px;
  background: #eef4fa;
}

body[data-ui-mode="helper"] .topbar-actions {
  flex: 1 1 auto;
  flex-wrap: nowrap;
  justify-content: flex-start;
  overflow-x: auto;
  max-width: min(980px, 74vw);
}

body[data-ui-mode="helper"] .main-toolbar-strip {
  min-height: 34px;
}

body[data-ui-mode="helper"] .topbar-actions .version-badge,
body[data-ui-mode="helper"] .topbar-actions .current-user {
  flex: 0 0 auto;
  max-width: 150px;
  height: 28px;
  padding: 5px 8px;
  border: 1px solid #b3c0cc;
  border-radius: 3px;
  background: #f8fbff;
  color: #42566b;
  font-size: 12px;
  line-height: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-ui-mode="helper"] .topbar-actions button,
body[data-ui-mode="helper"] .automation-toolbar button,
body[data-ui-mode="helper"] .task-control-actions button,
body[data-ui-mode="helper"] .settings-actions button,
body[data-ui-mode="helper"] .outcome-toolbar button {
  flex: 0 0 auto;
  min-width: 72px;
  height: 28px;
  min-height: 28px;
  padding: 4px 9px;
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
}

.qingmu-activation-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 2px solid #d97706;
  background: #fff7ed;
  color: #7c2d12;
  border-radius: 6px;
}

.qingmu-activation-panel strong {
  display: block;
}

.qingmu-activation-panel label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qingmu-activation-panel input {
  width: 260px;
}

.qingmu-activation-panel.activation-warning {
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.16);
}

body.activation-protected .qingmu-activation-panel {
  position: sticky;
  top: 8px;
  z-index: 20;
}

body[data-ui-mode="helper"] button {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #7fa1c3;
  border-radius: 4px;
  color: #ffffff;
  background: linear-gradient(#4b96dc, #236cad);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .55) inset;
}

body[data-ui-mode="helper"] button:hover {
  background: linear-gradient(#5aa6ec, #2877bd);
}

body[data-ui-mode="helper"] button.secondary,
body[data-ui-mode="helper"] .sidebar-toggle,
body[data-ui-mode="helper"] .mobile-menu-btn {
  color: #163655;
  background: linear-gradient(#ffffff, #dfe9f3);
  border-color: #9eb0c2;
}

body[data-ui-mode="helper"] button.secondary:hover {
  background: linear-gradient(#ffffff, #d2e2f1);
}

body[data-ui-mode="helper"] button.danger-btn {
  border-color: #b85f5f;
  background: linear-gradient(#e47b7b, #bb3737);
}

table thead th {
  position: relative;
}

.table-column-resizer {
  position: absolute;
  z-index: 3;
  top: 0;
  right: -3px;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
}

.table-column-resizer:hover,
.table-column-resizer:active {
  background: color-mix(in srgb, var(--accent, #2563eb) 28%, transparent);
}

body[data-ui-mode="helper"] .panel,
body[data-ui-mode="helper"] .metrics article {
  border-radius: 5px;
  box-shadow: var(--shadow);
}

body[data-ui-mode="helper"] .task-control-console {
  padding: 8px;
  background: #f2f6fb;
}

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

.metrics article,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.metrics article {
  padding: 16px;
}

.metrics span {
  color: var(--muted);
  font-size: 13px;
}

.metrics strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.compact-title h3 {
  margin: 0;
  font-size: 16px;
}

.task-control-console {
  margin: 12px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.outcome-toolbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr)) repeat(3, auto);
  gap: 8px;
  align-items: center;
  margin: 10px 0;
}

.outcome-toolbar input,
.outcome-toolbar select {
  width: 100%;
  min-width: 0;
}

.outcome-detail-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, .24);
}

.outcome-detail-grid {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 8px 12px;
}

.outcome-detail-grid dt { color: var(--muted); }
.outcome-detail-grid dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.outcome-detail-grid pre { white-space: pre-wrap; margin: 0; }

@media (max-width: 900px) {
  .outcome-toolbar { grid-template-columns: 1fr 1fr; }
  .outcome-toolbar button { width: 100%; }
  .outcome-detail-grid { grid-template-columns: 1fr; }
  .outcome-detail-grid dd { margin-bottom: 8px; }
}

.task-control-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
}

.task-control-grid label {
  display: grid;
  gap: 5px;
}

.task-control-grid span {
  color: var(--muted);
  font-size: 12px;
}

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

.task-control-actions button {
  min-height: 34px;
  padding: 7px 10px;
}

.task-control-result {
  min-height: 22px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

#taskConsoleMount .task-control-console,
#accountDataMount .task-control-console {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
  min-width: 0;
}

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

.object-card {
  display: grid;
  gap: 7px;
  min-height: 108px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text);
  text-decoration: none;
}

.object-card:hover {
  border-color: #9cc2ff;
  background: #f2f7ff;
}

.object-card.warning {
  border-color: #f3c78a;
  background: #fff8ed;
}

.object-card.danger {
  border-color: #fecaca;
  background: #fff1f2;
}

.object-card span,
.object-card em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.object-card strong {
  font-size: 24px;
}

.object-card b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  background: #e9f2ff;
  color: var(--primary-dark);
  font-size: 12px;
}

.dashboard-alert-list {
  display: grid;
  gap: 9px;
}

.dashboard-alert {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--text);
  text-decoration: none;
}

.dashboard-alert.warning {
  border-color: #f3c78a;
  background: #fff8ed;
}

.dashboard-alert.danger {
  border-color: #fecaca;
  background: #fff1f2;
  color: var(--danger);
}

.dashboard-alert.info {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.hierarchy-shell {
  display: grid;
  gap: 14px;
}

.hierarchy-tabs {
  display: flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.hierarchy-tabs button {
  min-height: 34px;
  padding: 7px 14px;
  border: 1px solid transparent;
  background: transparent;
  color: #344054;
}

.hierarchy-tabs button.active,
.hierarchy-tabs button:hover {
  border-color: #b9d3ff;
  background: #eef6ff;
  color: var(--primary-dark);
}

.hierarchy-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
}

.hierarchy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.hierarchy-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.hierarchy-card.active {
  border-color: #9cc2ff;
  background: #f5f9ff;
}

.hierarchy-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.hierarchy-card header > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 0 1 auto;
  max-width: 58%;
  gap: 6px;
}

.hierarchy-card strong,
.hierarchy-card span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.hierarchy-card header span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: normal;
  white-space: nowrap;
}

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

.hierarchy-metrics article {
  min-width: 0;
  padding: 9px;
  border-radius: 8px;
  background: #f8fafc;
}

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

.hierarchy-metrics strong {
  margin-top: 3px;
  font-size: 18px;
}

.hierarchy-actions,
.hierarchy-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.sort-toolbar button,
.hierarchy-table th button,
.automation-table th button {
  min-width: 86px;
  white-space: nowrap;
}

.hierarchy-actions button,
.hierarchy-toolbar button {
  min-height: 34px;
  padding: 6px 10px;
  white-space: nowrap;
}

.hierarchy-table {
  border-color: #e8edf5;
}

.hierarchy-table table {
  min-width: 900px;
}

.hierarchy-table th:first-child,
.hierarchy-table td:first-child {
  width: 52px;
  min-width: 52px;
  max-width: 52px;
  text-align: center;
  white-space: nowrap;
  overflow-wrap: normal;
}

.hierarchy-table td,
.automation-table td {
  line-height: 1.35;
}

.hierarchy-table td[data-label="账号"],
.automation-table td[data-label="账号"],
.hierarchy-table td[data-label="最新同步"],
.automation-table td[data-label="最新同步"],
.automation-table td[data-label="下一步"],
.automation-table td[data-label="任务"] {
  max-width: 180px;
}

.hierarchy-table th,
.hierarchy-table td {
  white-space: normal;
  overflow-wrap: anywhere;
}

.account-layer-summary,
.order-account-context,
.automation-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.account-layer-summary article,
.order-account-context article,
.automation-metrics article {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #e8edf5;
  border-radius: 8px;
  background: #f8fafc;
}

.account-layer-summary span,
.order-account-context span,
.automation-metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.account-layer-summary strong,
.order-account-context strong,
.automation-metrics strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.automation-dashboard {
  display: grid;
  gap: 14px;
}

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

.automation-device-groups {
  display: grid;
  gap: 14px;
}

.automation-device {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.automation-device.active {
  border-color: #9cc2ff;
  background: #f5f9ff;
}

.automation-device > header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.automation-device > header strong,
.automation-device > header span {
  display: block;
}

.automation-device > header span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.automation-device-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.local-refresh-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 7px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow-wrap: anywhere;
  background: #f8fafc;
  color: var(--muted);
}

.local-refresh-status.success {
  background: #ecfdf3;
  color: var(--success);
}

.local-refresh-status.warning {
  background: #fffbeb;
  color: var(--warning);
}

.local-refresh-status.danger {
  background: #fef2f2;
  color: var(--danger);
}

.action-status-group {
  display: inline-grid;
  grid-template-columns: minmax(0, max-content);
  gap: 3px;
  align-items: start;
  min-width: 0;
}

.action-status-group button {
  width: max-content;
  max-width: 100%;
}

.action-status-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  overflow-wrap: anywhere;
  white-space: nowrap;
}

.action-status-group .local-refresh-status {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-progress-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.task-progress-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.task-progress-pill.success {
  border-color: #bbf7d0;
  background: #ecfdf3;
  color: var(--success);
}

.task-progress-pill.warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: var(--warning);
}

.task-progress-pill.danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--danger);
}

.automation-table table {
  min-width: 1120px;
  font-size: 12px;
}

.automation-table th,
.automation-table td {
  padding: 8px 9px;
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: top;
}

.automation-table th.select-cell,
.automation-table td.select-cell {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  padding-left: 8px;
  padding-right: 8px;
  text-align: center;
  vertical-align: middle;
}

.automation-table .select-cell input[type="checkbox"] {
  display: inline-block;
  flex: 0 0 16px;
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  min-width: 16px;
  max-width: 16px;
  margin: 0;
}

.automation-table td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.account-overview-table table {
  width: 100%;
  min-width: 1360px;
  table-layout: fixed;
}

.account-mobile-sortbar {
  display: none;
}

.account-overview-table .account-col-select { width: 42px; }
.account-overview-table .account-col-username { width: 118px; }
.account-overview-table .account-col-country { width: 72px; }
.account-overview-table .account-col-status { width: 62px; }
.account-overview-table .account-col-vip { width: 66px; }
.account-overview-table .account-col-capacity { width: 58px; }
.account-overview-table .account-col-number { width: 64px; }
.account-overview-table .account-col-date { width: 112px; }
.account-overview-table .account-col-plan { width: 118px; }
.account-overview-table .account-col-readonly { width: 128px; }
.account-overview-table .account-col-freshness { width: 168px; }

.account-overview-table th,
.account-overview-table td {
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.account-overview-table td[data-label="账单日"],
.account-overview-table td[data-label="结算日"],
.account-overview-table td[data-label="首页更新"] {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.account-overview-table th button {
  min-width: 0;
  max-width: 100%;
  padding: 0;
  white-space: normal;
  text-align: left;
}

.account-overview-table .row-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  width: 100%;
}

.account-overview-table .row-actions button {
  width: 100%;
  min-width: 0;
  padding: 5px 4px;
  white-space: nowrap;
}

.account-overview-table .row-actions .local-refresh-status {
  grid-column: 1 / -1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary-dark);
  font-weight: 700;
  white-space: normal;
  text-align: left;
}

.link-button:hover {
  background: transparent;
  color: var(--primary);
  text-decoration: underline;
}

.table-footnote {
  color: var(--muted);
  font-size: 12px;
}

.order-pager {
  margin-top: -2px;
}

.cell-danger {
  color: var(--danger);
  font-weight: 700;
}

.panel {
  padding: 18px;
  margin-bottom: 16px;
  min-width: 0;
}

.source-panel {
  margin-bottom: 14px;
}

.retention-alert {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #f3c78a;
  border-radius: 8px;
  background: #fff8ed;
  color: #713f12;
}

.retention-alert span {
  flex: 1;
  min-width: 0;
}

.retention-alert a {
  color: var(--primary-dark);
  font-weight: 700;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.page-hidden {
  display: none !important;
}

.device-panel-hidden {
  display: none !important;
}

body.auth-locked .sidebar,
body.auth-locked main,
body.auth-locked #sidebarOverlay {
  display: none !important;
}

.login-view {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(245, 247, 251, 0.96);
}

.login-panel {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  margin: 0;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(20, 30, 55, 0.18);
}

.login-panel .mark {
  width: 46px;
  height: 46px;
}

.login-panel h1 {
  font-size: 22px;
}

.login-panel label {
  margin: 0;
}

.login-panel label span {
  display: block;
  margin-bottom: 7px;
}

.login-panel button {
  width: 100%;
}

#loginError {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
}

.current-user {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.version-badge {
  color: #405560;
  background: #eef5f4;
  border: 1px solid #cfe0dd;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.2;
  padding: 7px 9px;
  white-space: nowrap;
}

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

.settings-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 14px;
}

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

.settings-grid span {
  color: var(--muted);
  font-size: 13px;
}

.settings-grid input,
.settings-grid select,
.settings-grid textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fff;
}

.settings-grid textarea {
  resize: vertical;
  line-height: 1.45;
}

.access-settings-grid {
  grid-template-columns: 180px minmax(260px, 2fr) 140px 150px 150px;
}

.ops-config-title {
  margin-top: 18px;
}

.notification-settings-grid .wide-field {
  grid-column: span 2;
}

.notification-settings-grid .tall-field {
  grid-row: span 2;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
}

.action-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

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

.action-status.running {
  color: var(--warning);
}

.action-status.error {
  color: var(--danger);
}

.settings-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.settings-list strong {
  color: var(--text);
}

.settings-list span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  white-space: nowrap;
}

.compact-title {
  align-items: center;
  margin-top: 18px;
}

.compact-title h3 {
  margin: 0;
  font-size: 16px;
}

.agent-token-panel {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.agent-token-form {
  grid-template-columns: minmax(130px, 180px) minmax(180px, 1fr) minmax(120px, 160px) auto;
  align-items: end;
}

.form-action-cell {
  display: flex;
  align-items: end;
  height: 100%;
}

.form-action-cell button {
  min-height: 38px;
  white-space: nowrap;
}

.agent-token-created {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #f0fdf4;
}

.agent-token-created p {
  color: #166534;
  font-size: 13px;
}

.agent-token-created code {
  display: block;
  max-height: 130px;
  overflow: auto;
  padding: 10px;
  border-radius: 6px;
  background: #052e16;
  color: #dcfce7;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
}

.license-delivery-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.license-delivery-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.license-delivery-note {
  color: #9a3412;
  font-size: 13px;
}

@media (max-width: 760px) {
  .license-delivery-row {
    align-items: stretch;
    flex-direction: column;
  }
}

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

.token-command-actions span {
  color: #166534;
  font-size: 12px;
}

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

.direct-device-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.direct-device-summary article,
.direct-device-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.direct-device-summary article {
  padding: 12px;
}

.direct-device-summary span,
.direct-device-card span,
.direct-device-card p {
  color: var(--muted);
  font-size: 12px;
}

.direct-device-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.expand-onboarding-plan {
  margin-top: 12px;
}

.expand-plan-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(135deg, #f8fbff 0%, #eef8f4 100%);
}

.expand-plan-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.expand-plan-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.expand-plan-card header div,
.expand-plan-list article div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.expand-plan-card span,
.expand-plan-list em {
  color: var(--muted);
  font-size: 12px;
}

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

.expand-plan-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.expand-plan-list article.ready {
  border-color: #86efac;
}

.expand-plan-list article.refresh_needed {
  border-color: #fde68a;
}

.expand-plan-list article.blocked {
  border-color: #fecaca;
  opacity: 0.78;
}

.expand-plan-list article.data_ready {
  border-color: #22c55e;
}

.expand-plan-list article.agent_ready,
.expand-plan-list article.installing {
  border-color: #93c5fd;
}

.expand-plan-list article.awaiting_install {
  border-color: #fde68a;
}

.expand-plan-list article.repair_needed,
.expand-plan-list article.isolated {
  border-color: #fecaca;
}

.direct-device-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.direct-device-card {
  display: grid;
  gap: 9px;
  padding: 12px;
}

.direct-device-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.direct-device-card strong,
.direct-device-card span {
  display: block;
}

.direct-device-card em {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fef3c7;
  color: var(--warning);
  font-size: 12px;
  font-style: normal;
}

.direct-device-card.online {
  border-color: #bbf7d0;
  background: #f6fef9;
}

.direct-device-card.online em {
  background: #dcfce7;
  color: var(--success);
}

.direct-device-card.inactive {
  opacity: 0.78;
}

.direct-device-card.danger {
  border-color: #fecaca;
  background: #fff1f2;
}

.direct-device-card.danger em {
  background: #fee2e2;
  color: var(--danger);
}

.direct-diagnosis {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(217, 224, 234, 0.72);
}

.direct-diagnosis strong {
  font-size: 13px;
}

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

.direct-device-actions button {
  min-height: 34px;
  padding: 7px 10px;
}

.direct-device-actions a {
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.agent-token-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.agent-token-row > div {
  min-width: 0;
}

.onboarding-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 14px;
  align-items: end;
}

.discovery-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.discovery-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.discovery-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, max-content));
  gap: 8px;
  justify-content: start;
  align-items: center;
}

.discovery-actions button {
  min-height: 34px;
  padding: 7px 10px;
}

.discovery-head > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

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

.discovery-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}

.discovery-device {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.discovery-device label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.discovery-device input {
  width: 16px;
  height: 16px;
}

.discovery-device strong,
.discovery-device span,
.discovery-device em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.discovery-device span,
.discovery-device em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.discovery-device.online {
  border-color: rgba(22, 163, 74, .35);
  background: #f1fbf4;
}

.discovery-device.danger {
  border-color: rgba(220, 38, 38, .35);
  background: #fff5f5;
}

.onboarding-grid textarea {
  width: 100%;
  min-height: 116px;
  resize: vertical;
  font-family: inherit;
}

.onboarding-side {
  display: grid;
  gap: 10px;
}

.onboarding-result {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.onboarding-result article {
  display: grid;
  grid-template-columns: minmax(160px, 240px) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.onboarding-result article div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.onboarding-result article span {
  color: var(--muted);
  font-size: 12px;
}

.onboarding-result code {
  display: block;
  min-width: 0;
  max-height: 68px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  padding: 8px;
  border-radius: 6px;
  background: #eef3f8;
  color: #263241;
  font-size: 12px;
}

.danger-text {
  color: var(--danger);
}

.agent-token-row button {
  flex: 0 0 auto;
  min-width: 72px;
}

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

.agent-token-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.rules-grid {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.rules-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.compact-title {
  margin-bottom: 12px;
}

.compact-title h3 {
  margin: 0;
  font-size: 16px;
}

.rule-version-grid {
  grid-template-columns: minmax(220px, 360px);
}

.rule-binding-grid {
  grid-template-columns: minmax(150px, 1.1fr) minmax(220px, 1.6fr) minmax(110px, 0.8fr) minmax(120px, 0.8fr) minmax(120px, 0.8fr) minmax(110px, 0.7fr);
}

.rule-table-wrap {
  margin-top: 14px;
  overflow-x: auto;
}

.rule-detail-panel {
  margin-top: 14px;
}

.rule-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
}

.rule-detail-grid article {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.rule-detail-grid span {
  color: var(--muted);
  font-size: 12px;
}

.rule-device-picker {
  margin-top: 14px;
}

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

.rule-device-toolbar input[type="search"] {
  min-width: min(320px, 100%);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.inline-check {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.rule-device-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 8px;
  max-height: 280px;
  margin-top: 10px;
  padding: 8px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.rule-device-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.rule-device-option span,
.rule-device-option strong,
.rule-device-option em {
  min-width: 0;
}

.rule-device-option strong,
.rule-device-option em {
  display: block;
  overflow-wrap: anywhere;
}

.rule-device-option em {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.settings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.settings-table th,
.settings-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.settings-table th {
  color: var(--muted);
  font-weight: 600;
  background: #f8fafc;
}

.settings-table tr.selected-row td {
  background: #eef6ff;
}

.settings-table code {
  font-size: 12px;
  overflow-wrap: anywhere;
}

.small-button {
  padding: 6px 9px;
  min-height: 30px;
}

.empty-state {
  padding: 12px 0;
  color: var(--muted);
}

.device-operation-shell {
  padding-bottom: 12px;
}

.device-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.device-tabs button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid transparent;
  background: transparent;
  color: #344054;
}

.device-tabs button:hover {
  border-color: #b9d3ff;
  background: #eef6ff;
}

.device-tabs button.active {
  border-color: #9cc2ff;
  background: #1f6feb;
  color: #fff;
}

.batch-panel {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.batch-fields {
  display: grid;
  grid-template-columns: 170px 170px 170px minmax(220px, 1fr) 120px;
  gap: 12px;
  align-items: end;
}

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

.batch-preview {
  display: grid;
  gap: 8px;
}

.batch-preview-card {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.batch-preview-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.batch-target-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.batch-target-list span {
  display: inline-flex;
  max-width: 100%;
  padding: 5px 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: #344054;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.workbench-alerts {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.workbench-alert {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #f3c78a;
  border-radius: 8px;
  background: #fff8ed;
  color: #713f12;
  font-size: 13px;
}

.workbench-alert.danger {
  border-color: #fecaca;
  background: #fff1f2;
  color: var(--danger);
}

.workbench-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(220px, 1fr) 160px auto;
  gap: 12px;
  margin-bottom: 14px;
  align-items: center;
}

.workbench-device-select {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  min-width: 0;
}

.quick-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.quick-suggestions button {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  text-align: left;
}

.quick-suggestions button:hover {
  background: #eef6ff;
}

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

.device-picker {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

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

.device-picker-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.device-picker-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}

.device-picker-actions label,
.compact-pager label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.device-picker-actions label > span,
.compact-pager label > span,
.compact-pager .pager-control {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  white-space: nowrap;
}

.compact-pager .pager-control {
  min-width: max-content;
}

.device-picker-actions select,
.compact-pager select,
.compact-pager input {
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
}

.compact-pager input[type="number"] {
  width: 76px;
}

.compact-pager select {
  width: auto;
  min-width: 68px;
}

.device-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.device-picker-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.device-picker-card.active {
  border-color: #9cc2ff;
  background: #eef6ff;
}

.device-picker-card label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.device-picker-card span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.workbench-layout {
  display: grid;
  grid-template-columns: minmax(210px, 0.72fr) minmax(360px, 1.25fr) minmax(300px, 1fr);
  gap: 14px;
  min-width: 0;
}

.workbench-devices,
.workbench-accounts,
.workbench-detail {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.workbench-devices,
.workbench-detail {
  max-height: 680px;
  overflow: auto;
}

.workbench-device,
.workbench-account {
  width: 100%;
  display: grid;
  gap: 6px;
  padding: 11px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.workbench-device:hover,
.workbench-account:hover,
.workbench-device.active,
.workbench-account.active {
  background: #eef6ff;
}

.workbench-device strong,
.workbench-account strong {
  overflow-wrap: anywhere;
}

.workbench-device span,
.workbench-account span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.mini-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.mini-metrics i {
  display: inline-flex;
  padding: 3px 6px;
  border-radius: 999px;
  background: #e8eef8;
  color: #344054;
  font-style: normal;
  font-size: 12px;
}

.mini-metrics i.warn {
  background: #fef3c7;
  color: var(--warning);
}

.mini-metrics i.danger {
  background: #fee2e2;
  color: var(--danger);
}

.mini-metrics i.muted {
  background: #f1f5f9;
  color: var(--muted);
}

.muted-text {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.device-diagnostic-text {
  color: var(--warning) !important;
}

.device-diagnostics {
  display: grid;
  gap: 5px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #f3c78a;
  border-radius: 8px;
  background: #fff8ed;
  color: #713f12;
  font-size: 12px;
}

.device-diagnostics strong,
.device-diagnostics span {
  overflow-wrap: anywhere;
}

/* Qingmu V4 product UI polish: Apple-like workbench surface. */
.object-card,
.hierarchy-card,
.direct-device-card,
.expand-plan-card,
.security-card,
.batch-preview-card,
.device-picker-card,
.order-account-card,
.device-card,
.task-control-console,
.settings-list,
.table-wrap,
.ghost-table,
.compact-table,
.device-diagnostics {
  border-radius: 14px;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.045);
}

.object-card,
.hierarchy-card,
.direct-device-card,
.security-card,
.batch-preview-card,
.device-picker-card,
.order-account-card,
.device-card,
.ghost-table,
.compact-table,
.table-wrap {
  background: rgba(255, 255, 255, 0.92);
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th {
  background: #fbfbfd;
  color: var(--muted);
  font-weight: 650;
}

th,
td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

tbody tr:hover td {
  background: rgba(0, 122, 255, 0.055);
}

.status-tag,
.mini-metrics i {
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.device-diagnostics {
  background: #fff9f0;
  color: #6b4a00;
}

.device-diagnostic-text {
  color: #8a6500 !important;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.compact-pager {
  padding: 8px 0 0;
  border-top: 0;
}

.pager > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 0 0 auto;
  justify-content: flex-end;
  align-items: center;
  min-width: 0;
}

.pager button {
  min-height: 32px;
  padding: 6px 10px;
}

.pager button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.subsection-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.subsection-title span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

#workbenchAccounts {
  max-height: 624px;
  overflow: auto;
}

.workbench-detail {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 12px;
}

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

.detail-block h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.detail-kv {
  display: grid;
  grid-template-columns: minmax(90px, auto) minmax(0, 1fr);
  gap: 7px 10px;
  margin: 0;
  font-size: 13px;
}

.detail-kv dt {
  color: var(--muted);
}

.detail-kv dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.order-window-empty {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcff;
  color: var(--muted);
  font-size: 12px;
}

.order-window-empty strong {
  color: var(--text);
  font-size: 13px;
}

.order-window-table {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.order-window-table-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.order-window-table-head span {
  color: var(--muted);
  font-size: 12px;
}

.compact-table table {
  min-width: 420px;
  font-size: 12px;
}

.compact-table th,
.compact-table td {
  max-width: 160px;
  padding: 7px 8px;
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: top;
}

.account-order-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.account-order-title {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-width: 0;
}

.account-order-title > span {
  display: grid;
  place-items: center;
  height: 28px;
  border-radius: 6px;
  background: #eef4ff;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 700;
}

.account-order-title strong,
.account-order-title em {
  display: block;
  min-width: 0;
}

.account-order-title em {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  overflow-wrap: anywhere;
}

.account-order-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.account-order-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px;
}

.account-order-metrics article {
  min-width: 0;
  padding: 9px 10px;
  border-radius: 8px;
  background: #f8fafc;
}

.account-order-metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.account-order-metrics strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.structured-order-section {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.structured-order-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.structured-order-title strong {
  font-size: 14px;
}

.structured-order-title span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.ghost-table {
  border-color: #e8edf5;
  background: #fff;
}

.ghost-table table {
  min-width: 900px;
  font-size: 12px;
}

.ghost-table th,
.ghost-table td {
  padding: 8px 10px;
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: top;
}

.ghost-table th {
  background: #f8fafc;
}

.order-sort-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: auto;
  max-width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1.25;
  text-align: inherit;
  white-space: nowrap;
  box-shadow: none;
}

.order-sort-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-sort-button b {
  flex: 0 0 auto;
  min-width: 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

.order-sort-button.active {
  color: var(--primary);
}

.order-sort-button.active b {
  color: var(--primary);
}

.ranked-order-table td:nth-child(1),
.ranked-order-table td:nth-child(2),
.ranked-order-table th:nth-child(1),
.ranked-order-table th:nth-child(2) {
  width: 44px;
  text-align: center;
}

.ranked-order-table td:nth-child(3),
.ranked-order-table th:nth-child(3),
.accepted-order-table td:nth-child(1),
.accepted-order-table th:nth-child(1) {
  min-width: 154px;
  max-width: 180px;
}

.ranked-order-table td:nth-child(4),
.ranked-order-table th:nth-child(4),
.accepted-order-table td:nth-child(2),
.accepted-order-table th:nth-child(2) {
  max-width: 160px;
}

.accepted-order-table td:nth-child(1),
.ranked-order-table td:nth-child(3) {
  font-family: "Segoe UI", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}

.cell-ok {
  color: var(--success);
  font-weight: 700;
}

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

.cell-warn {
  color: var(--warning);
  font-weight: 700;
}

.order-action-cell {
  display: grid;
  grid-template-columns: minmax(112px, max-content) minmax(0, 1fr);
  gap: 6px 8px;
  align-items: center;
  min-width: 0;
}

.order-action-cell button {
  width: max-content;
  min-width: 112px;
  min-height: 34px;
  padding: 7px 11px;
}

.order-action-cell > span:not(.local-refresh-status) {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.order-action-cell .local-refresh-status {
  grid-column: 1 / -1;
  width: fit-content;
  max-width: 100%;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-actions button {
  padding: 8px 10px;
  font-size: 13px;
}

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

.status-strip article {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.status-strip span,
.status-strip strong {
  display: block;
}

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

.status-strip strong {
  margin-top: 5px;
}

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

.security-metrics article,
.security-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.security-metrics article {
  padding: 13px;
}

.security-metrics span,
.security-metrics strong {
  display: block;
}

.security-metrics span {
  color: var(--muted);
  font-size: 13px;
}

.security-metrics strong {
  margin-top: 7px;
  font-size: 22px;
}

.security-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
  min-width: 0;
}

.security-card {
  min-width: 0;
  overflow: hidden;
}

.security-user-form {
  grid-template-columns: minmax(130px, 1fr) minmax(130px, 1fr) minmax(120px, 160px) minmax(150px, 1fr) auto;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.security-list {
  display: grid;
  gap: 9px;
  max-height: 460px;
  overflow: auto;
  padding: 12px;
}

.permission-matrix {
  overflow-x: auto;
  padding: 12px;
}

.permission-matrix table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 12px;
}

.permission-matrix th,
.permission-matrix td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}

.activation-license-toolbar {
  display: flex;
  gap: 8px;
  padding: 12px 12px 0;
}

.activation-license-toolbar input {
  min-width: 0;
  flex: 1;
}

.security-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.security-row.warning {
  border-color: #f3c78a;
  background: #fff8ed;
}

.security-row.danger {
  border-color: #fecaca;
  background: #fff1f2;
}

.security-row > div {
  min-width: 0;
}

.security-row strong,
.security-row span {
  display: block;
}

.security-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.security-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.cleanup-preview {
  margin-top: 14px;
}

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

.cleanup-grid article,
.cleanup-result,
.cleanup-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.cleanup-grid strong,
.cleanup-result strong,
.cleanup-note strong {
  display: block;
  margin-bottom: 8px;
}

.cleanup-grid p,
.cleanup-result p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.cleanup-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.cleanup-note span {
  border-radius: 999px;
  background: #e8f1ff;
  color: #174ea6;
  padding: 5px 9px;
  font-size: 12px;
}

.connection-strip article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.connection-strip span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.connection-strip strong {
  display: block;
  font-size: 15px;
  line-height: 1.45;
}

.live-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text);
}

.inline-check input {
  width: 16px;
  height: 16px;
  padding: 0;
}

.ops-details {
  margin-top: 12px;
}

.ops-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
}

.ops-details[open] summary {
  margin-bottom: 12px;
}

.source-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 14px;
}

textarea {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  font: 12px/1.45 Consolas, "Microsoft YaHei", monospace;
  color: #172033;
  background: #fbfcff;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.evidence {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.evidence p {
  color: var(--muted);
  line-height: 1.6;
}

.evidence code {
  display: block;
  padding: 10px;
  overflow-wrap: anywhere;
  border-radius: 6px;
  background: #111827;
  color: #dbeafe;
  font-size: 12px;
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  border-radius: 4px;
  accent-color: var(--primary);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  min-width: 0;
}

#accountOrders,
#orders {
  grid-column: 1 / -1;
}

.grid > *,
.metrics > *,
.controls > *,
.source-grid > *,
.connection-strip > * {
  min-width: 0;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title h2 {
  font-size: 17px;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  max-width: 100%;
}

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

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f1f4f9;
  color: #475467;
  font-weight: 600;
}

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

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef2ff;
  color: #3730a3;
}

.tag.success {
  background: #dcfce7;
  color: var(--success);
}

.tag.warning {
  background: #fef3c7;
  color: var(--warning);
}

.tag.danger {
  background: #fee2e2;
  color: var(--danger);
}

.cards {
  display: grid;
  gap: 10px;
}

.device-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.device-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcff;
}

.device-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.device-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 10px;
  margin: 0;
  font-size: 13px;
}

.device-card dt {
  color: var(--muted);
}

.device-card dd {
  margin: 0;
  text-align: right;
}

.order-account-cards {
  display: grid;
  gap: 12px;
  max-height: none;
  overflow: visible;
}

.order-account-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.order-account-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.order-account-card header span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.order-account-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 10px;
  margin: 0;
  font-size: 13px;
}

.order-account-card dt {
  color: var(--muted);
}

.order-account-card dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

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

.slot-list span {
  padding: 6px 8px;
  border-radius: 6px;
  background: #ecfdf3;
  color: #166534;
  font-size: 12px;
}

.order-log,
.empty-state {
  padding: 10px;
  border-radius: 6px;
  background: #f8fafc;
  color: #475467;
  font-size: 13px;
  line-height: 1.5;
}

.assignment {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcff;
}

.assignment header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.assignment strong {
  font-size: 15px;
}

.assignment ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.assignment li {
  padding: 8px 10px;
  border-radius: 6px;
  background: #eef6ff;
  color: #164e8b;
}

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

.list div {
  padding: 10px;
  border-radius: 6px;
  background: #fff7ed;
  color: #9a3412;
}

.queue-item {
  display: grid;
  gap: 8px;
  background: #f8fafc !important;
  color: var(--text) !important;
  border: 1px solid var(--line);
}

.queue-item header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.queue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.queue-actions button {
  padding: 8px 12px;
  font-size: 13px;
}

.audit-log {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.audit-log div {
  padding: 10px;
  border-left: 4px solid var(--primary);
  border-radius: 6px;
  background: #f8fafc;
  color: #344054;
  font-size: 13px;
  line-height: 1.5;
}

.audit-item {
  display: grid;
  gap: 6px;
}

.audit-item strong,
.audit-item span {
  overflow-wrap: anywhere;
}

.audit-item code {
  display: block;
  max-height: 96px;
  overflow: auto;
  padding: 8px;
  border-radius: 6px;
  background: #111827;
  color: #dbeafe;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
}

.risk-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.risk-list span {
  padding: 9px 10px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fff1f2;
  color: var(--danger);
}

@media (max-width: 900px) {
  .sidebar {
    display: flex;
    justify-content: space-between;
    min-height: 62px;
    padding: 10px 12px;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: none;
    background: rgba(15, 23, 42, 0.45);
  }

  body.mobile-menu-open .sidebar-overlay {
    display: block;
  }

  .brand {
    min-width: 0;
  }

  .brand .mark {
    width: 38px;
    height: 38px;
  }

  .brand strong {
    font-size: 15px;
  }

  .brand span {
    display: none;
  }

  .side-nav {
    position: absolute;
    top: calc(100% + 8px);
    left: 12px;
    right: 12px;
    z-index: 35;
    display: none;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 12px;
    max-height: min(70vh, 520px);
    overflow: auto;
    padding: 12px;
    border-radius: 10px;
    background: #111827;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.32);
  }

  body.mobile-menu-open .side-nav {
    display: grid;
  }

  .nav-group {
    display: grid;
    gap: 7px;
  }

  .nav-group > span {
    padding: 0 2px;
  }

  .side-nav a {
    padding: 11px 12px;
  }

  main {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    padding: 12px;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .sidebar-toggle {
    display: none;
  }

  h1 {
    font-size: 20px;
  }

  .topbar {
    align-items: flex-start;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .topbar-actions {
    grid-column: 1 / -1;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    justify-content: stretch;
    gap: 10px;
  }

  .topbar-actions .version-badge,
  .topbar-actions .current-user {
    grid-column: 1 / -1;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .topbar-actions button {
    min-width: 0;
    width: 100%;
    padding-inline: 10px;
    white-space: normal;
  }

  .panel {
    padding: 14px;
  }

  .topbar,
  .grid,
  .dashboard-grid,
  .security-layout,
  .controls,
  .source-grid,
  .connection-strip,
  .settings-grid,
  .cleanup-grid,
  .metrics,
  .workbench-toolbar,
  .workbench-layout,
  .status-strip {
    grid-template-columns: 1fr;
    display: grid;
    gap: 12px;
  }

  .security-metrics,
  .security-user-form,
  .direct-device-summary,
  .expand-plan-list,
  .direct-device-list {
    grid-template-columns: 1fr;
  }

  .expand-plan-card header,
  .expand-plan-list article {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .expand-plan-actions {
    justify-content: stretch;
  }

  .expand-plan-actions button {
    flex: 1 1 150px;
  }

  .discovery-head {
    align-items: stretch;
  }

  .discovery-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    justify-content: stretch;
  }

  .discovery-list {
    grid-template-columns: 1fr;
    max-height: 360px;
  }

  .workbench-device-select,
  .device-picker-head,
  .device-picker-actions,
  .device-picker-grid {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .compact-pager {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 6px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .compact-pager > div {
    display: flex;
    flex-wrap: nowrap;
    flex: 0 0 auto;
    gap: 6px;
    justify-content: flex-start;
    max-width: 100%;
    min-width: 0;
  }

  .compact-pager .pager-control {
    min-width: max-content;
    max-width: none;
    flex: 0 0 auto;
    justify-content: flex-start;
  }

  .device-picker-actions button,
  .discovery-actions button {
    width: 100%;
  }

  .compact-pager button,
  .compact-pager select,
  .compact-pager input {
    min-width: 0;
    min-height: 28px;
    font-size: 12px;
  }

  .compact-pager button {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    padding: 4px 8px;
  }

  .compact-pager select {
    width: auto;
    min-width: 68px;
  }

  .compact-pager input {
    width: 58px;
  }

  .onboarding-grid,
  .onboarding-result article {
    grid-template-columns: 1fr;
  }

  .security-row,
  .security-actions {
    display: grid;
    align-items: stretch;
  }

  .object-cards {
    grid-template-columns: 1fr;
  }

  .device-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding: 6px;
    scrollbar-width: thin;
  }

  .device-tabs button {
    min-width: max-content;
  }

  .workbench-devices,
  .workbench-detail,
  #workbenchAccounts {
    max-height: none;
  }

  .batch-fields,
  .batch-actions {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .subsection-title,
  .workbench-alert {
    display: grid;
  }

  .detail-kv {
    grid-template-columns: minmax(82px, auto) minmax(0, 1fr);
  }

  .detail-kv dd {
    text-align: left;
  }

  .retention-alert {
    display: grid;
  }

  .metrics strong {
    font-size: 24px;
  }

  .section-title {
    align-items: flex-start;
    display: grid;
  }

  .section-title span {
    text-align: left;
  }

  .agent-token-row {
    align-items: stretch;
    display: grid;
  }

  .agent-token-row button {
    width: 100%;
  }

  table {
    min-width: 720px;
  }

  .hierarchy-table,
  .ghost-table,
  .automation-table {
    overflow: hidden;
    border: 0;
    background: transparent;
  }

  .hierarchy-table table,
  .ghost-table table,
  .automation-table table {
    min-width: 0 !important;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
  }

  .account-overview-table table {
    table-layout: auto;
  }

  .account-overview-table colgroup {
    display: none;
  }

  .account-mobile-sortbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }

  .account-mobile-sortbar label {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }

  .account-mobile-sortbar select {
    flex: 1 1 auto;
    min-width: 0;
  }

  .account-mobile-sortbar button {
    flex: 0 0 40px;
    width: 40px;
    padding: 6px;
  }

  .account-overview-table .row-actions {
    grid-template-columns: repeat(3, minmax(58px, max-content));
    justify-content: start;
    width: auto;
  }

  .hierarchy-table thead,
  .ghost-table thead,
  .automation-table thead,
  .settings-table thead {
    display: none;
  }

  .settings-table {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .hierarchy-table tbody,
  .hierarchy-table tr,
  .hierarchy-table td,
  .ghost-table tbody,
  .ghost-table tr,
  .ghost-table td,
  .automation-table tbody,
  .automation-table tr,
  .automation-table td,
  .settings-table tbody,
  .settings-table tr,
  .settings-table td {
    display: block;
    width: 100%;
  }

  .hierarchy-table tr,
  .ghost-table tr,
  .automation-table tr,
  .settings-table tr {
    display: grid;
    gap: 2px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 6px 16px rgba(20, 30, 55, 0.05);
  }

  .hierarchy-table td,
  .ghost-table td,
  .automation-table td,
  .settings-table td {
    display: grid;
    grid-template-columns: minmax(76px, 30%) minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    min-width: 0;
    padding: 7px 0;
    border: 0;
    text-align: left !important;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .hierarchy-table td::before,
  .ghost-table td::before,
  .automation-table td::before,
  .settings-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
  }

  .hierarchy-table td:first-child,
  .ghost-table td:first-child,
  .automation-table td:first-child,
  .settings-table td:first-child {
    grid-template-columns: 1fr;
    padding-bottom: 9px;
    border-bottom: 1px solid #edf1f7;
    font-weight: 700;
  }

  .hierarchy-table td:first-child::before,
  .ghost-table td:first-child::before,
  .automation-table td:first-child::before,
  .settings-table td:first-child::before {
    font-weight: 400;
  }

  .settings-table td[data-label="操作"] {
    grid-template-columns: minmax(76px, 30%) minmax(0, 1fr);
  }

  .settings-table td[data-label="操作"] button {
    width: auto;
    max-width: 100%;
    margin: 0 6px 6px 0;
    white-space: normal;
  }

  .rule-detail-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .automation-table td.select-cell {
    display: flex;
    width: auto;
    min-width: 0;
    max-width: none;
    justify-content: flex-start;
    align-items: center;
    gap: 6px;
    padding: 5px 0 6px;
    border-bottom: 0;
    font-weight: 400;
  }

  .automation-table td.select-cell::before {
    flex: 0 0 auto;
  }

  .automation-table td.select-cell input[type="checkbox"] {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    min-width: 16px;
    max-width: 16px;
  }

  .hierarchy-table td button,
  .ghost-table td button,
  .automation-table td button {
    width: auto;
    max-width: 100%;
    min-width: 0;
    padding: 5px 9px;
    white-space: nowrap;
  }

  .hierarchy-content,
  .account-layer-summary,
  .order-account-context,
  .automation-metrics,
  .account-order-metrics,
  .structured-order-section,
  .structured-order-title,
  .account-order-panel,
  .account-order-head,
  .account-order-title,
  .automation-dashboard,
  .automation-device-groups,
  .automation-device,
  .automation-device > header {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .account-layer-summary,
  .order-account-context,
  .automation-metrics,
  .account-order-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .account-layer-summary article,
  .order-account-context article,
  .automation-metrics article,
  .account-order-metrics article {
    min-width: 0;
    padding: 7px 8px;
  }

  .account-layer-summary span,
  .order-account-context span,
  .automation-metrics span,
  .account-order-metrics span {
    font-size: 11px;
  }

  .account-layer-summary strong,
  .order-account-context strong,
  .automation-metrics strong,
  .account-order-metrics strong {
    margin-top: 2px;
    font-size: 13px;
    line-height: 1.25;
  }

  .structured-order-title {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .structured-order-title span {
    text-align: left;
    overflow-wrap: anywhere;
  }

  .ghost-table td[data-label="操作"] {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .ghost-table td[data-label="操作"]::before {
    font-weight: 700;
  }

  .ghost-table td[data-label="操作"] .order-action-cell {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    padding-top: 2px;
  }

  .ghost-table td[data-label="操作"] .order-action-cell button {
    width: auto;
    min-width: 0;
  }

  .ghost-table td[data-label="操作"] .order-action-cell > span:not(.local-refresh-status),
  .ghost-table td[data-label="操作"] .order-action-cell .local-refresh-status {
    width: fit-content;
    max-width: 100%;
  }

  .hierarchy-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    max-width: 100%;
    gap: 6px;
    align-items: center;
    padding-bottom: 2px;
  }

  .hierarchy-toolbar > span {
    grid-column: 1 / -1;
    align-self: center;
    overflow-wrap: anywhere;
    white-space: normal;
    max-width: 100%;
  }

  .hierarchy-toolbar:not(.sort-toolbar) button {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 5px 9px;
    white-space: normal;
    line-height: 1.2;
  }

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

  .automation-layer-tabs button {
    min-width: 0;
    width: 100%;
    padding-inline: 6px;
  }

  .order-pager,
  .order-pager > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    max-width: 100%;
    gap: 6px;
    overflow: visible;
  }

  .order-pager > span {
    grid-column: 1 / -1;
    white-space: normal;
  }

  .order-pager > div {
    grid-column: 1 / -1;
  }

  .order-pager .pager-control,
  .order-pager button {
    min-width: 0;
    width: 100%;
  }

  .sort-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .sort-toolbar button {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding-left: 8px;
    padding-right: 8px;
  }

  .automation-device > header,
  .hierarchy-card header,
  .workbench-device,
  .workbench-account {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .automation-device > header > div,
  .hierarchy-card header > div:first-child,
  .workbench-device > *,
  .workbench-account > * {
    min-width: 0;
    max-width: 100%;
  }

  .automation-device > header strong,
  .automation-device > header span,
  .workbench-device strong,
  .workbench-device span,
  .workbench-account strong,
  .workbench-account span {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .automation-device-actions,
  .automation-device .task-progress-pills {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    width: 100%;
    overflow-x: auto;
  }

  .automation-device-actions button {
    width: auto;
    min-width: 0;
    white-space: nowrap;
    padding: 5px 9px;
  }

  .mini-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .mini-metrics i {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: left;
  }

  .hierarchy-table td > *,
  .automation-table td > *,
  .ghost-table td > * {
    min-width: 0;
    max-width: 100%;
  }

  .sort-toolbar > span {
    grid-column: 1 / -1;
  }

  .device-cards {
    grid-template-columns: 1fr;
  }

  .order-account-cards {
    max-height: none;
  }

  .order-account-card header,
  .assignment header,
  .queue-item header {
    display: grid;
  }

  .order-account-card dl,
  .device-card dl {
    grid-template-columns: minmax(82px, auto) minmax(0, 1fr);
  }

  .order-account-card dd,
  .device-card dd {
    text-align: left;
  }
}
.registration-maintenance {
  display: grid;
  gap: 10px;
}

.registration-plan-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr)) auto auto;
  gap: 8px;
  align-items: center;
}

.registration-plan-fields input[type="text"],
.registration-plan-fields input[type="password"] {
  min-width: 0;
  width: 100%;
}

@media (max-width: 900px) {
  .task-control-console,
  .task-control-grid,
  .task-control-grid label,
  .task-control-grid input,
  .task-control-grid select {
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }

  .task-control-grid {
    grid-template-columns: 1fr;
  }

  .task-control-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .task-control-actions button {
    min-width: 0;
    width: 100%;
    white-space: normal;
  }

  .registration-plan-fields {
    grid-template-columns: 1fr 1fr;
  }
}
