/* ============================================================
   GBOX AI 智能管理平台 - 完整样式表
   Dark Theme + Glassmorphism
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
  --bg-base: #0a0e1a;
  --bg-surface: #111827;
  --bg-elevated: #1a2234;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-glass: rgba(17, 24, 39, 0.5);
  --border-color: rgba(255, 255, 255, 0.06);
  --border-glow: rgba(99, 102, 241, 0.2);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --cyan: #06b6d4;
  --green: #10b981;
  --yellow: #f59e0b;
  --red: #ef4444;
  --orange: #f97316;
  --pink: #ec4899;
  --sidebar-width: 240px;
  --topbar-height: 56px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Multimodal lab uses a single-column workbench before the global mobile shell. */
@media (max-width: 1200px) {
  #page-thermal .thermal-grid {
    grid-template-columns: 1fr;
  }

  #page-thermal .thermal-register-form {
    grid-template-columns: minmax(200px, 2fr) minmax(150px, 1fr) minmax(100px, 0.6fr) auto;
  }

  #page-thermal .thermal-module-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 250px;
  }
}

@media (max-width: 720px) {
  #page-thermal .thermal-register-form,
  #page-thermal .thermal-module-list {
    grid-template-columns: 1fr;
  }
}

/* ---- Light Theme ---- */
[data-theme="light"] {
  --bg-base: #f0f2f5;
  --bg-surface: #ffffff;
  --bg-elevated: #f8f9fb;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.7);
  --border-color: rgba(0, 0, 0, 0.08);
  --border-glow: rgba(99, 102, 241, 0.15);
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.1);
}
[data-theme="light"] body {
  background: var(--bg-base);
}
[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, #ffffff 0%, #f8f9fb 100%);
  border-right-color: rgba(0,0,0,0.06);
}
[data-theme="light"] .sidebar .brand-name,
[data-theme="light"] .sidebar .nav-label {
  color: var(--text-primary);
}
[data-theme="light"] .nav-section {
  background: rgba(248,250,252,0.76);
  border-color: rgba(15,23,42,0.08);
}
[data-theme="light"] .nav-section[data-nav-group="mainline"] {
  background: linear-gradient(180deg, rgba(99,102,241,0.10), rgba(248,250,252,0.76));
  border-color: rgba(99,102,241,0.18);
}
[data-theme="light"] .nav-version-lock {
  background: rgba(14,165,233,0.08);
  border-color: rgba(14,165,233,0.16);
}
[data-theme="light"] .nav-item.primary-mainline {
  background: rgba(99,102,241,0.10);
}
[data-theme="light"] .nav-link:hover,
[data-theme="light"] .nav-link.active {
  background: rgba(99,102,241,0.08);
}
[data-theme="light"] .topbar {
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(12px);
  border-bottom-color: rgba(0,0,0,0.06);
}
[data-theme="light"] .stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border-color: rgba(0,0,0,0.06);
}
[data-theme="light"] ::-webkit-scrollbar-track {
  background: #f0f2f5;
}
[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: #c1c8d0;
}
/* Leaflet: remove dark inversion in light mode */
[data-theme="light"] .leaflet-tile-pane {
  filter: none;
}
[data-theme="light"] .leaflet-container {
  background: #e8eaed !important;
}
[data-theme="light"] .leaflet-control-zoom a {
  background: #fff !important;
  color: #333 !important;
  border-color: rgba(0,0,0,0.12) !important;
}
[data-theme="light"] .leaflet-control-zoom a:hover {
  background: #f5f5f5 !important;
}
[data-theme="light"] .leaflet-control-attribution {
  background: rgba(255,255,255,0.85) !important;
  color: #666 !important;
}
[data-theme="light"] .leaflet-popup-content-wrapper {
  background: #fff !important;
  color: #1e293b !important;
  border-color: rgba(0,0,0,0.08) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1) !important;
}
[data-theme="light"] .leaflet-popup-tip {
  background: #fff !important;
  border-color: rgba(0,0,0,0.08) !important;
}
[data-theme="light"] .bld-marker-label {
  background: rgba(255,255,255,0.92);
  color: #1e293b;
  border-color: rgba(0,0,0,0.1);
}
[data-theme="light"] .map-toolbar {
  background: rgba(255,255,255,0.8);
  border-color: rgba(0,0,0,0.08);
}
[data-theme="light"] #leafletMap.static-map-active {
  background:
    radial-gradient(circle at 42% 44%, rgba(34,197,94,0.18), transparent 24%),
    linear-gradient(135deg, #dbeafe 0%, #eef2ff 46%, #ecfeff 100%);
}
[data-theme="light"] .static-map-canvas::before {
  background-image:
    linear-gradient(rgba(71,85,105,0.13) 1px, transparent 1px),
    linear-gradient(90deg, rgba(71,85,105,0.13) 1px, transparent 1px);
}
[data-theme="light"] .static-map-canvas::after {
  background:
    radial-gradient(circle at 48% 48%, transparent 0 34%, rgba(255,255,255,0.18) 64%, rgba(148,163,184,0.18) 100%),
    linear-gradient(90deg, rgba(99,102,241,0.06), transparent 32%, rgba(14,165,233,0.08));
}
[data-theme="light"] .static-map-road {
  background: rgba(71,85,105,0.24);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.45);
}
[data-theme="light"] .static-map-district {
  color: rgba(30,41,59,0.28);
}
[data-theme="light"] .static-marker-label,
[data-theme="light"] .static-map-mode-badge,
[data-theme="light"] .static-map-info,
[data-theme="light"] .static-map-empty {
  background: rgba(255,255,255,0.88);
  border-color: rgba(15,23,42,0.10);
  color: #1e293b;
}
/* Theme toggle button */
.theme-toggle {
  position: relative;
  width: 48px;
  height: 26px;
  border-radius: 13px;
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  display: flex;
  align-items: center;
  padding: 0 3px;
}
.theme-toggle:hover {
  border-color: var(--accent);
}
.theme-toggle-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: transform var(--transition), background var(--transition);
  transform: translateX(0);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
[data-theme="light"] .theme-toggle {
  background: #e0e7ef;
  border-color: rgba(0,0,0,0.1);
}
[data-theme="light"] .theme-toggle-thumb {
  transform: translateX(22px);
  background: #f59e0b;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
  font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body.auth-pending .app-layout,
body.auth-pending .ai-floating-widget {
  display: none;
}

body.auth-ready .login-screen {
  display: none;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ---- App Layout ---- */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, rgba(10,14,26,0.98), rgba(17,24,39,0.98));
}

.login-panel {
  width: min(420px, 100%);
  background: rgba(17, 24, 39, 0.9);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 28px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.login-logo {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  color: white;
  font-weight: 800;
  font-size: 1.2rem;
}

.login-brand h1 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: 0;
}

.login-brand p {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form label,
.admin-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.login-form input,
.admin-field input,
.admin-field select {
  width: 100%;
  height: 40px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  background: rgba(10,14,26,0.72);
  color: var(--text-primary);
  padding: 0 12px;
  font-family: inherit;
  outline: none;
}

.login-form input:focus,
.admin-field input:focus,
.admin-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.16);
}

.login-submit {
  height: 42px;
  border: none;
  border-radius: var(--radius-xs);
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition);
}

.login-submit:hover { background: var(--accent-light); }
.login-submit:disabled { opacity: 0.65; cursor: not-allowed; }

.login-error {
  min-height: 18px;
  color: var(--red);
  font-size: 0.78rem;
}

.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.95) 0%, rgba(10, 14, 26, 0.98) 100%);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: width var(--transition), min-width var(--transition);
  z-index: 100;
}

.sidebar.collapsed { width: 64px; min-width: 64px; }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-version-lock,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .user-details,
.sidebar.collapsed .logout-btn { display: none; }
.sidebar.collapsed .sidebar-header { padding: 16px 12px; }
.sidebar.collapsed .sidebar-nav { padding: 12px 8px; }
.sidebar.collapsed .nav-section { padding: 0; border: 0; background: transparent; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-close {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: none;
  place-items: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
  cursor: pointer;
}

.sidebar-close:hover,
.sidebar-close:focus-visible {
  border-color: rgba(6, 182, 212, 0.42);
  color: var(--text-primary);
  outline: none;
}

.sidebar-close svg {
  width: 18px;
  height: 18px;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 190;
  border: 0;
  background: rgba(2, 6, 23, 0.62);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition), visibility var(--transition);
}

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

.brand-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-light), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-version-lock {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 6px 4px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.14);
}

.nav-version-code {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--cyan);
}

.nav-version-text {
  min-width: 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-section {
  padding: 6px 5px 7px;
  border: 1px solid rgba(255,255,255,0.055);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.018);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-title {
  padding: 2px 9px 6px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
}

.nav-section[data-nav-group="mainline"] {
  background: linear-gradient(180deg, rgba(99,102,241,0.085), rgba(255,255,255,0.016));
  border-color: rgba(99,102,241,0.18);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
}

.nav-item.primary-mainline {
  color: var(--text-primary);
  background: rgba(99,102,241,0.10);
}

.nav-item:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(6, 182, 212, 0.08));
  color: var(--accent-light);
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-item.active .nav-icon { opacity: 1; }

.nav-item.admin-entry {
  color: var(--text-muted);
}

.nav-badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--red);
  color: white;
  min-width: 18px;
  text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  min-width: 0;
}

.user-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 0.7rem; color: var(--text-muted); }

.user-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.logout-btn {
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.03);
  color: var(--text-secondary);
  border-radius: var(--radius-xs);
  padding: 6px 8px;
  font-size: 0.72rem;
  cursor: pointer;
}

.logout-btn:hover {
  color: var(--text-primary);
  border-color: rgba(99,102,241,0.35);
}

.password-btn {
  color: var(--cyan);
}

/* ============================================================
   TOPBAR
   ============================================================ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-base);
}

.topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  background: rgba(17, 24, 39, 0.6);
  backdrop-filter: blur(12px);
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all var(--transition);
}
.menu-toggle:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }

.menu-toggle svg {
  width: 20px;
  height: 20px;
}

.menu-toggle-label {
  display: none;
  font-size: 0.76rem;
  font-weight: 700;
}

.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.breadcrumb-home { color: var(--text-muted); }
.breadcrumb-sep { color: var(--text-muted); }
.breadcrumb-current { color: var(--text-primary); font-weight: 600; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* AI Status */
.ai-status, .ws-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--border-color);
  background: var(--bg-glass);
}

.ai-dot, .ws-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.ai-status.online .ai-dot { background: var(--green); box-shadow: 0 0 6px var(--green); }
.ai-status.offline .ai-dot { background: var(--red); box-shadow: 0 0 6px var(--red); }
.ws-status.connected .ws-dot { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.ws-status.disconnected .ws-dot { background: var(--red); }

.ai-label { color: var(--text-secondary); }
.ai-state { color: var(--text-primary); }

/* Notification Bell */
.notification-bell {
  position: relative;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.notification-bell:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }

.notif-count {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 0.6rem;
  font-weight: 700;
  background: var(--red);
  color: white;
  border-radius: 10px;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
  line-height: 1.3;
  animation: badge-pop 0.3s ease;
}

@keyframes badge-pop {
  0% { transform: scale(0); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ============================================================
   PAGE CONTAINER
   ============================================================ */
.page-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
}

.page { display: none; animation: fadeIn 0.35s ease; }
.page.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   V2 PAGE FUNCTION MAP
   ============================================================ */
.v2-function-map {
  margin: -2px 0 20px;
  padding: 2px 0 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

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

.v2-domain-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: #67e8f9;
  font-size: 0.72rem;
  font-weight: 800;
}

.v2-domain-label::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}

.v2-function-title {
  margin: 0;
  color: var(--text-primary);
  font-size: clamp(1.02rem, 1.6vw, 1.32rem);
  line-height: 1.25;
  letter-spacing: 0;
}

.v2-function-summary {
  max-width: 920px;
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.65;
}

.v2-workflow-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.v2-workflow-step {
  min-width: 0;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.28);
}

.v2-workflow-step b {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(20, 184, 166, 0.16);
  color: #5eead4;
  font-size: 0.72rem;
}

.v2-workflow-step span {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.v2-function-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.v2-function-card {
  min-width: 0;
  min-height: 116px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.26);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.v2-function-card:hover {
  transform: translateY(-1px);
  border-color: rgba(34, 211, 238, 0.42);
  background: rgba(8, 145, 178, 0.12);
}

.v2-function-card:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.7);
  outline-offset: 2px;
}

.v2-function-card strong,
.v2-function-card span,
.v2-function-card em {
  min-width: 0;
  overflow-wrap: anywhere;
  letter-spacing: 0;
}

.v2-function-card strong {
  color: var(--text-primary);
  font-size: 0.92rem;
  line-height: 1.35;
}

.v2-function-card span {
  flex: 1;
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.45;
}

.v2-function-card em {
  align-self: flex-start;
  color: #86efac;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 700;
}

.v2-section-focus {
  animation: v2SectionFocus 1.8s ease;
}

@keyframes v2SectionFocus {
  0% {
    outline: 2px solid rgba(34, 211, 238, 0);
    box-shadow: 0 0 0 0 rgba(34, 211, 238, 0);
  }
  24% {
    outline: 2px solid rgba(34, 211, 238, 0.72);
    box-shadow: 0 0 0 6px rgba(34, 211, 238, 0.12);
  }
  100% {
    outline: 2px solid rgba(34, 211, 238, 0);
    box-shadow: 0 0 0 0 rgba(34, 211, 238, 0);
  }
}

[data-theme="light"] .v2-function-map {
  border-bottom-color: rgba(148, 163, 184, 0.28);
}

[data-theme="light"] .v2-domain-label {
  color: #0f766e;
}

[data-theme="light"] .v2-workflow-step,
[data-theme="light"] .v2-function-card {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(148, 163, 184, 0.24);
}

[data-theme="light"] .v2-function-card:hover {
  border-color: rgba(8, 145, 178, 0.36);
  background: rgba(236, 254, 255, 0.84);
}

[data-theme="light"] .v2-function-card em {
  color: #15803d;
}

/* ---- AI Native Workbench ---- */
.ai-native-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-native-perspective-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ai-native-perspective-card {
  min-width: 0;
  min-height: 106px;
  display: grid;
  gap: 7px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.ai-native-perspective-card:hover {
  transform: translateY(-1px);
  border-color: rgba(6, 182, 212, 0.36);
}

.ai-native-perspective-card.active {
  border-color: rgba(6, 182, 212, 0.5);
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.14), rgba(16, 185, 129, 0.08));
}

.ai-native-perspective-card strong {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.35;
}

.ai-native-perspective-card span {
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.45;
}

.ai-native-perspective-card em {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-style: normal;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.ai-native-perspective-brief {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1.3fr);
  gap: 12px;
}

.ai-native-perspective-brief > div {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.32);
}

.ai-native-perspective-brief span,
.ai-native-panel-subtitle {
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.ai-native-perspective-brief strong {
  display: block;
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.ai-native-panel-subtitle {
  max-width: 780px;
  margin: 4px 0 0;
}

.ai-native-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.ai-native-summary-card,
.ai-native-action-card,
.ai-native-object-item,
.ai-native-metric,
.ai-native-simulation-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}

.ai-native-summary-card {
  padding: 14px;
  min-height: 132px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-native-summary-card.blocked { border-color: rgba(245, 158, 11, 0.3); }
.ai-native-summary-card.error { border-color: rgba(239, 68, 68, 0.3); }

.ai-native-card-head,
.ai-native-result-head,
.ai-native-tool-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-native-card-head span,
.ai-native-result-head strong {
  font-weight: 700;
  color: var(--text-primary);
}

.ai-native-card-head b,
.ai-native-result-head span {
  font-size: 0.68rem;
  color: var(--cyan);
  border: 1px solid rgba(6, 182, 212, 0.24);
  border-radius: var(--radius-xs);
  padding: 3px 7px;
  white-space: nowrap;
}

.ai-native-summary-card p,
.ai-native-answer {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.5;
}

.ai-native-metric-row,
.ai-native-metrics,
.ai-native-quick-row,
.ai-native-suggestions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-native-metric-row span {
  min-width: 78px;
  display: grid;
  gap: 2px;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.ai-native-metric-row strong {
  display: block;
  color: var(--text-primary);
  font-size: 1rem;
}

.ai-native-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  gap: 16px;
}

.ai-native-query-panel,
.ai-native-catalog-panel,
.ai-native-invocation-panel {
  grid-column: 1 / -1;
}

.ai-native-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.ai-native-input-row textarea,
.ai-native-tool-form input,
.ai-native-tool-form select {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 10px 12px;
  font: inherit;
  min-width: 0;
}

.ai-native-input-row textarea {
  resize: vertical;
  min-height: 72px;
}

.ai-native-chip {
  border: 1px solid rgba(6, 182, 212, 0.24);
  background: rgba(6, 182, 212, 0.08);
  color: var(--text-primary);
  border-radius: var(--radius-xs);
  padding: 6px 10px;
  font-size: 0.76rem;
  cursor: pointer;
}

.ai-native-chip:hover {
  border-color: var(--cyan);
}

.ai-native-chip.secondary {
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-secondary);
}

.ai-native-result {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.ai-native-metric {
  min-width: 112px;
  padding: 10px;
  display: grid;
  gap: 4px;
}

.ai-native-metric strong {
  font-size: 1.1rem;
  color: var(--text-primary);
}

.ai-native-metric span {
  color: var(--text-secondary);
  font-size: 0.72rem;
}

.ai-native-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.ai-native-table {
  min-width: 720px;
}

.ai-native-empty,
.ai-native-validation,
.ai-native-suggestions span {
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  font-size: 0.76rem;
}

.ai-native-empty {
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.08);
}

.ai-native-suggestions span {
  min-width: 0;
  color: var(--text-secondary);
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(148, 163, 184, 0.08);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ai-native-planner-badge {
  display: flex;
  justify-content: flex-start;
}

.ai-native-planner-badge span {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border: 1px solid rgba(6, 182, 212, 0.26);
  border-radius: var(--radius-xs);
  background: rgba(6, 182, 212, 0.08);
  color: var(--cyan);
  padding: 5px 8px;
  font-size: 0.7rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.ai-native-planner-badge.fallback span,
.ai-native-planner-badge.heuristic span {
  border-color: rgba(245, 158, 11, 0.26);
  background: rgba(245, 158, 11, 0.08);
  color: var(--yellow);
}

.ai-native-planner-badge.manual span {
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-secondary);
}

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

.ai-native-rule-meta span {
  min-width: 0;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: rgba(15, 23, 42, 0.28);
  color: var(--text-secondary);
  font-size: 0.74rem;
  overflow-wrap: anywhere;
}

.ai-native-flow {
  display: grid;
  gap: 8px;
}

.ai-native-flow.compact {
  gap: 6px;
}

.ai-native-flow-step {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.ai-native-flow-step b {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.14);
  color: var(--green);
  font-size: 0.72rem;
}

.ai-native-flow-step span {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.ai-native-action-list,
.ai-native-object-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.ai-native-action-card,
.ai-native-object-item {
  padding: 10px;
  display: grid;
  gap: 5px;
  min-width: 0;
}

.ai-native-action-card.disabled {
  opacity: 0.72;
}

.ai-native-action-card strong,
.ai-native-object-item strong {
  color: var(--text-primary);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.ai-native-action-card span,
.ai-native-action-card em,
.ai-native-object-item span,
.ai-native-object-item em {
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-style: normal;
  overflow-wrap: anywhere;
}

.ai-native-validation {
  display: grid;
  gap: 5px;
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.22);
  background: rgba(16, 185, 129, 0.08);
}

.ai-native-validation.warning {
  color: var(--yellow);
  border-color: rgba(245, 158, 11, 0.28);
  background: rgba(245, 158, 11, 0.08);
}

.ai-native-validation.error,
.loading-placeholder.error {
  color: var(--red);
}

.ai-native-tool-form {
  display: grid;
  gap: 10px;
}

.ai-native-tool-form label {
  display: grid;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 0.76rem;
}

.ai-native-tool-preview,
.ai-native-simulation-card {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.ai-native-tool-preview.safe,
.ai-native-simulation-card.matched {
  border-color: rgba(16, 185, 129, 0.28);
}

.ai-native-tool-preview.blocked,
.ai-native-simulation-card.missed {
  border-color: rgba(245, 158, 11, 0.28);
}

.ai-native-tool-preview pre {
  margin: 0;
  padding: 10px;
  max-height: 240px;
  overflow: auto;
  border-radius: var(--radius-xs);
  background: rgba(2, 6, 23, 0.42);
  color: var(--text-secondary);
  font-size: 0.72rem;
  white-space: pre-wrap;
}

.panel-agent-card {
  margin-top: 10px;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.panel-agent-card .ai-native-metrics {
  gap: 6px;
}

.panel-agent-card .ai-native-metric {
  min-width: 92px;
  padding: 8px;
}

.panel-agent-card .ai-native-table {
  min-width: 520px;
}

.panel-agent-card .ai-native-rule-meta {
  grid-template-columns: 1fr;
}

.panel-agent-card pre {
  margin: 0;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

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

.ai-native-workorder-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-native-workorder-summary span {
  min-width: 0;
  padding: 7px 9px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(14, 165, 233, 0.18);
  background: rgba(14, 165, 233, 0.08);
  color: var(--text-secondary);
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}

.ai-native-catalog-section {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.ai-native-catalog-section h4 {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-primary);
}

.device-agent-page {
  display: grid;
  gap: 16px;
}

.device-agent-layout {
  align-items: start;
}

.device-agent-card-list,
.device-agent-instance-list,
.device-agent-invocation-list {
  display: grid;
  gap: 10px;
}

.device-agent-card,
.device-agent-invocation,
.device-agent-instance {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.44);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--text-primary);
}

.device-agent-invocation {
  display: grid;
  gap: 8px;
  border-left-width: 4px;
}

.device-agent-invocation.trusted-rule,
.device-agent-invocation.success {
  border-left-color: var(--green);
}

.device-agent-invocation.preview,
.device-agent-invocation.approval {
  border-left-color: var(--orange);
}

.device-agent-invocation.blocked,
.device-agent-invocation.failed {
  border-left-color: var(--danger-color);
}

.device-agent-instance {
  display: grid;
  gap: 5px;
  text-align: left;
  cursor: pointer;
}

.device-agent-instance:hover,
.device-agent-instance.active,
.device-agent-card.active {
  border-color: rgba(34, 211, 238, 0.55);
  background: rgba(14, 116, 144, 0.18);
}

.device-agent-card.health-healthy {
  border-left: 4px solid var(--green);
}

.device-agent-card.health-warning {
  border-left: 4px solid var(--orange);
}

.device-agent-card.health-critical {
  border-left: 4px solid var(--danger-color);
}

.device-agent-instance strong,
.device-agent-card strong,
.device-agent-invocation strong {
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.device-agent-instance span,
.device-agent-instance em,
.device-agent-card p,
.device-agent-invocation p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.device-agent-instance em {
  font-style: normal;
  color: var(--text-muted);
}

.device-agent-contract-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.device-agent-contract-grid div {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.34);
}

.device-agent-contract-grid span {
  color: var(--text-muted);
  font-size: 0.72rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.device-agent-contract-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}

.device-agent-layer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}

.device-agent-layer-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.device-agent-deploy-ops {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

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

.device-agent-deploy-strip > div,
	.device-agent-deploy-check,
	.device-agent-deploy-gate,
	.device-agent-env-item,
  .device-agent-release-item,
	.device-agent-rollout-step,
.device-agent-rollback-note {
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.34);
}

.device-agent-deploy-strip > div {
  display: grid;
  gap: 4px;
  padding: 9px;
}

.device-agent-deploy-strip span,
.device-agent-deploy-strip small,
.device-agent-deploy-check small,
.device-agent-deploy-gate small,
	.device-agent-rollout-step span,
	.device-agent-rollback-note span,
	.device-agent-env-item span,
	.device-agent-env-item small,
  .device-agent-release-actions span,
  .device-agent-release-item span,
  .device-agent-release-item small {
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.device-agent-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.device-agent-section-title span {
  color: var(--text-muted);
  font-size: 0.72rem;
  overflow-wrap: anywhere;
  text-align: right;
}

.device-agent-deploy-checklist,
.device-agent-deploy-gates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}

.device-agent-deploy-check,
.device-agent-deploy-gate {
  display: grid;
  gap: 7px;
  padding: 9px;
}

.device-agent-deploy-check.is-pass,
.device-agent-deploy-gate.is-pass {
  border-color: rgba(34, 197, 94, 0.34);
  background: rgba(22, 101, 52, 0.14);
}

.device-agent-deploy-check.is-warn,
.device-agent-deploy-check.is-pending,
.device-agent-deploy-gate.is-warn,
.device-agent-deploy-gate.is-pending {
  border-color: rgba(245, 158, 11, 0.32);
  background: rgba(120, 53, 15, 0.12);
}

.device-agent-deploy-check.is-block,
.device-agent-deploy-gate.is-block {
  border-color: rgba(239, 68, 68, 0.34);
  background: rgba(127, 29, 29, 0.14);
}

.device-agent-gate-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.device-agent-gate-head strong {
  min-width: 0;
}

.device-agent-gate-status {
  flex: 0 0 auto;
  max-width: 42%;
  padding: 3px 7px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--text-secondary);
  font-size: 0.68rem;
  line-height: 1.3;
  text-align: right;
  overflow-wrap: anywhere;
}

.device-agent-gate-status.is-pass {
  color: var(--green);
  border-color: rgba(34, 197, 94, 0.34);
  background: rgba(34, 197, 94, 0.1);
}

.device-agent-gate-status.is-warn,
.device-agent-gate-status.is-pending {
  color: var(--orange);
  border-color: rgba(245, 158, 11, 0.32);
  background: rgba(245, 158, 11, 0.1);
}

.device-agent-gate-status.is-block {
  color: var(--danger-color);
  border-color: rgba(239, 68, 68, 0.34);
  background: rgba(239, 68, 68, 0.1);
}

.device-agent-gate-status.is-optional {
  color: var(--text-muted);
}

.device-agent-deploy-gate p {
  min-height: 2.7em;
}

.device-agent-rollout-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.device-agent-rollout-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 8px;
  padding: 9px;
}

.device-agent-rollout-step b {
  grid-row: span 2;
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

	.device-agent-env-grid {
	  display: grid;
	  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	  gap: 8px;
	}

.device-agent-release-actions {
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.device-agent-release-list {
  display: grid;
  gap: 8px;
}

.device-agent-release-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(110px, auto);
  gap: 5px 10px;
  padding: 9px;
}

.device-agent-release-item div,
.device-agent-release-item strong,
.device-agent-release-item span,
.device-agent-release-item small {
  min-width: 0;
}

.device-agent-release-item span,
.device-agent-release-item small {
  display: block;
  overflow-wrap: anywhere;
}

.device-agent-release-item code {
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-align: right;
  overflow-wrap: anywhere;
}

.device-agent-release-item small {
  grid-column: 1 / -1;
}

.device-agent-release-rollback-btn {
  justify-self: end;
  min-width: 88px;
}

.device-agent-env-item {
  display: grid;
  gap: 5px;
  padding: 8px;
}

.device-agent-env-item code {
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

.device-agent-rollback-note {
  display: grid;
  gap: 5px;
  padding: 10px;
  border-color: rgba(34, 211, 238, 0.24);
  background: rgba(8, 47, 73, 0.22);
}

.device-agent-layer-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: 6px;
  background: rgba(8, 47, 73, 0.22);
}

.device-agent-layer-item span,
.device-agent-layer-item small {
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.aiot-layered-encapsulation {
  border-left: 4px solid rgba(34, 211, 238, 0.82);
}

.device-agent-explanation-card {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(34, 211, 238, 0.22);
  border-radius: 6px;
  background: rgba(8, 47, 73, 0.24);
}

[data-theme="light"] .device-agent-card,
[data-theme="light"] .device-agent-invocation,
[data-theme="light"] .device-agent-instance {
  background: rgba(248, 250, 252, 0.9);
  border-color: rgba(148, 163, 184, 0.28);
}

[data-theme="light"] .device-agent-explanation-card {
  background: rgba(224, 242, 254, 0.65);
  border-color: rgba(14, 165, 233, 0.24);
}

[data-theme="light"] .device-agent-layer-item {
  background: rgba(224, 242, 254, 0.56);
  border-color: rgba(14, 165, 233, 0.24);
}

[data-theme="light"] .device-agent-deploy-strip > div,
[data-theme="light"] .device-agent-deploy-check,
	[data-theme="light"] .device-agent-deploy-gate,
	[data-theme="light"] .device-agent-env-item,
  [data-theme="light"] .device-agent-release-item,
	[data-theme="light"] .device-agent-rollout-step,
[data-theme="light"] .device-agent-rollback-note {
  background: rgba(248, 250, 252, 0.78);
  border-color: rgba(148, 163, 184, 0.28);
}

[data-theme="light"] .ai-native-rule-meta span,
[data-theme="light"] .ai-native-tool-preview pre {
  background: rgba(241, 245, 249, 0.8);
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.stat-rooms::before { background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.stat-devices::before { background: linear-gradient(90deg, var(--cyan), #22d3ee); }
.stat-tenants::before { background: linear-gradient(90deg, var(--green), #34d399); }
.stat-alerts::before { background: linear-gradient(90deg, var(--red), var(--orange)); }

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-glow);
  box-shadow: var(--shadow);
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat-label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }

.stat-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}
.stat-icon-wrap svg { width: 18px; height: 18px; }
.rooms-icon { background: linear-gradient(135deg, var(--accent), var(--accent-light)); }
.devices-icon { background: linear-gradient(135deg, var(--cyan), #22d3ee); }
.tenants-icon { background: linear-gradient(135deg, var(--green), #34d399); }
.alerts-icon { background: linear-gradient(135deg, var(--red), var(--orange)); }

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 8px;
}

.stat-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-tag {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
}
.stat-tag.occupied { background: rgba(16, 185, 129, 0.15); color: var(--green); }
.stat-tag.vacant { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); }
.stat-tag.online { background: rgba(6, 182, 212, 0.15); color: var(--cyan); }
.stat-tag.offline { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.stat-tag.info { background: rgba(99, 102, 241, 0.15); color: var(--accent-light); }
.stat-tag.p0 { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.stat-tag.p1 { background: rgba(249, 115, 22, 0.15); color: var(--orange); }
.stat-tag.p2 { background: rgba(245, 158, 11, 0.15); color: var(--yellow); }

.stat-bar {
  margin-top: 12px;
  height: 4px;
  background: rgba(255,255,255,0.05);
  border-radius: 2px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  transition: width 0.8s ease;
}
.stat-bar-fill.cyan { background: linear-gradient(90deg, var(--cyan), #22d3ee); }

/* ============================================================
   PANELS
   ============================================================ */
.panel {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 600;
}

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

.panel-badge {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-light);
}

.thermal-live-actions {
  gap: 6px;
}

.thermal-live-actions .btn {
  min-width: 34px;
  height: 28px;
  padding: 4px 8px;
  justify-content: center;
}

.thermal-fps-badge,
.thermal-zoom-value {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border: 1px solid rgba(148,163,184,0.16);
  border-radius: var(--radius-xs);
  background: rgba(15,23,42,0.56);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  white-space: nowrap;
}

.thermal-zoom-value {
  min-width: 52px;
}

.live-badge { background: rgba(16, 185, 129, 0.15); color: var(--green); display: flex; align-items: center; gap: 5px; }
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.panel-body { padding: 16px 20px; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.loading-placeholder {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ============================================================
   AIoT OPERATIONS
   ============================================================ */
.stat-aiot-strategy::before { background: linear-gradient(90deg, var(--green), #34d399); }
.stat-aiot-content::before { background: linear-gradient(90deg, var(--cyan), #22d3ee); }
.stat-aiot-fusion::before { background: linear-gradient(90deg, var(--orange), var(--red)); }
.stat-aiot-service::before { background: linear-gradient(90deg, var(--accent), var(--pink)); }

.aiot-mini-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
}

.aiot-card-list,
.aiot-event-list,
.aiot-audit-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.aiot-kpi-card {
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.aiot-kpi-card span,
.table-subtext {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.aiot-kpi-card strong {
  color: var(--text-primary);
  font-size: 1.35rem;
  line-height: 1.2;
}

.aiot-kpi-card small {
  color: var(--text-secondary);
}

.term-with-note {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  vertical-align: baseline;
}

.term-with-note.compact {
  gap: 3px;
}

.term-code {
  color: inherit;
  font: inherit;
}

code.term-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em;
}

.term-note {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 1.25;
}

.term-note::before {
  content: "（";
}

.term-note::after {
  content: "）";
}

.aiot-chip .term-with-note,
.status-chip .term-with-note,
.alert-level-badge .term-with-note,
.alert-status-badge .term-with-note,
.cmdb-badge .term-with-note,
.thermal-status .term-with-note,
.service-mon-status .term-with-note {
  gap: 2px;
}

.aiot-chip .term-note,
.status-chip .term-note,
.stat-tag .term-note,
.alert-level-badge .term-note,
.alert-status-badge .term-note,
.cmdb-badge .term-note,
.device-status-tag .term-note,
.device-sensor-status .term-note,
.ai-status-tag .term-note,
.thermal-status .term-note,
.service-mon-status .term-note,
.service-mon-name .term-note,
.panel-title .term-note,
.form-label .term-note,
.metric-label .term-note,
.trigger-badge .term-note,
.trigger-badge-sm .term-note,
.task-status-badge .term-note,
.linkage-rule-status .term-note,
.linkage-node .term-note,
.workflow-card-body .term-note,
.object-management-row .term-note,
.wf-cfg-value .term-note {
  font-size: 0.62rem;
}

.field-help-text {
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.45;
  margin-top: 4px;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.aiot-card,
.aiot-event-card,
.aiot-service-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
}

.aiot-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 14px;
}
.aiot-card.compact {
  grid-template-columns: 1fr;
}
.aiot-card.overdue {
  border-color: rgba(239,68,68,0.35);
  background: rgba(239,68,68,0.06);
}

.aiot-card-title-row,
.aiot-event-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.aiot-card-title-row strong,
.aiot-event-head strong {
  color: var(--text-primary);
  font-size: 0.88rem;
}

.aiot-meta,
.aiot-muted {
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.aiot-chip-row,
.aiot-metrics,
.aiot-card-actions,
.aiot-event-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.aiot-chip-row { margin-top: 10px; }
.aiot-metrics {
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 0.72rem;
}
.aiot-metrics span,
.aiot-event-actions span {
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-color);
}

.aiot-card-actions {
  align-content: flex-start;
  justify-content: flex-end;
}

.face-event-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
}

.face-event-media-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.face-event-image-thumb {
  position: relative;
  width: 82px;
  height: 82px;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(99,102,241,0.45);
  border-radius: var(--radius-sm);
  background: rgba(15,23,42,0.72);
  cursor: pointer;
}

.face-event-image-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  width: 82px;
}

.face-image-inline-actions,
.face-image-modal-actions,
.twin-visual-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.face-image-inline-actions .btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 4px 5px;
  font-size: 0.6rem;
}

.face-box-overlay,
.face-event-box,
.twin-thumb-face-box,
.twin-screen-face-box {
  position: absolute;
  pointer-events: none;
  border: 2px solid rgba(34,211,238,0.95);
  box-shadow: 0 0 0 1px rgba(2,6,23,0.82), 0 0 14px rgba(34,211,238,0.45);
  border-radius: 3px;
}

.face-event-box::after,
.twin-thumb-face-box::after,
.twin-screen-face-box::after {
  content: '人脸';
  position: absolute;
  left: -2px;
  top: -18px;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(2,6,23,0.82);
  color: #67e8f9;
  font-size: 0.58rem;
  line-height: 1.2;
  white-space: nowrap;
}

.face-event-image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.face-event-image-locked {
  width: 82px;
  min-height: 82px;
  border: 1px dashed rgba(148,163,184,0.38);
  border-radius: var(--radius-sm);
  background: rgba(148,163,184,0.08);
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  font-size: 0.72rem;
  line-height: 1.25;
}

.face-event-image-locked span {
  color: var(--text-muted);
  font-size: 0.64rem;
}

.face-image-modal {
  max-width: 720px;
}

.face-image-preview {
  width: 100%;
  max-height: 56vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border-color);
}

.face-image-meta {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.face-image-meta span,
.privacy-notice {
  color: var(--text-secondary);
  font-size: 0.74rem;
  line-height: 1.45;
}

.face-image-meta span {
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color);
}

.face-image-modal-actions {
  margin-top: 12px;
}

.face-command-reply {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 0.7rem;
  line-height: 1.35;
}

.face-command-reply span {
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  background: rgba(255,255,255,0.04);
}

.face-command-reply.face-command-error span {
  border-color: rgba(239,68,68,0.28);
  background: rgba(239,68,68,0.08);
  color: var(--red);
}

.custom-banner-modal {
  max-width: 640px;
}

.banner-rule-modal {
  max-width: 1320px;
}

.panel-material-modal {
  max-width: 720px;
}

.screen-saver-modal {
  max-width: 1040px;
}

.twin-atomic-modal {
  max-width: 760px;
}

.twin-shadow-edit-modal {
  max-width: 820px;
}

.twin-atomic-command-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  margin-bottom: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.045);
}

.twin-atomic-command-head > div:first-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.twin-atomic-command-head span {
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(6,182,212,0.12);
  font-size: 0.68rem;
  font-weight: 800;
}

.twin-atomic-command-head strong {
  color: var(--text-primary);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.twin-atomic-command-head small {
  color: var(--text-muted);
  line-height: 1.45;
}

.twin-atomic-risk {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  border: 1px solid var(--border-color);
}

.twin-atomic-risk.risk-low {
  color: var(--green);
  border-color: rgba(34,197,94,0.22);
  background: rgba(34,197,94,0.1);
}

.twin-atomic-risk.risk-medium {
  color: var(--yellow);
  border-color: rgba(245,158,11,0.24);
  background: rgba(245,158,11,0.1);
}

.twin-atomic-risk.risk-high {
  color: var(--red);
  border-color: rgba(239,68,68,0.24);
  background: rgba(239,68,68,0.1);
}

.twin-atomic-json {
  min-height: 180px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
}

.twin-atomic-result {
  min-height: 46px;
  max-height: 240px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  margin: 6px 0 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: rgba(0,0,0,0.18);
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.45;
}

.twin-atomic-result strong {
  color: var(--text-primary);
}

.twin-atomic-result pre {
  max-width: 100%;
  margin: 0;
  padding: 8px;
  border-radius: var(--radius-xs);
  background: rgba(2,6,23,0.55);
  color: var(--text-secondary);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

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

.screen-saver-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.banner-rule-layout {
  display: grid;
  grid-template-columns: minmax(620px, 1.35fr) minmax(360px, 0.85fr);
  gap: 16px;
}

.banner-rule-editor,
.banner-rule-preview-panel {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.035);
}

.banner-rule-fields {
  display: grid;
  gap: 12px;
  margin: 12px 0;
}

.banner-rule-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(148,163,184,0.14);
  border-radius: var(--radius-xs);
  background: rgba(0,0,0,0.12);
}

.banner-rule-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.banner-rule-field-head > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.banner-rule-field-head strong {
  color: var(--text-primary);
  font-size: 0.78rem;
}

.banner-rule-field-head small,
.banner-rule-mode-note {
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1.45;
}

.banner-rule-field-head select {
  flex: 0 0 150px;
}

.banner-rule-field-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.banner-rule-field-control label {
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 700;
}

.banner-rule-field[data-mode="object"] .banner-rule-text-control,
.banner-rule-field:not([data-mode="object"]) .banner-rule-object-control {
  display: none;
}

.banner-rule-field input,
.banner-rule-field select {
  min-width: 0;
}

.banner-rule-token-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.banner-rule-token-row > span {
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 700;
}

.banner-token-chip {
  min-height: 28px;
  border: 1px solid rgba(148,163,184,0.22);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.045);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 0.68rem;
}

.banner-token-chip:hover {
  color: var(--text-primary);
  border-color: rgba(99,102,241,0.48);
  background: rgba(99,102,241,0.12);
}

.banner-token-chip code {
  color: var(--cyan);
  font-size: 0.66rem;
}

.banner-rule-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.banner-rule-help {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.banner-rule-help > div,
.banner-rule-type-guide {
  min-width: 0;
  border: 1px solid rgba(148,163,184,0.16);
  border-radius: var(--radius-xs);
  background: rgba(15,23,42,0.42);
  padding: 10px;
}

.banner-rule-help strong,
.banner-rule-help span,
.banner-rule-type-guide strong,
.banner-rule-type-guide span {
  display: block;
}

.banner-rule-help strong,
.banner-rule-type-guide strong {
  color: var(--text-primary);
  font-size: 0.76rem;
  margin-bottom: 4px;
}

.banner-rule-help span,
.banner-rule-type-guide span {
  color: var(--text-secondary);
  font-size: 0.7rem;
  line-height: 1.45;
}

.banner-rule-type-guide {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 14px;
}

.banner-rule-type-guide > div {
  min-width: 0;
}

.banner-rule-type-guide .btn {
  flex: 0 0 auto;
}

.banner-rule-context {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.banner-rule-context div {
  min-width: 0;
  padding: 8px;
  border-radius: var(--radius-xs);
  background: rgba(15,23,42,0.62);
  border: 1px solid rgba(255,255,255,0.07);
}

.banner-rule-context span,
.banner-rule-context strong {
  display: block;
  overflow-wrap: anywhere;
}

.banner-rule-context span {
  color: var(--text-muted);
  font-size: 0.66rem;
  margin-bottom: 4px;
}

.banner-rule-context strong {
  color: var(--text-secondary);
  font-size: 0.76rem;
}

.banner-rule-preview {
  min-height: 150px;
}

.screen-saver-section,
.screen-saver-current {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.035);
}

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

.screen-saver-section-head strong {
  color: var(--text-primary);
  font-size: 0.86rem;
}

.screen-saver-section-head span {
  color: var(--text-muted);
  font-size: 0.68rem;
}

.screen-saver-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.screen-saver-item-list {
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.screen-saver-item {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(148,163,184,0.12);
  border-radius: var(--radius-xs);
  background: rgba(0,0,0,0.12);
}

.screen-saver-thumb {
  width: 76px;
  aspect-ratio: 5 / 8;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: rgba(2,6,23,0.55);
}

.screen-saver-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.screen-saver-thumb.empty {
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 0.66rem;
}

.screen-saver-item-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.screen-saver-item-main strong {
  color: var(--text-primary);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.screen-saver-item-main span {
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.screen-saver-item-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.twin-shadow-edit-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.twin-function-modal {
  width: min(900px, calc(100vw - 28px));
}

.twin-function-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.twin-function-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.025);
}

.twin-function-field.wide {
  grid-column: 1 / -1;
}

.twin-function-field > span,
.twin-function-check > span {
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.35;
}

.twin-function-field small,
.twin-function-check small {
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1.4;
}

.twin-range-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 10px;
  align-items: center;
}

.twin-range-row output {
  text-align: right;
  color: var(--text-primary);
  font-size: 0.76rem;
  font-weight: 800;
}

.twin-function-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.025);
}

.twin-function-check.confirm {
  border-color: rgba(245,158,11,0.3);
  background: rgba(245,158,11,0.06);
}

.twin-function-no-input {
  grid-column: 1 / -1;
  padding: 14px;
  border-radius: var(--radius-xs);
  border: 1px dashed rgba(255,255,255,0.14);
  color: var(--text-muted);
  font-size: 0.78rem;
  text-align: center;
}

.twin-function-payload-map {
  padding: 10px;
  margin-bottom: 12px;
  border-radius: var(--radius-xs);
  background: rgba(15,23,42,0.55);
  border: 1px solid rgba(255,255,255,0.08);
}

.twin-function-payload-map > strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 0.76rem;
}

.twin-function-payload-map > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.twin-function-payload-map span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(99,102,241,0.12);
  color: var(--text-secondary);
  font-size: 0.68rem;
}

.twin-function-payload-map code {
  color: var(--accent);
  font-size: 0.66rem;
}

.twin-function-result {
  gap: 8px;
}

.twin-function-output-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.twin-function-output-card {
  min-width: 0;
  padding: 9px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.16);
}

.twin-function-output-card strong,
.twin-function-output-card span {
  display: block;
  overflow-wrap: anywhere;
}

.twin-function-output-card strong {
  color: var(--text-primary);
  font-size: 0.78rem;
  margin-bottom: 5px;
}

.twin-function-output-card span {
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1.45;
}

.twin-advanced-json {
  margin: 8px 0 12px;
  border: 1px dashed rgba(255,255,255,0.16);
  border-radius: var(--radius-xs);
  background: rgba(0,0,0,0.12);
}

.twin-advanced-json summary {
  cursor: pointer;
  padding: 9px 10px;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 800;
}

.twin-advanced-json .form-row {
  padding: 0 10px 10px;
}

.twin-shadow-edit-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.twin-shadow-edit-field > span {
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.35;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-row label {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
}

.form-row input,
.form-row select,
.form-row textarea,
.readonly-field {
  min-height: 38px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.055);
  color: var(--text-primary);
  padding: 8px 10px;
  outline: none;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  border-color: rgba(99,102,241,0.7);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.14);
}

.form-row input[type="color"] {
  width: 100%;
  padding: 4px 8px;
}

.form-row input[type="file"] {
  min-height: auto;
  color: var(--text-secondary);
}

.form-row small {
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.45;
}

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

.custom-banner-preview {
  min-height: 94px;
  border: 1px dashed rgba(148,163,184,0.35);
  border-radius: var(--radius-sm);
  background: rgba(15,23,42,0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  color: var(--text-secondary);
  font-size: 0.74rem;
  text-align: center;
}

.custom-banner-preview img {
  max-width: 180px;
  max-height: 100px;
  object-fit: contain;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
}

.panel-material-spec {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(6,182,212,0.2);
  background: rgba(6,182,212,0.08);
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.5;
}

.panel-material-preview {
  align-items: stretch;
  justify-content: flex-start;
  text-align: left;
}

.panel-material-preview img {
  max-width: 220px;
  max-height: 140px;
  flex: 0 0 auto;
}

.panel-material-preview audio {
  width: 100%;
  max-width: 360px;
}

.panel-material-preview > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.panel-material-preview strong {
  color: var(--text-primary);
  font-size: 0.78rem;
}

.panel-material-preview span {
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.panel-material-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 14px;
}

.panel-material-checks label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.045);
  color: var(--text-secondary);
  font-size: 0.74rem;
  cursor: pointer;
}

.panel-material-checks input {
  margin: 0;
}

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

.privacy-notice {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.22);
}

.aiot-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: rgba(99,102,241,0.14);
  color: var(--accent-light);
  font-size: 0.68rem;
  font-weight: 600;
}

.aiot-chip.status-active,
.aiot-chip.status-granted,
.aiot-chip.status-completed,
.aiot-chip.status-accepted,
.aiot-chip.status-passed,
.aiot-chip.status-implemented,
.aiot-chip.status-verified,
.aiot-chip.status-approved,
.aiot-chip.status-synced,
.aiot-chip.status-healthy,
.aiot-chip.maturity-ready,
.aiot-chip.governance {
  background: rgba(16,185,129,0.14);
  color: var(--green);
}
.aiot-chip.status-draft,
.aiot-chip.status-created,
.aiot-chip.status-planned,
.aiot-chip.status-in_progress,
.aiot-chip.status-installing,
.aiot-chip.status-assigned,
.aiot-chip.status-processing,
.aiot-chip.status-pending_review,
.aiot-chip.status-pending,
.aiot-chip.status-queued,
.aiot-chip.status-submitted,
.aiot-chip.status-reviewing,
.aiot-chip.status-configured,
.aiot-chip.status-commissioning,
.aiot-chip.status-gray,
.aiot-chip.maturity-pilot {
  background: rgba(245,158,11,0.14);
  color: var(--yellow);
}
.aiot-chip.status-review,
.aiot-chip.maturity-poc,
.aiot-chip.commercial {
  background: rgba(6,182,212,0.14);
  color: var(--cyan);
}
.aiot-chip.status-revoked,
.aiot-chip.status-cancelled,
.aiot-chip.status-refunded {
  background: rgba(239,68,68,0.14);
  color: var(--red);
}
.aiot-chip.status-paused,
.aiot-chip.status-expired,
.aiot-chip.status-overdue,
.aiot-chip.status-rejected,
.aiot-chip.status-failed,
.aiot-chip.status-disabled,
.aiot-chip.status-degraded,
.aiot-chip.status-open,
.aiot-chip.status-blocked,
.aiot-chip.status-issue,
.aiot-chip.status-rollback,
.aiot-chip.maturity-later {
  background: rgba(100,116,139,0.16);
  color: var(--text-muted);
}
.aiot-chip.priority-P0 {
  background: rgba(239,68,68,0.18);
  color: var(--red);
}
.aiot-chip.priority-P1 {
  background: rgba(6,182,212,0.14);
  color: var(--cyan);
}
.aiot-panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 10px;
}
.aiot-chip.priority-S0 { background: rgba(239,68,68,0.18); color: var(--red); }
.aiot-chip.priority-S1 { background: rgba(249,115,22,0.18); color: var(--orange); }
.aiot-chip.priority-S2 { background: rgba(245,158,11,0.16); color: var(--yellow); }
.aiot-chip.priority-S3 { background: rgba(6,182,212,0.14); color: var(--cyan); }
.aiot-chip.priority-S4 { background: rgba(100,116,139,0.16); color: var(--text-muted); }

.aiot-event-card {
  padding: 14px;
  border-left: 3px solid var(--text-muted);
}
.aiot-event-card.level-P0 { border-left-color: var(--red); }
.aiot-event-card.level-P1 { border-left-color: var(--orange); }
.aiot-event-card.level-P2 { border-left-color: var(--yellow); }
.aiot-event-card.level-P3 { border-left-color: var(--cyan); }
.alert-level-badge.P3 { background: var(--cyan); color: #041018; }

.aiot-event-head > div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.aiot-event-evidence {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.aiot-event-evidence span {
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: rgba(0,0,0,0.14);
  color: var(--text-secondary);
  font-size: 0.72rem;
  min-width: 0;
}
.aiot-event-evidence b {
  display: block;
  color: var(--text-muted);
  font-size: 0.65rem;
  margin-bottom: 2px;
  font-weight: 500;
}
.aiot-event-actions {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 0.72rem;
}
.aiot-review-note {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.12);
  color: var(--green);
  font-size: 0.75rem;
}
.aiot-event-card .aiot-card-actions { margin-top: 12px; justify-content: flex-start; }

.entry-panel-form-card .aiot-chip-row {
  gap: 6px;
}

.entry-screen-state-list {
  display: grid;
  gap: 8px;
}

.entry-screen-state {
  min-height: 52px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--text-muted);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.entry-screen-state strong,
.entry-screen-state span {
  display: block;
}

.entry-screen-state strong {
  color: var(--text-primary);
  font-size: 0.82rem;
}

.entry-screen-state span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.35;
}

.entry-screen-state.priority-S0 { border-left-color: var(--red); }
.entry-screen-state.priority-S1 { border-left-color: var(--orange); }
.entry-screen-state.priority-S2 { border-left-color: var(--yellow); }
.entry-screen-state.priority-S3 { border-left-color: var(--cyan); }
.entry-screen-state.priority-S4 { border-left-color: var(--text-muted); }

.aiot-service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}
.aiot-service-card {
  padding: 12px;
}
.aiot-compliance {
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 0.72rem;
  line-height: 1.5;
}
.aiot-table-scroll {
  max-height: 360px;
  overflow: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}
.aiot-table th,
.aiot-table td {
  font-size: 0.76rem;
}
.aiot-audit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.03);
}
.aiot-audit-row strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.78rem;
  margin-bottom: 3px;
}
.aiot-audit-row span {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.aiot-poc-dashboard {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.aiot-poc-stat,
.aiot-poc-project,
.aiot-poc-installation,
.aiot-poc-check {
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.025);
  border-radius: 8px;
  padding: 12px;
}

.aiot-poc-stat span,
.aiot-poc-stat small {
  display: block;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.aiot-poc-stat strong {
  display: block;
  margin: 6px 0 4px;
  color: var(--text-primary);
  font-size: 1.25rem;
  line-height: 1.1;
}

.aiot-poc-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
  align-items: start;
}

.aiot-poc-projects,
.aiot-poc-installations,
.aiot-poc-check-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.aiot-poc-project {
  border-left: 3px solid var(--accent);
}

.aiot-poc-progress-row,
.aiot-poc-meter-row,
.aiot-poc-section-title,
.aiot-poc-check {
  display: flex;
  align-items: center;
}

.aiot-poc-progress-row {
  gap: 8px;
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 0.72rem;
}

.aiot-poc-progress-row span {
  width: 34px;
  color: var(--text-muted);
}

.aiot-poc-progress-row b {
  width: 38px;
  text-align: right;
  color: var(--text-secondary);
}

.aiot-poc-progress {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
}

.aiot-poc-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--accent-light));
}

.aiot-poc-progress.accepted i {
  background: linear-gradient(90deg, var(--green), #34d399);
}

.aiot-poc-installation {
  border-left: 3px solid var(--accent);
}

.aiot-poc-installation.stage-accepted { border-left-color: var(--green); }
.aiot-poc-installation.stage-commissioning { border-left-color: var(--cyan); }
.aiot-poc-installation.stage-installing { border-left-color: var(--accent-light); }
.aiot-poc-installation.stage-issue { border-left-color: var(--red); }
.aiot-poc-installation.stage-planned { border-left-color: var(--text-muted); }

.aiot-poc-meter-row {
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.aiot-poc-meter-row span {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.045);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.68rem;
}

.aiot-poc-install-note {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.aiot-poc-section-title {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.aiot-poc-section-title strong {
  color: var(--text-primary);
  font-size: 0.86rem;
}

.aiot-poc-section-title span {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.aiot-poc-check {
  justify-content: space-between;
  gap: 12px;
}

.aiot-poc-check strong,
.aiot-poc-check span {
  display: block;
}

.aiot-poc-check strong {
  color: var(--text-primary);
  font-size: 0.78rem;
  margin-bottom: 3px;
}

.aiot-poc-check span {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.aiot-security-project {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.aiot-security-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 220px);
  gap: 14px;
  align-items: stretch;
}

.aiot-security-hero,
.aiot-security-target,
.aiot-security-column {
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.025);
  border-radius: 8px;
  padding: 12px;
}

.aiot-security-target span,
.aiot-security-target small {
  display: block;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.aiot-security-target strong {
  display: block;
  margin: 8px 0 4px;
  color: var(--text-primary);
  font-size: 1.7rem;
  line-height: 1;
}

.aiot-security-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.aiot-security-column .aiot-card-list {
  max-height: 520px;
  overflow: auto;
  padding-right: 2px;
}

.security-platform-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.security-platform-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border: 1px solid rgba(99,102,241,0.18);
  border-radius: 8px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(99,102,241,0.14), rgba(6,182,212,0.06)),
    rgba(255,255,255,0.025);
}

.security-platform-head span {
  display: block;
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.security-platform-head h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.45rem;
  line-height: 1.25;
}

.security-platform-head p {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.55;
  max-width: 760px;
}

.security-platform-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(16,185,129,0.22);
  border-radius: 8px;
  background: rgba(16,185,129,0.12);
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 700;
}

.security-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.security-tab {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: rgba(255,255,255,0.035);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.security-tab:hover,
.security-tab.active {
  border-color: rgba(99,102,241,0.36);
  background: rgba(99,102,241,0.16);
  color: var(--text-primary);
}

.security-section {
  display: grid;
  gap: 14px;
}

.security-control-kpis {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

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

.security-bridge-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255,255,255,0.03);
}

.security-bridge-card span,
.security-bridge-card small {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.security-bridge-card strong {
  display: block;
  margin: 6px 0;
  color: var(--text-primary);
  font-size: 0.98rem;
  line-height: 1.35;
}

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

.security-section-head.compact {
  margin-top: 4px;
}

.security-section-head strong {
  color: var(--text-primary);
  font-size: 0.95rem;
}

.security-section-head span {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.security-table {
  display: grid;
  gap: 8px;
}

.security-table-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.35fr) minmax(120px, 0.9fr) minmax(110px, 0.7fr) minmax(130px, 0.9fr) minmax(160px, auto);
  gap: 10px;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255,255,255,0.025);
}

.security-table-row.head {
  background: rgba(255,255,255,0.045);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.security-table-row > span {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.security-table-row strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.82rem;
}

.security-table-row small {
  display: block;
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1.4;
  margin-top: 3px;
}

.security-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.security-qr-box,
.security-endpoint {
  min-height: 40px;
  border: 1px solid rgba(148,163,184,0.12);
  border-radius: 8px;
  padding: 10px;
  background: rgba(2,6,23,0.24);
  color: var(--text-secondary);
  font-size: 0.72rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.security-qr-box code {
  color: #a7f3d0;
  font-size: 0.7rem;
  white-space: normal;
}

body.security-control-app #page-aiot .v2-function-map,
body.security-control-app #page-aiot .page-toolbar,
body.security-control-app #page-aiot .stats-grid.aiot-stats-grid,
body.security-control-app #page-aiot .panel:not(#securityControlProjectPanel) {
  display: none !important;
}

body.security-control-app #securityControlProjectPanel {
  margin-top: 0;
}

body.security-control-app .app-layout {
  display: block;
  height: 100vh;
}

body.security-control-app .sidebar {
  display: none;
}

body.security-control-app .main-content {
  width: 100vw;
  height: 100vh;
}

body.security-control-app .topbar {
  padding: 0 28px;
}

body.security-control-app .menu-toggle,
body.security-control-app .breadcrumb-home,
body.security-control-app .breadcrumb-sep {
  display: none;
}

body.security-control-app .page-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 28px;
}

body.security-control-app .topbar-left {
  min-width: 0;
}

body.security-control-app .breadcrumb-current {
  font-size: 0.96rem;
}

.aiot-orchestration-dashboard {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.aiot-orchestration-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

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

.aiot-orchestration-grid.lower {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
}

.aiot-orchestration-section,
.aiot-launch-checks {
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.02);
  border-radius: 8px;
  padding: 12px;
  min-width: 0;
}

.aiot-shadow-list,
.aiot-state-session-list,
.aiot-eca-rule-list,
.aiot-event-mapping-list,
.aiot-launch-check-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.aiot-shadow-card,
.aiot-state-session,
.aiot-eca-rule,
.aiot-event-mapping,
.aiot-launch-check {
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.025);
  border-radius: 8px;
  padding: 10px;
  min-width: 0;
}

.aiot-shadow-card {
  border-left: 3px solid var(--green);
}

.aiot-shadow-card.drift-yes {
  border-left-color: var(--orange);
}

.aiot-state-session,
.aiot-eca-rule,
.aiot-launch-check {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.aiot-state-session.priority-S0 { border-left: 3px solid var(--red); }
.aiot-state-session.priority-S1 { border-left: 3px solid var(--orange); }
.aiot-state-session.priority-S2 { border-left: 3px solid var(--yellow); }
.aiot-state-session.priority-S3 { border-left: 3px solid var(--cyan); }
.aiot-state-session.priority-S4 { border-left: 3px solid var(--text-muted); }

.aiot-eca-rule.enabled {
  border-left: 3px solid var(--green);
}

.aiot-eca-rule.disabled {
  border-left: 3px solid var(--text-muted);
  opacity: 0.78;
}

.aiot-rule-logic {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.aiot-rule-logic span {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 0.74rem;
  line-height: 1.35;
  word-break: break-word;
}

.aiot-rule-logic b {
  color: var(--text-muted);
  font-size: 0.68rem;
}

.aiot-rule-modal {
  width: min(860px, calc(100vw - 28px));
}

.aiot-rule-textarea {
  min-height: 130px;
  font-family: var(--mono-font, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
  font-size: 0.78rem;
  line-height: 1.5;
}

.aiot-rule-textarea.small {
  min-height: 72px;
}

.aiot-event-mapping {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.1fr) auto;
  align-items: center;
  gap: 8px;
}

.aiot-event-mapping b {
  color: var(--text-muted);
  font-weight: 600;
}

.aiot-event-mapping em {
  justify-self: end;
  font-style: normal;
}

.aiot-launch-check {
  align-items: center;
}

.aiot-launch-check.status-passed {
  border-left: 3px solid var(--green);
}

.aiot-launch-check.status-risk,
.aiot-launch-check.status-failed {
  border-left: 3px solid var(--orange);
}

.aiot-launch-check.status-pending {
  border-left: 3px solid var(--text-muted);
}

.aiot-launch-check strong,
.aiot-launch-check span {
  display: block;
}

.aiot-launch-check strong {
  color: var(--text-primary);
  font-size: 0.78rem;
  line-height: 1.35;
}

.aiot-launch-check span {
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.45;
  margin-top: 3px;
}

.aiot-launch-check-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.aiot-fast-bus-dashboard {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.aiot-fast-bus-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.aiot-fast-bus-summary .latency-ok {
  color: var(--green);
}

.aiot-fast-bus-summary .latency-warn {
  color: var(--orange);
}

.aiot-fast-bus-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

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

.aiot-fast-bus-section {
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.02);
  border-radius: 8px;
  padding: 12px;
  min-width: 0;
}

.aiot-fast-trace-list,
.aiot-material-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.aiot-fast-trace,
.aiot-material-card {
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.025);
  border-radius: 8px;
  padding: 10px;
  min-width: 0;
}

.aiot-fast-trace {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-left: 3px solid var(--green);
}

.aiot-fast-trace.warn {
  border-left-color: var(--orange);
}

.aiot-fast-trace strong,
.aiot-fast-trace span,
.aiot-material-card strong,
.aiot-material-card span,
.aiot-material-card code {
  display: block;
}

.aiot-fast-trace strong,
.aiot-material-card strong {
  color: var(--text-primary);
  font-size: 0.78rem;
  line-height: 1.35;
}

.aiot-fast-trace span,
.aiot-material-card span {
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.45;
  margin-top: 3px;
}

.aiot-fast-trace b {
  flex-shrink: 0;
  color: var(--green);
  font-size: 1rem;
}

.aiot-fast-trace.warn b {
  color: var(--orange);
}

.aiot-material-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-left: 3px solid var(--cyan);
}

.aiot-material-card > div {
  min-width: 0;
}

.aiot-material-card code {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 0.68rem;
  margin-top: 5px;
}

/* ============================================================
   ENTRY PANEL WORKBENCH
   ============================================================ */
.entry-workbench { display: flex; flex-direction: column; gap: 16px; }

.entry-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.entry-eyebrow {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-xs);
  background: rgba(99,102,241,0.14);
  color: var(--accent-light);
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.entry-hero h2 {
  font-size: 1.45rem;
  letter-spacing: 0;
  margin-bottom: 6px;
}

.entry-hero p {
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.5;
  max-width: 720px;
}

.entry-hero-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.entry-hero-actions .filter-select { min-width: 300px; }

.entry-refresh-status {
  min-width: 180px;
  max-width: 360px;
  padding: 7px 9px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(99,102,241,0.18);
  background: rgba(99,102,241,0.08);
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

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

.entry-flow-step {
  min-height: 88px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition), background var(--transition);
}

.entry-flow-step:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: rgba(99,102,241,0.08);
}

.entry-flow-step span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(99,102,241,0.16);
  color: var(--accent-light);
  font-size: 0.72rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.entry-flow-step strong,
.entry-flow-step small { display: block; }
.entry-flow-step strong { font-size: 0.84rem; margin-bottom: 4px; }
.entry-flow-step small { color: var(--text-muted); font-size: 0.68rem; line-height: 1.35; }

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

.entry-summary-card {
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  min-height: 94px;
}

.entry-summary-card span,
.entry-summary-card small {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.entry-summary-card strong {
  display: block;
  margin: 8px 0 5px;
  font-size: 1.35rem;
  letter-spacing: 0;
}

.entry-summary-card small.success,
.entry-panel-list-item em.success { color: var(--green); }
.entry-summary-card small.warning,
.entry-panel-list-item em.warning { color: var(--yellow); }
.entry-summary-card small.muted,
.entry-panel-list-item em.muted { color: var(--text-muted); }

.entry-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.72fr);
  gap: 16px;
}

.entry-main-column,
.entry-side-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

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

.entry-panel-head h3 { font-size: 1rem; margin-bottom: 5px; }
.entry-panel-head p { color: var(--text-secondary); font-size: 0.78rem; }

.entry-panel-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.entry-panel-facts span {
  min-height: 34px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.035);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.72rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.entry-action-board,
.entry-workflow-row,
.entry-fast-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.entry-screen-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.entry-content-hero {
  padding: 12px;
  border: 1px solid rgba(6,182,212,0.16);
  border-radius: var(--radius-xs);
  background: rgba(6,182,212,0.07);
}

.entry-content-hero strong,
.entry-content-hero span {
  display: block;
  overflow-wrap: anywhere;
}

.entry-content-hero strong {
  color: var(--text-primary);
  font-size: 0.92rem;
  margin-bottom: 5px;
}

.entry-content-hero span {
  color: var(--text-secondary);
  font-size: 0.72rem;
}

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

.entry-content-specs div {
  min-width: 0;
  padding: 9px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.035);
}

.entry-content-specs span,
.entry-content-specs strong,
.entry-content-specs small {
  display: block;
  overflow-wrap: anywhere;
}

.entry-content-specs span {
  color: var(--text-muted);
  font-size: 0.66rem;
  margin-bottom: 4px;
}

.entry-content-specs strong {
  color: var(--text-primary);
  font-size: 0.78rem;
}

.entry-content-specs small {
  color: var(--text-muted);
  font-size: 0.62rem;
  margin-top: 4px;
}

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

.entry-rule-snippets {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.entry-rule-snippets button {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-xs);
  background: rgba(15,23,42,0.55);
  color: var(--text-secondary);
  text-align: left;
  padding: 9px;
  cursor: pointer;
}

.entry-rule-snippets button strong,
.entry-rule-snippets button span {
  display: block;
  overflow-wrap: anywhere;
}

.entry-rule-snippets button strong {
  color: var(--text-primary);
  font-size: 0.76rem;
  margin-bottom: 4px;
}

.entry-rule-snippets button span {
  color: var(--text-muted);
  font-size: 0.66rem;
}

.entry-state-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.entry-state-btn {
  min-height: 58px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.035);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  padding: 9px 10px;
}

.entry-state-btn b,
.entry-state-btn span { display: block; }
.entry-state-btn b { margin-bottom: 5px; font-size: 0.78rem; }
.entry-state-btn span {
  color: var(--text-secondary);
  font-size: 0.68rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-state-btn.priority-S0 { border-left: 3px solid var(--red); }
.entry-state-btn.priority-S1 { border-left: 3px solid var(--orange); }
.entry-state-btn.priority-S2 { border-left: 3px solid var(--yellow); }
.entry-state-btn.priority-S3 { border-left: 3px solid var(--cyan); }
.entry-state-btn.priority-S4 { border-left: 3px solid var(--text-muted); }

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

.entry-topic-list div {
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: rgba(6,182,212,0.06);
  border: 1px solid rgba(6,182,212,0.12);
  min-width: 0;
}

.entry-topic-list b,
.entry-topic-list code { display: block; }
.entry-topic-list b { color: var(--cyan); font-size: 0.7rem; margin-bottom: 5px; }
.entry-topic-list code {
  color: var(--text-secondary);
  font-size: 0.68rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.entry-history-column {
  min-width: 0;
}

.entry-section-title {
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.entry-history-grid .aiot-card-list {
  max-height: 560px;
  overflow-y: auto;
  padding-right: 5px;
  scroll-behavior: smooth;
}

.entry-history-grid .aiot-card-list::-webkit-scrollbar {
  width: 6px;
}

.entry-history-grid .aiot-card-list::-webkit-scrollbar-thumb {
  background: rgba(148,163,184,0.34);
  border-radius: 999px;
}

.entry-capture-preview-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.entry-capture-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.entry-capture-expand-btn {
  padding: 5px 9px;
  font-size: 0.68rem;
}

.entry-capture-hidden-note {
  color: var(--text-muted);
  font-size: 0.66rem;
}

.entry-fast-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.entry-fast-metrics div {
  padding: 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.035);
}

.entry-fast-metrics span,
.entry-fast-metrics strong { display: block; }
.entry-fast-metrics span { color: var(--text-muted); font-size: 0.68rem; margin-bottom: 4px; }
.entry-fast-metrics strong { font-size: 1rem; }

.entry-fast-traces,
.entry-module-map,
.entry-panel-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.entry-module-link,
.entry-panel-list-item {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.035);
  color: var(--text-primary);
  text-align: left;
  padding: 10px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.entry-module-link:hover,
.entry-panel-list-item:hover,
.entry-panel-list-item.active {
  border-color: var(--accent);
  background: rgba(99,102,241,0.08);
}

.entry-module-link strong,
.entry-module-link span,
.entry-panel-list-item strong,
.entry-panel-list-item span,
.entry-panel-list-item em { display: block; }
.entry-module-link strong,
.entry-panel-list-item strong { font-size: 0.8rem; margin-bottom: 4px; }
.entry-module-link span,
.entry-panel-list-item span { color: var(--text-secondary); font-size: 0.7rem; line-height: 1.35; }
.entry-panel-list-item em { margin-top: 6px; font-style: normal; font-size: 0.68rem; font-weight: 700; }

/* ============================================================
   DIGITAL TWIN
   ============================================================ */
.digital-twin-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.digital-twin-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}

.digital-twin-header h3,
.digital-twin-stage-head h3 {
  margin: 0 0 6px;
  font-size: 1.32rem;
  letter-spacing: 0;
}

.digital-twin-header p,
.digital-twin-stage-head p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.84rem;
  line-height: 1.5;
}

.digital-twin-actions {
  display: grid;
  grid-template-columns: 180px 220px minmax(220px, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: min(860px, 58vw);
}

.digital-twin-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.digital-twin-summary-card {
  min-height: 98px;
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}

.digital-twin-summary-card span,
.digital-twin-summary-card small {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.digital-twin-summary-card strong {
  display: block;
  margin: 8px 0 5px;
  font-size: 1.18rem;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.digital-twin-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 16px;
  min-height: 680px;
}

.digital-twin-rail,
.digital-twin-stage {
  min-width: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}

.digital-twin-rail {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.digital-twin-rail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--border-color);
}

.digital-twin-rail-head strong {
  font-size: 0.86rem;
}

.digital-twin-object-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  overflow-y: auto;
  max-height: 820px;
}

.digital-twin-object-list::-webkit-scrollbar,
.twin-scroll-history .aiot-card-list::-webkit-scrollbar {
  width: 6px;
}

.digital-twin-object-list::-webkit-scrollbar-thumb,
.twin-scroll-history .aiot-card-list::-webkit-scrollbar-thumb {
  background: rgba(148,163,184,0.34);
  border-radius: 999px;
}

.digital-twin-object-card {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 4px 10px;
  padding: 11px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.035);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.digital-twin-object-card:hover,
.digital-twin-object-card.active {
  border-color: var(--accent);
  background: rgba(99,102,241,0.08);
}

.digital-twin-object-card:hover {
  transform: translateY(-1px);
}

.digital-twin-object-icon {
  grid-row: 1 / 5;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255,255,255,0.06);
  font-size: 0.82rem;
  font-weight: 800;
}

.digital-twin-object-card strong,
.digital-twin-object-card small,
.digital-twin-object-card em,
.digital-twin-mini-status {
  display: block;
  min-width: 0;
}

.digital-twin-object-card strong {
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.digital-twin-object-card small,
.digital-twin-object-card em {
  color: var(--text-secondary);
  font-size: 0.68rem;
  line-height: 1.3;
  font-style: normal;
  overflow-wrap: anywhere;
}

.digital-twin-mini-status {
  width: fit-content;
  margin-top: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 700;
  background: rgba(148,163,184,0.12);
  color: var(--text-muted);
}

.digital-twin-mini-status.success { color: var(--green); background: rgba(34,197,94,0.12); }
.digital-twin-mini-status.warning { color: var(--yellow); background: rgba(245,158,11,0.12); }
.digital-twin-mini-status.muted { color: var(--text-muted); }

.digital-twin-stage {
  padding: 16px;
  overflow: hidden;
}

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

.digital-twin-stage-actions,
.digital-twin-actions {
  flex-shrink: 0;
}

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

.twin-device-agent-form .ai-native-tool-actions {
  align-items: stretch;
  flex-wrap: wrap;
}

.twin-agent-result-card .ai-native-rule-meta,
.twin-agent-summary-grid {
  grid-template-columns: 1fr;
}

.twin-agent-result-card .ai-native-flow-step {
  align-items: start;
}

.face-panel-twin-grid {
  display: grid;
  grid-template-columns: minmax(300px, 440px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.face-panel-device-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.face-panel-device {
  position: relative;
  width: min(100%, 380px);
  margin: 0 auto;
  aspect-ratio: 9 / 16;
  padding: 36px 20px 22px;
  border-radius: 28px;
  border: 1px solid rgba(148,163,184,0.38);
  background: linear-gradient(180deg, #111827 0%, #020617 100%);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,0.04), 0 22px 50px rgba(0,0,0,0.32);
}

.face-panel-camera {
  position: absolute;
  top: 13px;
  left: 50%;
  width: 14px;
  height: 14px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at 45% 45%, #67e8f9, #0f172a 62%);
  border: 1px solid rgba(125,211,252,0.55);
}

.face-panel-speaker {
  position: absolute;
  top: 18px;
  right: 86px;
  width: 42px;
  height: 4px;
  border-radius: 99px;
  background: rgba(148,163,184,0.36);
}

.face-panel-screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: 16px;
  border: 1px solid rgba(96,165,250,0.2);
  background: #07111f;
  padding: 12px;
  overflow: hidden;
}

.twin-screen-status-row,
.twin-screen-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.62rem;
  line-height: 1.25;
}

.twin-screen-state {
  font-weight: 800;
  color: var(--cyan);
}

.twin-screen-state.priority-S0 { color: var(--red); }
.twin-screen-state.priority-S1 { color: var(--orange); }
.twin-screen-state.priority-S2 { color: var(--yellow); }
.twin-screen-state.priority-S3 { color: var(--cyan); }
.twin-screen-state.priority-S4 { color: var(--text-secondary); }

.twin-device-screen-inner {
  --screen-accent: #0ea5e9;
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 13px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--screen-accent), white 12%);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--screen-accent), #020617 70%) 0%, #020617 100%);
}

.twin-screen-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #020617;
}

.twin-screen-face-box {
  z-index: 3;
}

.twin-screen-visual-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(2,6,23,0.72);
  border: 1px solid rgba(255,255,255,0.16);
  color: var(--text-primary);
  font-size: 0.62rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.twin-screen-resource {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 18px;
  text-align: center;
}

.twin-screen-resource small {
  color: var(--cyan);
  font-size: 0.7rem;
  font-weight: 800;
}

.twin-screen-resource code {
  display: block;
  padding: 8px;
  border-radius: var(--radius-xs);
  background: rgba(0,0,0,0.28);
  color: var(--text-primary);
  font-size: 0.68rem;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

.twin-screen-resource span {
  color: var(--text-muted);
  font-size: 0.66rem;
  line-height: 1.4;
}

.twin-screen-resource .twin-resource-fetch-btn {
  align-self: center;
  margin-top: 2px;
}

.twin-screen-text {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  text-align: center;
}

.twin-screen-text b {
  font-size: 1.35rem;
  line-height: 1.2;
}

.twin-screen-text span {
  color: rgba(226,232,240,0.78);
  font-size: 0.86rem;
  line-height: 1.45;
}

.twin-screen-meta {
  flex-wrap: wrap;
}

.face-panel-home-strip {
  display: grid;
  grid-template-columns: 1fr 42px 1fr;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 0.68rem;
}

.face-panel-home-strip b {
  display: grid;
  place-items: center;
  height: 28px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
}

.face-panel-home-strip span:last-child {
  text-align: right;
}

.twin-device-visual-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: rgba(15,23,42,0.42);
}

.twin-device-visual-strip.empty {
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.twin-device-visual-strip.empty span {
  color: var(--text-primary);
  font-weight: 800;
}

.twin-device-visual-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.twin-device-visual-title strong {
  color: var(--text-primary);
  font-size: 0.78rem;
}

.twin-device-visual-title small {
  color: var(--text-muted);
  font-size: 0.66rem;
}

.twin-device-visual-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
}

.twin-visual-thumb {
  position: relative;
  min-width: 0;
  margin: 0;
  border: 1px solid rgba(148,163,184,0.18);
  border-radius: var(--radius-xs);
  overflow: hidden;
  background: rgba(0,0,0,0.16);
}

.twin-visual-thumb-preview {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.twin-thumb-face-box {
  z-index: 2;
}

.twin-visual-thumb img {
  width: 100%;
  aspect-ratio: 9 / 12;
  object-fit: contain;
  display: block;
  background: #020617;
}

.twin-visual-thumb figcaption {
  padding: 5px 6px;
  color: var(--text-secondary);
  font-size: 0.64rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.twin-visual-actions {
  padding: 0 6px 6px;
}

.twin-visual-actions .btn {
  flex: 1 1 44px;
  min-width: 0;
  padding: 4px 5px;
  font-size: 0.6rem;
}

.twin-visual-resource {
  min-width: 0;
  padding: 8px;
  border-radius: var(--radius-xs);
  border: 1px dashed rgba(148,163,184,0.22);
  background: rgba(0,0,0,0.14);
}

.twin-visual-resource span,
.twin-visual-resource small {
  display: block;
  color: var(--text-muted);
  font-size: 0.64rem;
  line-height: 1.35;
}

.twin-visual-resource span {
  color: var(--text-secondary);
  font-weight: 800;
}

.twin-visual-resource code {
  display: block;
  margin: 5px 0;
  color: var(--text-primary);
  font-size: 0.64rem;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

.twin-resource-fetch-btn {
  width: fit-content;
  min-height: 28px;
  margin-top: 6px;
  padding: 5px 9px;
  font-size: 0.66rem;
  line-height: 1;
}

.twin-resource-export-btn {
  width: fit-content;
  min-height: 28px;
  margin-top: 6px;
  padding: 5px 9px;
  font-size: 0.66rem;
  line-height: 1;
}

.twin-visual-resource.locked {
  border-color: rgba(245,158,11,0.25);
  background: rgba(245,158,11,0.07);
}

.face-panel-hardware-grid,
.twin-status-board,
.generic-twin-facts,
.twin-attr-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.face-panel-hardware-grid div,
.twin-status-item,
.generic-twin-facts div,
.twin-attr-item {
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.035);
}

.face-panel-hardware-grid span,
.twin-status-item span,
.generic-twin-facts span,
.twin-attr-item span {
  display: block;
  color: var(--text-muted);
  font-size: 0.66rem;
  margin-bottom: 5px;
}

.face-panel-hardware-grid strong,
.twin-status-item strong,
.generic-twin-facts strong,
.twin-attr-item strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.twin-status-item.success { border-color: rgba(34,197,94,0.34); }
.twin-status-item.warning { border-color: rgba(245,158,11,0.36); }

.face-panel-twin-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.twin-command-board {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.twin-feature-workbench {
  margin-top: 16px;
}

.twin-feature-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.035);
}

.twin-feature-intro > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.twin-feature-intro strong {
  color: var(--text-primary);
  font-size: 0.84rem;
}

.twin-feature-intro small {
  color: var(--text-muted);
  line-height: 1.45;
}

.twin-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 12px;
}

.twin-feature-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: rgba(15,23,42,0.42);
}

.twin-feature-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.twin-feature-icon {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(99,102,241,0.14);
  border: 1px solid rgba(99,102,241,0.22);
  color: var(--accent-light);
  font-weight: 800;
}

.twin-feature-card-head > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.twin-feature-card-head strong {
  color: var(--text-primary);
  font-size: 0.88rem;
}

.twin-feature-card-head small,
.twin-feature-preview small,
.twin-feature-empty {
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.45;
}

.twin-feature-preview {
  min-height: 92px;
  padding: 9px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(148,163,184,0.16);
  background: rgba(0,0,0,0.14);
}

.twin-banner-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.twin-banner-metrics div,
.twin-banner-rule-list span {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-xs);
  background: rgba(15,23,42,0.5);
}

.twin-banner-metrics span,
.twin-banner-metrics strong,
.twin-banner-rule-list strong,
.twin-banner-rule-list small {
  display: block;
}

.twin-banner-metrics span {
  color: var(--text-muted);
  font-size: 0.66rem;
  margin-bottom: 4px;
}

.twin-banner-metrics strong {
  color: var(--text-primary);
  font-size: 1rem;
}

.twin-current-banner {
  display: grid;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(14,165,233,0.24);
  background: linear-gradient(180deg, rgba(14,165,233,0.08), rgba(15,23,42,0.38));
}

.twin-current-banner.empty {
  border-style: dashed;
  background: rgba(255,255,255,0.025);
}

.twin-current-banner-head,
.twin-current-banner-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.twin-current-banner-head span,
.twin-current-banner-meta span {
  color: var(--text-muted);
  font-size: 0.66rem;
}

.twin-current-banner-head strong {
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--text-primary);
  font-size: 0.66rem;
  background: rgba(148,163,184,0.16);
}

.twin-current-banner.active .twin-current-banner-head strong {
  color: #bbf7d0;
  background: rgba(34,197,94,0.18);
}

.twin-current-banner.expired .twin-current-banner-head strong {
  color: #fde68a;
  background: rgba(245,158,11,0.18);
}

.twin-current-banner.cleared .twin-current-banner-head strong {
  color: #fecaca;
  background: rgba(239,68,68,0.18);
}

.twin-current-banner-visual {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(255,255,255,0.08);
  background: #020617;
  aspect-ratio: 20 / 9;
}

.twin-current-banner-visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.twin-current-banner-text,
.twin-current-banner-resource {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  padding: 12px;
  text-align: center;
}

.twin-current-banner-text b,
.twin-current-banner-info strong {
  color: var(--text-primary);
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.twin-current-banner-text span,
.twin-current-banner-resource span,
.twin-current-banner-info span {
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.twin-current-banner-resource code {
  color: var(--text-secondary);
  font-size: 0.66rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

.twin-current-banner-info {
  display: grid;
  gap: 3px;
}

.twin-banner-rule-list,
.twin-banner-traces {
  display: grid;
  gap: 7px;
}

.twin-banner-rule-list strong {
  color: var(--text-primary);
  font-size: 0.74rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.twin-banner-rule-list small {
  color: var(--text-muted);
  font-size: 0.66rem;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.twin-banner-type-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.twin-banner-type-row b {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(99,102,241,0.24);
  background: rgba(99,102,241,0.12);
  color: var(--text-secondary);
  font-size: 0.66rem;
}

.twin-feature-empty {
  min-height: 72px;
  display: flex;
  align-items: center;
  padding: 10px;
  border: 1px dashed rgba(148,163,184,0.22);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.025);
}

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

.twin-feature-actions .btn {
  min-height: 30px;
}

.twin-feature-actions .danger {
  border-color: rgba(239,68,68,0.28);
  color: var(--red);
}

.twin-feature-atoms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 2px;
}

.twin-feature-atoms > span {
  max-width: 100%;
}

.twin-screen-state-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.entry-state-btn.active {
  border-color: var(--accent);
  background: rgba(99,102,241,0.12);
}

.twin-topic-list {
  margin-top: 0;
}

.digital-twin-lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 16px;
  margin-top: 16px;
}

.twin-feedback-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.twin-feedback-card {
  min-height: 86px;
  padding: 11px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.035);
}

.twin-feedback-card > span,
.twin-feedback-card small {
  display: block;
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1.35;
}

.twin-feedback-card strong {
  display: block;
  margin: 7px 0 4px;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.twin-feedback-card .face-event-image-thumb,
.twin-feedback-card .face-event-image-locked,
.twin-feedback-card .face-event-image-wrap {
  margin-top: 8px;
}

.twin-scroll-history {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.twin-scroll-history .aiot-card-list {
  max-height: 520px;
  overflow-y: auto;
  padding-right: 5px;
}

.twin-shadow-panel {
  margin-top: 16px;
}

.twin-shadow-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.035);
  margin-bottom: 12px;
}

.twin-shadow-toolbar > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.twin-shadow-toolbar strong {
  font-size: 0.82rem;
}

.twin-shadow-toolbar small {
  color: var(--text-muted);
  line-height: 1.4;
}

.twin-shadow-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.twin-shadow-summary > div {
  padding: 9px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  background: rgba(15,23,42,0.42);
}

.twin-shadow-summary span,
.twin-shadow-core-card span,
.twin-shadow-core-card small,
.twin-shadow-result-card small {
  display: block;
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1.35;
}

.twin-shadow-summary strong {
  display: block;
  margin-top: 5px;
  font-size: 0.82rem;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.twin-shadow-core-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.twin-shadow-core-card,
.twin-shadow-result-card {
  min-width: 0;
  padding: 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.03);
}

.twin-shadow-core-card.wide {
  grid-column: span 2;
}

.twin-shadow-core-card.status-ack,
.twin-shadow-core-card.status-success,
.twin-shadow-result-card.status-ack,
.twin-shadow-result-card.status-success {
  border-color: rgba(34,197,94,0.24);
}

.twin-shadow-core-card.status-failed,
.twin-shadow-result-card.status-failed {
  border-color: rgba(239,68,68,0.28);
}

.twin-shadow-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.twin-shadow-card-head strong,
.twin-shadow-core-card > strong {
  color: var(--text-primary);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.twin-shadow-card-head em {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(99,102,241,0.12);
  color: var(--accent);
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 800;
}

.twin-shadow-edit-btn {
  width: fit-content;
  margin-top: 8px;
}

.twin-advanced-note {
  padding: 9px 10px;
  margin-bottom: 10px;
  border: 1px solid rgba(6,182,212,0.14);
  border-radius: var(--radius-xs);
  background: rgba(6,182,212,0.06);
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.twin-shadow-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0;
}

.twin-shadow-facts > div {
  min-width: 0;
  padding: 6px;
  border-radius: var(--radius-xs);
  background: rgba(0,0,0,0.14);
}

.twin-shadow-facts strong {
  display: block;
  margin-top: 3px;
  font-size: 0.68rem;
  overflow-wrap: anywhere;
}

.twin-system-structured {
  margin: 8px 0;
}

.twin-system-facts,
.twin-system-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.twin-system-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.aiot-card .twin-system-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.twin-system-fact,
.twin-system-metric {
  min-width: 0;
  padding: 7px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(148,163,184,0.12);
  background: rgba(2,6,23,0.22);
}

.twin-system-fact span,
.twin-system-metric span,
.twin-system-disk-row span {
  display: block;
  color: var(--text-muted);
  font-size: 0.66rem;
  line-height: 1.35;
}

.twin-system-fact strong,
.twin-system-metric strong {
  display: block;
  margin-top: 3px;
  color: var(--text-primary);
  font-size: 0.72rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.twin-system-metric small {
  display: block;
  min-height: 1.1em;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.62rem;
  overflow-wrap: anywhere;
}

.twin-system-meter,
.twin-system-disk-bar {
  height: 5px;
  overflow: hidden;
  margin-top: 6px;
  border-radius: 999px;
  background: rgba(148,163,184,0.14);
}

.twin-system-meter i,
.twin-system-disk-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--accent));
}

.twin-system-disk-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.twin-system-disk-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 8px;
  padding: 7px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(148,163,184,0.12);
  background: rgba(0,0,0,0.12);
}

.twin-system-disk-row strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.7rem;
  overflow-wrap: anywhere;
}

.twin-system-disk-row em {
  color: var(--cyan);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 800;
}

.twin-system-disk-bar {
  grid-column: 1 / -1;
  margin-top: 0;
}

.twin-shadow-section-list {
  max-height: 680px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 5px;
}

.twin-shadow-section {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.025);
  padding: 10px;
}

.twin-shadow-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.twin-shadow-result-card p {
  margin: 7px 0;
  color: var(--text-secondary);
  font-size: 0.72rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.twin-shadow-output {
  margin-top: 8px;
}

.twin-shadow-output summary {
  cursor: pointer;
  color: var(--cyan);
  font-size: 0.7rem;
  font-weight: 800;
}

.twin-shadow-output pre {
  max-height: 220px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  background: rgba(2,6,23,0.55);
  color: var(--text-secondary);
  font-size: 0.68rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.twin-capability-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.twin-capability-group {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.035);
  padding: 10px;
}

.twin-capability-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.twin-capability-title strong {
  font-size: 0.78rem;
}

.twin-capability-title span {
  color: var(--text-muted);
  font-size: 0.66rem;
}

.twin-capability-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.twin-capability-list > span {
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(6,182,212,0.09);
  border: 1px solid rgba(6,182,212,0.12);
  color: var(--text-secondary);
  font-size: 0.66rem;
}

.twin-capability-command {
  width: 100%;
  min-height: 78px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 5px;
  padding: 8px 9px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(148,163,184,0.18);
  background: rgba(15,23,42,0.55);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition), background var(--transition);
}

.twin-capability-command:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(96,165,250,0.42);
  background: rgba(30,41,59,0.82);
}

.twin-capability-command:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.twin-capability-command strong,
.twin-capability-command small,
.twin-capability-command em {
  max-width: 100%;
}

.twin-capability-command strong {
  font-size: 0.66rem;
  line-height: 1.35;
}

.twin-capability-command small {
  color: var(--text-muted);
  font-size: 0.67rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.twin-capability-command em {
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 700;
}

.twin-capability-command.read em {
  color: var(--cyan);
  background: rgba(6,182,212,0.12);
}

.twin-capability-command.write em {
  color: var(--yellow);
  background: rgba(245,158,11,0.12);
}

.twin-capability-command.execute em,
.twin-capability-command.risk-high em {
  color: var(--red);
  background: rgba(239,68,68,0.12);
}

.twin-capability-command.risk-high {
  border-color: rgba(239,68,68,0.28);
}

.twin-relations {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.twin-relation-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.03);
}

.twin-relation-row span {
  color: var(--text-muted);
  font-size: 0.68rem;
}

.twin-relation-row strong {
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

.generic-twin-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.generic-twin-node {
  --node-color: #38bdf8;
  position: relative;
  min-height: 320px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--node-color), transparent 72%), rgba(255,255,255,0.025) 60%);
  overflow: hidden;
}

.generic-twin-orbit {
  position: absolute;
  width: 210px;
  height: 210px;
  border: 1px dashed color-mix(in srgb, var(--node-color), transparent 38%);
  border-radius: 50%;
}

.generic-twin-core {
  position: relative;
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: color-mix(in srgb, var(--node-color), #020617 74%);
  border: 1px solid color-mix(in srgb, var(--node-color), white 18%);
  color: var(--text-primary);
  font-size: 1.2rem;
  font-weight: 800;
}

.generic-twin-node strong,
.generic-twin-node span {
  position: relative;
  max-width: 86%;
  text-align: center;
  overflow-wrap: anywhere;
}

.generic-twin-node span {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.generic-twin-facts {
  align-self: stretch;
}

.generic-twin-facts div {
  min-height: 84px;
}

/* ============================================================
   AI INSIGHTS
   ============================================================ */
.insight-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}
.insight-item:last-child { border-bottom: none; }

.insight-level {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
}
.insight-level.P0 { background: linear-gradient(135deg, var(--red), #dc2626); }
.insight-level.P1 { background: linear-gradient(135deg, var(--orange), #ea580c); }
.insight-level.P2 { background: linear-gradient(135deg, var(--yellow), #d97706); }

.insight-content { flex: 1; min-width: 0; }
.insight-title { font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; color: var(--text-primary); }
.insight-desc { font-size: 0.75rem; color: var(--text-secondary); line-height: 1.5; }
.insight-ai { font-size: 0.72rem; color: var(--cyan); margin-top: 4px; line-height: 1.4; }
.insight-time { font-size: 0.65rem; color: var(--text-muted); margin-top: 4px; }

/* ============================================================
   EVENT TIMELINE
   ============================================================ */
.timeline-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
  align-items: flex-start;
}
.timeline-item:last-child { border-bottom: none; }

.timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}
.timeline-dot.info { background: var(--cyan); }
.timeline-dot.warning { background: var(--yellow); }
.timeline-dot.error { background: var(--red); }
.timeline-dot.critical { background: var(--red); box-shadow: 0 0 6px var(--red); }

.timeline-content { flex: 1; }
.timeline-title { font-weight: 500; color: var(--text-primary); margin-bottom: 2px; }
.timeline-desc { font-size: 0.72rem; color: var(--text-secondary); }
.timeline-time { font-size: 0.7rem; color: var(--text-muted); flex-shrink: 0; white-space: nowrap; }

/* ============================================================
   ROOM STATUS GRID
   ============================================================ */
.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.room-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.room-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-glow);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.room-card.anomaly { border-color: rgba(239, 68, 68, 0.3); }
.room-card.anomaly::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--red), var(--orange));
}

.room-card.warning { border-color: rgba(245, 158, 11, 0.3); }
.room-card.warning::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--yellow), var(--orange));
}

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

.room-number {
  font-weight: 700;
  font-size: 1rem;
}

.room-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.room-status-dot.online { background: var(--green); box-shadow: 0 0 6px var(--green); }
.room-status-dot.offline { background: var(--red); box-shadow: 0 0 6px var(--red); }
.room-status-dot.vacant { background: var(--text-muted); }

.room-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.room-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
}
.room-info-label { color: var(--text-muted); }
.room-info-value { color: var(--text-secondary); font-weight: 500; }
.room-info-value.alert { color: var(--red); font-weight: 700; }
.room-info-value.warn { color: var(--yellow); font-weight: 600; }

.room-card-sensors {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.sensor-indicator {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(6, 182, 212, 0.1);
  color: var(--cyan);
  display: flex;
  align-items: center;
  gap: 3px;
}
.sensor-indicator .s-dot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--green);
}
.sensor-indicator.off .s-dot { background: var(--red); }

/* ============================================================
   MAP PAGE
   ============================================================ */
.map-container {
  height: calc(100vh - var(--topbar-height) - 48px);
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
}

.map-toolbar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
}

.map-toolbar h3 { font-size: 0.9rem; font-weight: 600; }

.map-legend {
  display: flex;
  gap: 16px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.legend-dot.green { background: var(--green); box-shadow: 0 0 4px var(--green); }
.legend-dot.yellow { background: var(--yellow); box-shadow: 0 0 4px var(--yellow); }
.legend-dot.red { background: var(--red); box-shadow: 0 0 4px var(--red); }

.map-canvas {
  width: 100%;
  height: 100%;
  position: relative;
}
.map-leaflet-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
}
#leafletMap {
  width: 100%;
  height: 100%;
  z-index: 1;
}
#leafletMap.static-map-active {
  overflow: hidden;
  background:
    radial-gradient(circle at 42% 44%, rgba(16,185,129,0.16), transparent 22%),
    linear-gradient(135deg, #172235 0%, #111827 45%, #1c2432 100%);
}
.static-map-canvas {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  isolation: isolate;
}
.static-map-canvas::before {
  content: '';
  position: absolute;
  inset: -20%;
  background-image:
    linear-gradient(rgba(148,163,184,0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,163,184,0.10) 1px, transparent 1px);
  background-size: 46px 46px;
  transform: rotate(-8deg);
  opacity: 0.85;
}
.static-map-canvas::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 48% 48%, transparent 0 28%, rgba(2,6,23,0.28) 62%, rgba(2,6,23,0.58) 100%),
    linear-gradient(90deg, rgba(99,102,241,0.08), transparent 28%, rgba(6,182,212,0.08));
  pointer-events: none;
}
.static-map-river {
  position: absolute;
  left: 22%;
  top: -12%;
  width: 18%;
  height: 128%;
  transform: rotate(17deg);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(14,165,233,0.16), rgba(6,182,212,0.38), rgba(14,165,233,0.12));
  box-shadow: 0 0 34px rgba(6,182,212,0.18);
}
.static-map-road {
  position: absolute;
  z-index: 1;
  background: rgba(226,232,240,0.24);
  box-shadow: 0 0 0 1px rgba(15,23,42,0.42), 0 0 16px rgba(226,232,240,0.08);
}
.static-map-road-h { left: -6%; right: -6%; height: 9px; transform: rotate(-7deg); }
.static-map-road-v { top: -8%; bottom: -8%; width: 8px; transform: rotate(10deg); }
.static-map-road.road-1 { top: 28%; }
.static-map-road.road-2 { top: 53%; height: 12px; background: rgba(244,196,48,0.35); }
.static-map-road.road-3 { top: 75%; }
.static-map-road.road-4 { left: 34%; }
.static-map-road.road-5 { left: 56%; width: 11px; background: rgba(244,196,48,0.30); }
.static-map-road.road-6 { left: 76%; }
.static-map-district {
  position: absolute;
  z-index: 1;
  color: rgba(226,232,240,0.40);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0;
  pointer-events: none;
}
.district-dongcheng { left: 48%; top: 43%; }
.district-xicheng { left: 22%; top: 60%; }
.district-chaoyang { left: 72%; top: 48%; }
.static-map-mode-badge {
  position: absolute;
  left: 24px;
  bottom: 22px;
  z-index: 4;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  background: rgba(15,23,42,0.76);
  border: 1px solid rgba(148,163,184,0.22);
  color: var(--text-secondary);
  font-size: 0.72rem;
}
.static-building-marker {
  position: absolute;
  z-index: 5;
  transform: translate(-50%, -50%);
  border: 0;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.static-marker-dot {
  width: 26px;
  height: 26px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 6px 18px rgba(0,0,0,0.36);
  border: 2px solid rgba(255,255,255,0.62);
}
.static-building-marker.green .static-marker-dot { background: linear-gradient(135deg, var(--green), #059669); }
.static-building-marker.yellow .static-marker-dot { background: linear-gradient(135deg, var(--yellow), var(--orange)); }
.static-building-marker.red .static-marker-dot { background: linear-gradient(135deg, var(--red), #dc2626); }
.static-building-marker.selected .static-marker-dot,
.static-building-marker:hover .static-marker-dot {
  box-shadow: 0 0 0 8px rgba(99,102,241,0.18), 0 8px 24px rgba(0,0,0,0.45);
}
.static-marker-label {
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  background: rgba(15,23,42,0.82);
  border: 1px solid rgba(148,163,184,0.22);
}
.static-map-info {
  position: absolute;
  z-index: 6;
  right: 22px;
  bottom: 22px;
  width: min(300px, calc(100% - 44px));
  padding: 14px;
  border-radius: var(--radius-sm);
  background: rgba(15,23,42,0.86);
  border: 1px solid rgba(148,163,184,0.22);
  box-shadow: var(--shadow-lg);
}
.static-map-empty {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-secondary);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(15,23,42,0.72);
  border: 1px solid rgba(148,163,184,0.22);
}
/* Override Leaflet dark theme */
.leaflet-container {
  background: #1a1b2e !important;
  font-family: 'Inter', 'Noto Sans SC', sans-serif !important;
}
.leaflet-tile-pane {
  filter: brightness(0.7) contrast(1.1) saturate(0.8) hue-rotate(180deg) invert(1);
}
.leaflet-control-zoom a {
  background: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}
.leaflet-control-zoom a:hover {
  background: var(--bg-surface) !important;
}
.leaflet-control-attribution {
  background: rgba(15,16,36,0.8) !important;
  color: var(--text-muted) !important;
  font-size: 0.6rem !important;
}
.leaflet-control-attribution a {
  color: var(--accent-light) !important;
}
.leaflet-popup-content-wrapper {
  background: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: var(--shadow-lg) !important;
}
.leaflet-popup-tip {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border-color) !important;
}
.leaflet-popup-close-button {
  color: var(--text-muted) !important;
}
.leaflet-popup-close-button:hover {
  color: var(--text-primary) !important;
}
/* Custom marker styles */
.building-marker-icon {
  background: none !important;
  border: none !important;
}
.bld-marker {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}
.bld-marker-pin {
  width: 38px;
  height: 38px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0,0,0,0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}
.bld-marker:hover .bld-marker-pin {
  transform: rotate(-45deg) scale(1.15);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.bld-marker-pin.green { background: linear-gradient(135deg, var(--green), #059669); }
.bld-marker-pin.yellow { background: linear-gradient(135deg, var(--yellow), var(--orange)); }
.bld-marker-pin.red { background: linear-gradient(135deg, var(--red), #dc2626); }
.bld-marker-pin-icon {
  transform: rotate(45deg);
  font-size: 1rem;
}
.bld-marker-label {
  margin-top: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(15,16,36,0.85);
  backdrop-filter: blur(8px);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  border: 1px solid var(--border-color);
}
.bld-marker-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 50px;
  height: 50px;
  margin: -25px 0 0 -25px;
  border-radius: 50%;
  animation: bldPulse 2s ease-out infinite;
}
.bld-marker-pulse.green { background: var(--green); }
.bld-marker-pulse.yellow { background: var(--yellow); }
.bld-marker-pulse.red { background: var(--red); }
@keyframes bldPulse {
  0% { transform: scale(0.5); opacity: 0.4; }
  100% { transform: scale(2); opacity: 0; }
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
/* Popup content styling */
.map-bld-popup {
  min-width: 220px;
}
.map-bld-popup .popup-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.map-bld-popup .popup-address {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}
.map-bld-popup .popup-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.78rem;
}
.map-bld-popup .popup-stat-label {
  color: var(--text-secondary);
}
.map-bld-popup .popup-stat-value {
  font-weight: 600;
  color: var(--text-primary);
}
.map-bld-popup .popup-rooms {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}
.map-bld-popup .popup-room-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
  margin: 2px;
  background: rgba(99,102,241,0.08);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.map-bld-popup .popup-room-chip.occupied { border-color: var(--green); color: var(--green); }
.map-bld-popup .popup-room-chip.vacant { border-color: var(--yellow); color: var(--yellow); }
.map-bld-popup .popup-room-chip.maintenance { border-color: var(--orange); color: var(--orange); }

/* ============================================================
   DEVICE SUITE CARDS
   ============================================================ */
.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 7px 12px;
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}
.filter-select:hover { border-color: var(--accent); }
.filter-select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15); }
.filter-select option { background: var(--bg-surface); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-sm { padding: 6px 12px; font-size: 0.75rem; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-light); }
.btn-outline { background: transparent; color: var(--accent-light); border: 1px solid rgba(99, 102, 241, 0.3); }
.btn-outline:hover { background: rgba(99, 102, 241, 0.1); border-color: var(--accent); }
.btn-danger { background: rgba(239, 68, 68, 0.15); color: var(--red); border: 1px solid rgba(239, 68, 68, 0.2); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }
.btn-success { background: rgba(16, 185, 129, 0.15); color: var(--green); border: 1px solid rgba(16, 185, 129, 0.2); }
.btn-success:hover { background: rgba(16, 185, 129, 0.25); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

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

.device-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
}
.device-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow);
}

.device-card-panel {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.04), rgba(6, 182, 212, 0.02));
}

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

.device-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.device-panel-name { font-weight: 700; font-size: 0.95rem; }

.device-status-tag {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}
.device-status-tag.online { background: rgba(16, 185, 129, 0.15); color: var(--green); }
.device-status-tag.offline { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.device-status-tag.upgrading { background: rgba(245, 158, 11, 0.15); color: var(--yellow); }

.device-panel-model { font-size: 0.72rem; color: var(--text-muted); }

.device-versions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.version-tag {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.version-tag span { color: var(--text-muted); }

.device-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.device-card-sensors {
  padding: 12px 16px;
}

.device-sensors-title {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.device-sensor-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 0.78rem;
}

.device-sensor-type {
  width: 14px; height: 14px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem;
}
.sensor-type-thermal { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.sensor-type-mmwave { background: rgba(6, 182, 212, 0.15); color: var(--cyan); }
.sensor-type-magnetic { background: rgba(245, 158, 11, 0.15); color: var(--yellow); }
.sensor-type-lock { background: rgba(16, 185, 129, 0.15); color: var(--green); }

.device-sensor-name { flex: 1; color: var(--text-secondary); }

.device-sensor-status {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  font-size: 0.7rem;
  font-weight: 500;
}
.device-sensor-status.online { color: var(--green); }
.device-sensor-status.offline { color: var(--red); }
.device-sensor-status.error { color: var(--yellow); }

.device-sensor-signal {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* ============================================================
   ROOM TABLE
   ============================================================ */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255,255,255,0.02);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: rgba(99, 102, 241, 0.04); }
.data-table tbody tr.anomaly-row { background: rgba(239, 68, 68, 0.04); }
.data-table tbody tr.anomaly-row:hover { background: rgba(239, 68, 68, 0.08); }

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
}
.status-chip.success { background: rgba(16,185,129,0.12); color: var(--green); }
.status-chip.warning { background: rgba(245,158,11,0.12); color: var(--yellow); }
.status-chip.danger { background: rgba(239,68,68,0.12); color: #f87171; }
.status-chip.muted { background: rgba(148,163,184,0.12); color: var(--text-muted); }

.room-type-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-light);
}

.occupancy-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.occupancy-bar-visual {
  width: 50px;
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  overflow: hidden;
}

.occupancy-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}
.occupancy-bar-fill.ok { background: var(--green); }
.occupancy-bar-fill.warn { background: var(--yellow); }
.occupancy-bar-fill.danger { background: var(--red); }

.ai-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
}
.ai-status-tag.normal { background: rgba(16, 185, 129, 0.1); color: var(--green); }
.ai-status-tag.anomaly { background: rgba(239, 68, 68, 0.1); color: var(--red); }
.ai-status-tag.warning { background: rgba(245, 158, 11, 0.1); color: var(--yellow); }

/* ============================================================
   ALERT LIST
   ============================================================ */
.alert-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.alert-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.alert-stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.p0-card::before { background: var(--red); }
.p1-card::before { background: var(--orange); }
.p2-card::before { background: var(--yellow); }
.dismissed-card::before { background: var(--text-muted); }

.alert-stat-value { font-size: 1.8rem; font-weight: 700; display: block; }
.alert-stat-label { font-size: 0.75rem; color: var(--text-muted); }

.alert-list { display: flex; flex-direction: column; gap: 12px; }

.alert-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}
.alert-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow);
}

.alert-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
}
.alert-card.P0::before { background: var(--red); }
.alert-card.P1::before { background: var(--orange); }
.alert-card.P2::before { background: var(--yellow); }

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

.alert-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-level-badge {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  color: white;
}
.alert-level-badge.P0 { background: var(--red); }
.alert-level-badge.P1 { background: var(--orange); }
.alert-level-badge.P2 { background: var(--yellow); color: #1a1a1a; }

.alert-title-text { font-weight: 600; font-size: 0.9rem; }

.alert-status-badge {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 10px;
}
.alert-status-badge.open { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.alert-status-badge.processing { background: rgba(245, 158, 11, 0.15); color: var(--yellow); }
.alert-status-badge.resolved { background: rgba(16, 185, 129, 0.15); color: var(--green); }
.alert-status-badge.dismissed { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); }

.alert-card-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  line-height: 1.5;
}

.alert-ai-analysis {
  background: rgba(6, 182, 212, 0.06);
  border: 1px solid rgba(6, 182, 212, 0.1);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.78rem;
  color: var(--cyan);
  line-height: 1.5;
}
.alert-ai-analysis::before {
  content: '🤖 AI 分析：';
  font-weight: 600;
}

.alert-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.alert-meta-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.alert-card-actions {
  display: flex;
  gap: 6px;
}

/* ============================================================
   AI CHAT
   ============================================================ */
.chat-layout {
  display: flex;
  gap: 16px;
  height: calc(100vh - var(--topbar-height) - 48px);
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.chat-welcome {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.chat-welcome-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.chat-welcome h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent-light), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.chat-welcome p { font-size: 0.85rem; color: var(--text-muted); }

.chat-message {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  animation: msgSlide 0.3s ease;
}

@keyframes msgSlide {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-message.user { flex-direction: row-reverse; }

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.chat-message.user .chat-avatar { background: linear-gradient(135deg, var(--accent), var(--cyan)); color: white; }
.chat-message.assistant .chat-avatar { background: linear-gradient(135deg, var(--green), var(--cyan)); color: white; }

.chat-bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.6;
}

.chat-message.user .chat-bubble {
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message.assistant .chat-bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat-bubble pre {
  background: rgba(0,0,0,0.3);
  padding: 10px;
  border-radius: 6px;
  margin: 8px 0;
  overflow-x: auto;
  font-size: 0.8rem;
  font-family: 'Fira Code', monospace;
}

.chat-bubble code {
  background: rgba(0,0,0,0.2);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.8rem;
}

.chat-bubble table {
  border-collapse: collapse;
  margin: 8px 0;
  width: 100%;
}
.chat-bubble table th,
.chat-bubble table td {
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  font-size: 0.78rem;
  text-align: left;
}
.chat-bubble table th { background: rgba(255,255,255,0.04); font-weight: 600; }

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 8px 16px;
}
.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.chat-suggestions {
  padding: 8px 20px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border-color);
}

.suggestion-chip {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.15);
  color: var(--accent-light);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.suggestion-chip:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent);
}

.chat-input-area {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
}

.chat-input-wrap {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 120px;
  transition: border-color var(--transition);
}
.chat-input:focus { border-color: var(--accent); }
.chat-input::placeholder { color: var(--text-muted); }

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}
.chat-send-btn:hover { background: var(--accent-light); transform: scale(1.05); }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.chat-sidebar {
  width: 200px;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  overflow-y: auto;
}

.chat-sidebar-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quick-commands {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.quick-cmd {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition);
}
.quick-cmd:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--accent-light);
  border-color: rgba(99, 102, 241, 0.2);
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-elevated);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  pointer-events: auto;
  min-width: 280px;
  max-width: 400px;
}

.toast.hiding { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

.toast-icon { font-size: 1rem; flex-shrink: 0; }
.toast-content { flex: 1; }
.toast-title { font-size: 0.8rem; font-weight: 600; }
.toast-desc { font-size: 0.72rem; color: var(--text-secondary); margin-top: 2px; }
.toast-close {
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px;
}
.toast-close:hover { color: var(--text-primary); }

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.warning { border-left: 3px solid var(--yellow); }
.toast.info { border-left: 3px solid var(--cyan); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .entry-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entry-flow-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .entry-layout,
  .entry-history-grid { grid-template-columns: 1fr; }
  .digital-twin-header,
  .digital-twin-stage-head { align-items: stretch; flex-direction: column; }
  .digital-twin-actions { min-width: 0; width: 100%; grid-template-columns: 160px minmax(180px, 220px) minmax(180px, 1fr) auto; }
  .digital-twin-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .digital-twin-layout { grid-template-columns: 1fr; }
  .digital-twin-object-list { max-height: 360px; }
  .face-panel-twin-grid,
  .digital-twin-lower-grid,
  .generic-twin-grid { grid-template-columns: 1fr; }
  .twin-feature-grid { grid-template-columns: 1fr; }
  .twin-feedback-grid { grid-template-columns: 1fr; }
  .twin-shadow-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .twin-shadow-core-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .twin-scroll-history { grid-template-columns: 1fr; }
  .aiot-poc-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .aiot-poc-grid { grid-template-columns: 1fr; }
  .aiot-security-grid { grid-template-columns: 1fr; }
  .security-control-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .security-bridge-grid,
  .security-work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .security-table-row { grid-template-columns: minmax(160px, 1.2fr) minmax(110px, 0.8fr) minmax(110px, 0.7fr) minmax(120px, 0.8fr) minmax(140px, auto); }
  .aiot-orchestration-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .aiot-orchestration-grid,
  .aiot-orchestration-grid.lower { grid-template-columns: 1fr; }
  .aiot-fast-bus-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .aiot-fast-bus-grid { grid-template-columns: 1fr; }
  .alert-stats { grid-template-columns: repeat(2, 1fr); }
  .chat-sidebar { display: none; }
}

@media (max-width: 1100px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(var(--sidebar-width), calc(100vw - 48px));
    min-width: min(var(--sidebar-width), calc(100vw - 48px));
    height: 100dvh;
    z-index: 200;
    transform: translateX(-105%);
    transition: transform var(--transition);
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.38);
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .sidebar-close {
    display: inline-grid;
  }

  .sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  body.sidebar-drawer-open {
    overflow: hidden;
  }

  .menu-toggle {
    min-height: 36px;
    padding: 6px 9px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.5);
    color: var(--text-primary);
  }

  .menu-toggle-label {
    display: inline;
  }
}

@media (max-width: 768px) {
  .main-content {
    min-width: 0;
  }

  .topbar {
    padding: 0 10px;
    gap: 8px;
  }

  .topbar-left {
    min-width: 0;
    flex: 1;
    gap: 8px;
  }

  .twin-shadow-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .twin-feature-intro {
    align-items: stretch;
    flex-direction: column;
  }

  .twin-shadow-summary,
  .twin-shadow-core-grid,
  .twin-shadow-result-grid,
  .twin-shadow-edit-fields,
  .twin-function-fields,
  .twin-function-output-list,
  .screen-saver-layout,
  .twin-system-facts,
  .twin-system-metrics {
    grid-template-columns: 1fr;
  }

  .twin-shadow-core-card.wide {
    grid-column: span 1;
  }

  .breadcrumb {
    min-width: 0;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
  }

  .breadcrumb-home,
  .breadcrumb-sep {
    display: none;
  }

  .breadcrumb-current {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
  }

  .v2-function-map {
    margin-bottom: 14px;
    padding-bottom: 14px;
  }

  .v2-function-head {
    margin-bottom: 12px;
  }

  .v2-function-summary {
    font-size: 0.8rem;
  }

  .v2-workflow-strip,
  .v2-function-grid {
    grid-template-columns: 1fr;
  }

  .v2-workflow-step {
    min-height: 38px;
  }

  .v2-function-card {
    min-height: 104px;
  }

  .entry-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .entry-hero-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .entry-hero-actions .filter-select {
    min-width: 0;
    width: 100%;
  }

  .entry-refresh-status {
    max-width: none;
    width: 100%;
  }

  .entry-flow-strip,
  .entry-summary-grid,
  .entry-panel-facts,
  .entry-state-row,
  .entry-topic-list,
  .entry-fast-metrics,
  .digital-twin-actions,
  .digital-twin-summary,
  .face-panel-hardware-grid,
  .twin-status-board,
  .twin-screen-state-row,
  .generic-twin-facts,
  .twin-attr-grid {
    grid-template-columns: 1fr;
  }

  .screen-saver-item {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .screen-saver-thumb {
    width: 64px;
  }

  .screen-saver-item-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: flex-end;
  }

  .entry-panel-head {
    flex-direction: column;
  }

  .digital-twin-stage {
    padding: 12px;
  }

  .face-panel-device {
    width: min(100%, 320px);
    border-radius: 22px;
  }

  .twin-relation-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .topbar-right {
    flex-shrink: 0;
    gap: 6px;
  }

  .ai-status,
  .ws-status {
    width: 30px;
    height: 30px;
    padding: 0;
    justify-content: center;
    border-radius: 10px;
  }

  .ai-status .ai-label,
  .ai-status .ai-state,
  .ws-status #wsStatusText {
    display: none;
  }

  .notification-bell {
    padding: 5px;
  }

  .theme-toggle {
    width: 40px;
    height: 24px;
  }

  [data-theme="light"] .theme-toggle-thumb {
    transform: translateX(14px);
  }

  .stats-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .aiot-security-hero { grid-template-columns: 1fr; }
  .aiot-security-target strong { font-size: 1.35rem; }
  .aiot-poc-summary { grid-template-columns: 1fr; }
  .security-platform-head {
    align-items: stretch;
    flex-direction: column;
    padding: 14px;
  }
  .security-platform-badge { align-self: flex-start; }
  .security-control-kpis,
  .security-bridge-grid,
  .security-work-grid,
  .security-table-row { grid-template-columns: 1fr; }
  .security-table-row.head { display: none; }
  .security-row-actions { justify-content: flex-start; }
  .security-tab {
    flex: 1 1 140px;
    text-align: center;
  }
  .aiot-orchestration-summary { grid-template-columns: 1fr; }
  .aiot-fast-bus-summary { grid-template-columns: 1fr; }
  .aiot-poc-check {
    align-items: flex-start;
    flex-direction: column;
  }
  .aiot-state-session,
  .aiot-eca-rule,
  .aiot-launch-check {
    flex-direction: column;
    align-items: stretch;
  }
  .aiot-event-mapping {
    grid-template-columns: 1fr;
  }
  .aiot-event-mapping b,
  .aiot-event-mapping em {
    justify-self: start;
  }
  .aiot-fast-trace,
  .aiot-material-card {
    flex-direction: column;
    align-items: stretch;
  }
  .aiot-fast-bus-actions {
    justify-content: flex-start;
  }
  .device-grid { grid-template-columns: 1fr; }
  .alert-stats { grid-template-columns: repeat(2, 1fr); }

  .page-container {
    height: calc(100dvh - var(--topbar-height));
    padding: 12px;
  }

  .map-container {
    height: calc(100dvh - var(--topbar-height) - 24px);
    min-height: 520px;
    border-radius: var(--radius-sm);
  }

  .map-toolbar {
    top: 10px;
    left: 10px;
    right: 10px;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
  }

  .map-toolbar h3 {
    font-size: 0.82rem;
  }

  .map-legend {
    margin-left: 0 !important;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.68rem;
  }

  .map-actions {
    gap: 6px !important;
  }

  .map-actions .refresh-status {
    max-width: 84px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .static-marker-label,
  .bld-marker-label {
    max-width: 104px;
    font-size: 0.68rem;
  }

  .static-map-info {
    right: 12px;
    bottom: 12px;
    width: min(300px, calc(100% - 24px));
  }
}

/* ============================================================
   AI FLOATING WIDGET (常驻浮窗)
   ============================================================ */
.ai-floating-widget {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 1000;
}

/* 浮动气泡按钮 */
.ai-bubble-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  position: relative;
  transition: transform var(--transition), box-shadow var(--transition);
  outline: none;
  z-index: 1001;
}

.ai-bubble-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.6);
}

.ai-bubble-btn:active {
  transform: scale(0.92);
}

/* 脉冲环动画 */
.bubble-ripple {
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  animation: bubble-ripple-anim 2.5s infinite;
  pointer-events: none;
}

@keyframes bubble-ripple-anim {
  0% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(1.3); opacity: 0; }
}

/* 聊天面板 */
.ai-chat-panel {
  display: flex;
  flex-direction: column;
  position: absolute;
  bottom: 70px;
  right: 0;
  width: min(520px, calc(100vw - 32px));
  height: min(680px, calc(100vh - 110px));
  border-radius: var(--radius);
  background: rgba(17, 24, 39, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 1000;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-chat-panel.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* 面板头部 */
.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.02);
}

.chat-panel-header .header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-panel-header .header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.chat-panel-header .header-info {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.chat-panel-header .header-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-panel-header .header-status {
  font-size: 0.68rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-panel-header .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.chat-panel-header .status-dot.green {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.chat-panel-header .status-dot.red {
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
}

.chat-panel-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
}

.chat-panel-close:hover {
  color: var(--text-primary);
}

/* 面板主体 */
.chat-panel-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.chat-panel-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-panel-messages .chat-welcome {
  text-align: center;
  padding: 30px 10px;
  color: var(--text-secondary);
}

.chat-panel-messages .chat-welcome-icon {
  font-size: 2.2rem;
  margin-bottom: 12px;
}

.chat-panel-messages .chat-welcome h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
  background: linear-gradient(135deg, var(--accent-light), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.chat-panel-messages .chat-welcome p {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* 聊天气泡样式 (浮窗专用版) */
.chat-panel-messages .chat-message {
  display: flex;
  gap: 8px;
  animation: msgSlide 0.3s ease;
}

.chat-panel-messages .chat-message.user {
  flex-direction: row-reverse;
}

.chat-panel-messages .chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.chat-panel-messages .chat-message.user .chat-avatar {
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  color: white;
}

.chat-panel-messages .chat-message.assistant .chat-avatar {
  background: linear-gradient(135deg, var(--green), var(--cyan));
  color: white;
}

.chat-panel-messages .chat-bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.8rem;
  line-height: 1.5;
}

.chat-panel-messages .chat-message.user .chat-bubble {
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  color: white;
  border-bottom-right-radius: 2px;
}

.chat-panel-messages .chat-message.assistant .chat-bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-bottom-left-radius: 2px;
  min-width: min(360px, 100%);
}

.chat-panel-messages .chat-bubble h3,
.chat-panel-messages .chat-bubble h4,
.chat-bubble h3,
.chat-bubble h4 {
  margin: 10px 0 6px;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 700;
}

.chat-panel-messages .chat-bubble p,
.chat-bubble p {
  margin: 0 0 8px;
}

.chat-panel-messages .chat-bubble ul,
.chat-panel-messages .chat-bubble ol,
.chat-bubble ul,
.chat-bubble ol {
  margin: 6px 0 10px;
  padding-left: 18px;
}

.chat-panel-messages .chat-bubble li,
.chat-bubble li {
  margin: 4px 0;
}

.chat-panel-messages .chat-bubble blockquote,
.chat-bubble blockquote {
  margin: 8px 0;
  padding: 8px 10px;
  border-left: 3px solid var(--cyan);
  border-radius: 8px;
  background: rgba(6, 182, 212, 0.08);
  color: var(--text-secondary);
}

.chat-panel-messages .chat-bubble a,
.chat-bubble a {
  color: var(--cyan);
  text-decoration: none;
}

.chat-panel-messages .chat-bubble a:hover,
.chat-bubble a:hover {
  text-decoration: underline;
}

.chat-panel-messages .chat-bubble pre {
  background: rgba(0,0,0,0.3);
  padding: 8px;
  border-radius: 6px;
  margin: 6px 0;
  overflow-x: auto;
  font-size: 0.75rem;
}

.chat-panel-messages .chat-bubble code {
  background: rgba(0,0,0,0.2);
  padding: 1px 3px;
  border-radius: 3px;
  font-size: 0.75rem;
}

.chat-table-wrap {
  overflow-x: auto;
  margin: 8px 0 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.chat-panel-messages .chat-bubble .chat-table-wrap table,
.chat-bubble .chat-table-wrap table {
  margin: 0;
  min-width: 100%;
}

.stream-cursor {
  display: inline-block;
  width: 7px;
  height: 1em;
  margin-left: 2px;
  border-radius: 2px;
  background: var(--cyan);
  vertical-align: -2px;
  animation: streamCursorBlink 0.85s steps(2, start) infinite;
}

@keyframes streamCursorBlink {
  0%, 45% { opacity: 1; }
  46%, 100% { opacity: 0; }
}

.chat-insights {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(6, 182, 212, 0.18);
  background: rgba(6, 182, 212, 0.06);
}

.chat-insights-title {
  margin-bottom: 8px;
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 700;
}

.chat-metric-row {
  display: grid;
  grid-template-columns: minmax(70px, 0.8fr) minmax(100px, 1.4fr) auto;
  align-items: center;
  gap: 8px;
  margin: 7px 0;
}

.chat-metric-label {
  color: var(--text-secondary);
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-metric-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.chat-metric-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green));
}

.chat-metric-value {
  color: var(--text-primary);
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

.chat-bubble.is-error {
  border-color: rgba(239, 68, 68, 0.35) !important;
}

/* 快捷建议栏 */
.chat-panel-suggestions {
  border-top: 1px solid var(--border-color);
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.01);
}

.chat-panel-suggestions .suggestion-title {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  line-height: 1.45;
  word-break: break-word;
}

.chat-panel-suggestions .suggestion-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
  padding-bottom: 2px;
}

.chat-panel-suggestions .suggestion-chips::-webkit-scrollbar {
  display: none; /* Safari & Chrome */
}

.panel-suggestion-chip {
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.12);
  color: var(--accent-light);
  padding: 5px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.panel-suggestion-chip:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: var(--accent);
}

/* 底部输入框 */
.chat-panel-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.15);
}

.chat-panel-input-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-panel-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 60px;
  line-height: 1.4;
  transition: border-color var(--transition);
}

.chat-panel-input:focus {
  border-color: var(--accent);
}

.chat-panel-input::placeholder {
  color: var(--text-muted);
}

.chat-panel-send-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}

.chat-panel-send-btn:hover {
  background: var(--accent-light);
  transform: scale(1.05);
}

.chat-panel-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ============================================================
   SYSTEM MONITOR (服务监测面版)
   ============================================================ */
.monitor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.sys-metrics {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}
.metric-row:last-child {
  border-bottom: none;
}

.metric-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.metric-value {
  font-size: 0.82rem;
  color: var(--text-primary);
  font-weight: 600;
  font-family: 'Fira Code', monospace;
}

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

.db-stat-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 12px 8px;
  border-radius: var(--radius-xs);
  text-align: center;
  transition: border-color var(--transition);
}
.db-stat-item:hover {
  border-color: var(--border-glow);
}

.db-stat-num {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--cyan);
  margin-bottom: 4px;
}

.db-stat-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.services-monitor-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.service-mon-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.service-mon-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.service-mon-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.service-mon-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.service-mon-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.service-mon-status {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.2);
  white-space: nowrap;
}
.service-mon-status.online {
  background: rgba(16, 185, 129, 0.1);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

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

.mqtt-client-badge {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.15);
  color: var(--cyan);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.control-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.w-full {
  width: 100% !important;
}

@media (max-width: 992px) {
  .monitor-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   SYSTEM INTEGRATION & CUSTOMIZATION STYLES
   ============================================================ */

/* 1. 三位一体集成配置网格 */
.integration-custom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 10px;
}

.integration-col {
  background: rgba(26, 34, 52, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.integration-col h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 2. 电子表单玻璃态弹窗 */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 14, 26, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease-out;
}

.glass-modal {
  background: linear-gradient(135deg, rgba(26, 34, 52, 0.85) 0%, rgba(17, 24, 39, 0.9) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color var(--transition);
  outline: none;
}

.modal-close:hover {
  color: var(--red);
}

.modal-body {
  padding: 20px;
}

.glass-modal.banner-rule-modal {
  width: min(96vw, 1320px);
  max-width: 1320px;
  max-height: 92vh;
}

.glass-modal.banner-rule-modal .modal-body {
  padding: 18px 20px 20px;
}

.dynamic-fields-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dynamic-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dynamic-field-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.dynamic-field-label span.req {
  color: var(--red);
  margin-left: 2px;
}

.dynamic-field-input,
.dynamic-field-select,
.dynamic-field-textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.dynamic-field-input:focus,
.dynamic-field-select:focus,
.dynamic-field-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--border-glow);
}

.dynamic-field-textarea {
  min-height: 80px;
  resize: vertical;
}

/* 3. 流程待办中心样式 */
.inbox-tasks-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.inbox-task-card {
  background: rgba(26, 34, 52, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inbox-task-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-glow);
  background: rgba(26, 34, 52, 0.5);
}

.inbox-task-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.inbox-task-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-task-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.inbox-task-badge.device_repair_form {
  background: rgba(245, 158, 11, 0.1);
  color: var(--yellow);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.inbox-task-badge.security_audit_form {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-light);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.inbox-task-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.inbox-task-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-top: 1px dashed var(--border-color);
  padding-top: 8px;
  margin-top: 4px;
}

/* 4. Badges */
.workflow-badge {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  color: var(--accent-light);
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
  margin-left: 6px;
  display: inline-flex;
  align-items: center;
}

.cmdb-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
  display: inline-block;
}

.cmdb-badge.synced {
  background: rgba(16, 185, 129, 0.1);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.cmdb-badge.pending {
  background: rgba(245, 158, 11, 0.1);
  color: var(--yellow);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ============================================================
   3D 联动建模设计中心
   ============================================================ */

/* Nav divider & NEW badge */
.nav-divider {
  height: 1px;
  margin: 8px 16px;
  background: linear-gradient(90deg, transparent, var(--border-color), transparent);
}

.nav-badge-new {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.55rem;
  font-weight: 700;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  color: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: auto;
  letter-spacing: 0.5px;
  animation: newBadgePulse 2s ease-in-out infinite;
}

@keyframes newBadgePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ---- Topology Flow ---- */
.design-topology {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 24px 16px;
  margin-bottom: 16px;
}

.topo-card {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px 24px;
  text-align: center;
  min-width: 180px;
  transition: all 0.4s ease;
  overflow: hidden;
}

.topo-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.15);
}

.topo-card .topo-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.06) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}

.topo-card:hover .topo-glow,
.topo-card.active .topo-glow {
  opacity: 1;
}

.topo-card.active {
  border-color: var(--green);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}

.topo-card.partial {
  border-color: var(--yellow);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.1);
}

.topo-card.active .topo-glow {
  background: radial-gradient(circle, rgba(16, 185, 129, 0.08) 0%, transparent 70%);
}

.topo-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.topo-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.topo-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.topo-card.active .topo-subtitle {
  color: var(--green);
}

.topo-card.partial .topo-subtitle {
  color: var(--yellow);
}

/* ---- Connector Lines ---- */
.topo-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 4px;
  min-width: 80px;
}

.topo-connector-line {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  position: relative;
  border-radius: 1px;
  overflow: hidden;
}

.topo-connector-line::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  animation: connectorFlow 2s ease-in-out infinite;
}

@keyframes connectorFlow {
  0% { left: -50%; }
  100% { left: 150%; }
}

.topo-connector-arrow {
  font-size: 1.2rem;
  color: var(--cyan);
  font-weight: 700;
  line-height: 1;
  margin-top: -6px;
}

.topo-connector-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---- Tab Bar ---- */
.design-tab-bar {
  display: flex;
  gap: 0;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}

.design-tab-bar .design-tab {
  flex: 1;
  padding: 12px 20px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.design-tab-bar .design-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.design-tab-bar .design-tab.active {
  color: var(--accent-light);
  border-bottom-color: var(--accent);
  background: rgba(99, 102, 241, 0.06);
}

.design-tab-icon {
  font-size: 1rem;
}

/* ---- Tab Content & Panes ---- */
.design-tab-content {
  flex: 1;
}

.design-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}

.design-pane.active {
  display: block;
}

/* ---- Objects Tab Layout ---- */
.design-objects-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  min-height: 420px;
}

.object-type-list {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.object-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

.object-list-header h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.object-list-items {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.object-type-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  position: relative;
}

.object-type-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.object-type-item.selected {
  background: rgba(99, 102, 241, 0.08);
  border-left-color: var(--accent);
}

.object-type-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.object-type-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.object-type-label small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
}

.object-type-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 500;
}

.object-type-delete {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.72rem;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0;
  transition: all 0.2s;
}

.object-type-item:hover .object-type-delete {
  opacity: 1;
}

.object-type-delete:hover {
  color: var(--red);
  background: rgba(239, 68, 68, 0.1);
}

.object-workbench-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* ---- Attribute Editor ---- */
.attr-editor-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  overflow-y: auto;
}

.attr-editor-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
  min-height: 200px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.attr-editor-placeholder-icon {
  font-size: 2.5rem;
  opacity: 0.5;
}

.attr-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.attr-editor-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.attr-editor-title h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.attr-editor-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.attr-editor-desc {
  display: block;
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 0.74rem;
  line-height: 1.5;
}

.attr-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.attr-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.2s;
}

.attr-row:last-child {
  border-bottom: none;
}

.attr-row:hover {
  background: rgba(255, 255, 255, 0.02);
  margin: 0 -12px;
  padding-left: 12px;
  padding-right: 12px;
  border-radius: 6px;
}

.attr-row-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.attr-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.attr-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ---- Unified Object Model ---- */
.object-model-workbench {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
}

.object-model-header,
.object-model-section-title,
.entity-object-head,
.template-card-head,
.capability-object-row {
  display: flex;
  align-items: center;
}

.object-model-header {
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.object-model-header h4,
.object-model-section-title span {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
}

.object-model-header p,
.object-model-section-title small,
.template-card small,
.capability-object-row small,
.entity-object-head small,
.muted-small {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.object-model-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.object-model-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.object-model-stat {
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 8px;
  padding: 10px;
}

.object-model-stat span {
  display: block;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.object-model-stat strong {
  display: block;
  margin-top: 4px;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.object-model-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(260px, 0.7fr);
  gap: 12px;
}

.object-model-section {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  margin-top: 12px;
  min-width: 0;
}

.object-model-focus {
  background: rgba(34, 197, 94, 0.045);
  border-color: rgba(34, 197, 94, 0.18);
}

.object-model-section-title {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.template-focus-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 14px;
}

.template-focus-grid h5 {
  color: var(--text-primary);
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.template-focus-grid p,
.template-card p {
  color: var(--text-secondary);
  font-size: 0.75rem;
  line-height: 1.55;
}

.template-param-chips,
.template-cap-list,
.entity-object-caps,
.template-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.template-param-chips {
  margin-top: 10px;
}

.template-param-chips span,
.template-card-meta span {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 8px;
  font-size: 0.68rem;
}

.template-card-meta em {
  color: var(--text-muted);
  font-style: normal;
  margin-left: 3px;
}

.template-list,
.capability-object-list,
.entity-object-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-card,
.entity-object-card {
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 8px;
  padding: 10px;
}

.template-card.highlight {
  border-color: rgba(34, 197, 94, 0.28);
  background: rgba(34, 197, 94, 0.055);
}

.template-card-head {
  gap: 8px;
  margin-bottom: 8px;
}

.template-card-head strong,
.capability-object-row strong,
.entity-object-head strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.8rem;
}

.capability-object-row {
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.capability-object-row:last-child {
  border-bottom: 0;
}

.capability-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.capability-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(99, 102, 241, 0.24);
  background: rgba(99, 102, 241, 0.1);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 0.72rem;
  line-height: 1;
}

.capability-chip.required {
  border-color: rgba(34, 197, 94, 0.28);
  background: rgba(34, 197, 94, 0.1);
}

.capability-chip.optional {
  border-color: rgba(14, 165, 233, 0.28);
  background: rgba(14, 165, 233, 0.1);
}

.capability-chip small {
  color: var(--text-muted);
  font-size: 0.64rem;
}

.capability-chip button {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.capability-chip button:hover {
  color: var(--red);
  background: rgba(239, 68, 68, 0.12);
}

.entity-object-head {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.mono-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.74rem;
}

@media (max-width: 1100px) {
  .design-objects-layout,
  .object-model-grid,
  .template-focus-grid {
    grid-template-columns: 1fr;
  }

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

/* ---- Workflow Tab ---- */
.workflow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.workflow-header h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.workflow-cards-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}

.workflow-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.workflow-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.1);
}

.workflow-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 4px 20px rgba(99, 102, 241, 0.15);
}

.workflow-card.inactive {
  opacity: 0.6;
}

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

.workflow-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.workflow-card-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.trigger-badge {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.workflow-card-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.workflow-card-body {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ---- Workflow Editor ---- */
.workflow-editor-panel {
  margin-top: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

.workflow-editor-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
}

.workflow-editor-header h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.workflow-svg-container {
  padding: 20px;
  background: rgba(0, 0, 0, 0.15);
  overflow-x: auto;
}

.workflow-config-panel {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
}

.workflow-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.wf-cfg-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wf-cfg-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.wf-cfg-value {
  font-size: 0.82rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* ---- Form Designer Layout ---- */
.form-designer-layout {
  display: grid;
  grid-template-columns: 220px 1fr 280px;
  gap: 14px;
  min-height: 420px;
}

.form-list-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.form-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
}

.form-list-header h4 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-list-items {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.form-list-item {
  padding: 10px 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.2s;
}

.form-list-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.form-list-item.selected {
  background: rgba(99, 102, 241, 0.08);
  border-left-color: var(--accent);
}

.form-list-item-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.form-list-item-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ---- Form Editor Panel ---- */
.form-editor-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px;
  overflow-y: auto;
}

.form-editor-header {
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.form-editor-header h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.form-field-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.form-field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.2s;
}

.form-field-row:hover {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
}

.form-field-drag {
  color: var(--text-muted);
  cursor: grab;
  font-size: 0.9rem;
  user-select: none;
}

.form-field-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.form-field-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
}

.form-field-type {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.form-field-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* ---- Form Preview Panel ---- */
.form-preview-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.form-preview-header {
  padding: 10px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.1);
}

.form-preview-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.form-preview-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.preview-field-group {
  margin-bottom: 12px;
}

.preview-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.preview-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: inherit;
  outline: none;
}

.preview-textarea {
  min-height: 54px;
  resize: vertical;
}

.preview-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ---- Linkage Tab ---- */
.linkage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.linkage-header h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.linkage-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.linkage-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.3s ease;
}

.linkage-section.empty {
  opacity: 0.6;
}

.linkage-section.collapsed .linkage-section-body {
  display: none;
}

.linkage-section.collapsed .linkage-section-arrow {
  transform: rotate(-90deg);
}

.linkage-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid var(--border-color);
}

.linkage-section-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.linkage-section-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.linkage-section-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 10px;
  border-radius: 10px;
}

.linkage-section-arrow {
  color: var(--text-muted);
  font-size: 0.7rem;
  transition: transform 0.3s ease;
}

.linkage-section-body {
  padding: 10px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.linkage-rule-card {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color 0.2s;
}

.linkage-rule-card:hover {
  border-color: var(--border-glow);
}

.linkage-pipeline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.linkage-node {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 500;
  white-space: nowrap;
}

.linkage-node.trigger {
  background: rgba(249, 115, 22, 0.12);
  color: var(--orange, #f97316);
  border: 1px solid rgba(249, 115, 22, 0.2);
}

.linkage-node.object {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-light);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.linkage-node.person {
  background: rgba(6, 182, 212, 0.1);
  color: var(--cyan);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.linkage-node.form {
  background: rgba(16, 185, 129, 0.1);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.linkage-arrow {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.linkage-rule-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
}

.linkage-rule-name {
  color: var(--text-muted);
}

.linkage-rule-status {
  padding: 2px 8px;
  border-radius: 8px;
  font-weight: 500;
}

.linkage-rule-status.active {
  background: rgba(16, 185, 129, 0.1);
  color: var(--green);
}

.linkage-rule-status.inactive {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-muted);
}

/* ---- Button Variants ---- */
.btn-sm {
  padding: 5px 12px !important;
  font-size: 0.75rem !important;
}

.btn-outline {
  background: transparent !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-secondary) !important;
}

.btn-outline:hover {
  border-color: var(--accent) !important;
  color: var(--accent-light) !important;
  background: rgba(99, 102, 241, 0.06) !important;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1) !important;
  border: 1px solid rgba(239, 68, 68, 0.2) !important;
  color: var(--red) !important;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: var(--red) !important;
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--cyan)) !important;
  border: none !important;
  color: #fff !important;
}

.btn-accent:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-icon {
  margin-right: 6px;
}

/* ---- Responsive Design Tab ---- */
@media (max-width: 992px) {
  .design-objects-layout {
    grid-template-columns: 1fr;
  }
  .form-designer-layout {
    grid-template-columns: 1fr;
  }
  .workflow-cards-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .design-topology {
    flex-direction: column;
    gap: 8px;
  }
  .topo-connector {
    transform: rotate(90deg);
    min-width: unset;
    padding: 4px 0;
  }
  .design-tab-bar {
    flex-direction: column;
  }
  .design-tab-bar .design-tab {
    border-bottom: none;
    border-left: 2px solid transparent;
  }
  .design-tab-bar .design-tab.active {
    border-left-color: var(--accent);
    border-bottom-color: transparent;
  }
}

/* === Object / Process / Task Management Pages === */
.object-management-page,
.process-management-page,
.task-management-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.object-management-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.object-management-header h3 {
  color: var(--text-primary);
  font-size: 1.05rem;
  margin: 0 0 4px;
}

.object-management-header p {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin: 0;
}

.object-management-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.object-management-toolbar {
  display: grid;
  grid-template-columns: 180px 160px minmax(220px, 1fr);
  gap: 10px;
  align-items: center;
}

.object-management-list,
.process-management-mount,
.task-management-mount {
  min-width: 0;
}

.object-management-table {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
}

.object-management-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) minmax(150px, 1fr) minmax(160px, 1fr) minmax(120px, 0.7fr) minmax(150px, 1fr) 126px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.object-management-row:last-child {
  border-bottom: none;
}

.object-management-row-head {
  background: rgba(99,102,241,0.07);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.object-management-row strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.82rem;
  margin-bottom: 2px;
}

.object-management-row small {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 3px;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.object-management-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.process-management-mount .design-pane,
.task-management-mount .design-pane {
  display: none;
}

.process-management-mount .design-pane.active,
.task-management-mount .design-pane.active {
  display: block;
}

/* === Task Management === */
.tasks-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.tasks-header h4 { margin: 0; color: var(--text-primary); }
.tasks-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.tasks-filter-group {
  display: flex;
  gap: 8px;
}
.task-stat-cards {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.task-stat-card {
  flex: 1;
  min-width: 100px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: center;
  border-top: 3px solid var(--stat-color, var(--accent));
}
.task-stat-num {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--stat-color, var(--text-primary));
  line-height: 1.2;
}
.task-stat-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.tasks-table {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}
.tasks-table-header {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: rgba(99,102,241,0.06);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.tasks-table-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s;
}
.tasks-table-row:last-child { border-bottom: none; }
.tasks-table-row:hover { background: rgba(99,102,241,0.04); }
.tasks-col-pri {
  width: 58px;
  text-align: center;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex-wrap: wrap;
}
.tasks-col-pri small {
  display: block;
  width: 100%;
  color: var(--text-muted);
  font-size: 0.58rem;
  line-height: 1.1;
}
.tasks-col-title { flex: 2; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.task-title-text { font-size: 0.82rem; color: var(--text-primary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-desc-text { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tasks-col-type { width: 108px; text-align: center; }
.trigger-badge-sm { font-size: 0.68rem; padding: 2px 6px; border-radius: 4px; background: rgba(99,102,241,0.1); color: var(--accent-light); }
.tasks-col-person { width: 80px; font-size: 0.78rem; color: var(--text-secondary); text-align: center; }
.tasks-col-status { width: 110px; text-align: center; }
.task-status-badge { font-size: 0.7rem; padding: 3px 8px; border-radius: 6px; font-weight: 500; }
.tasks-col-time { width: 100px; font-size: 0.72rem; color: var(--text-muted); text-align: center; }
.tasks-col-action { width: 70px; text-align: center; }
.tasks-total { padding: 10px 16px; font-size: 0.72rem; color: var(--text-muted); text-align: right; }

@media (max-width: 1200px) {
  .object-management-stats {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }
  .object-management-row {
    grid-template-columns: minmax(180px, 1.4fr) minmax(130px, 0.9fr) minmax(140px, 0.9fr) minmax(100px, 0.7fr) minmax(120px, 0.8fr);
  }
  .object-management-row > span:last-child {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  .object-management-stats,
  .object-management-toolbar {
    grid-template-columns: 1fr;
  }
  .object-management-row,
  .object-management-row-head {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .object-management-row-head {
    display: none;
  }
  .tasks-table-header {
    display: none;
  }
  .tasks-table-row {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
  }
  .tasks-col-title {
    flex-basis: calc(100% - 70px);
  }
  .tasks-col-type,
  .tasks-col-person,
  .tasks-col-status,
  .tasks-col-time,
  .tasks-col-action {
    width: auto;
  }
}

/* Inline field editing for forms */
.field-inline-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 4px 8px;
  font-size: 0.78rem;
  outline: none;
  transition: border-color 0.2s;
}
.field-inline-input:focus { border-color: var(--accent); }
.field-inline-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 4px 6px;
  font-size: 0.75rem;
  outline: none;
}
.field-inline-checkbox {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}
.field-inline-checkbox input { width: 14px; height: 14px; cursor: pointer; }

/* ============================================================
   THERMAL MQTT MODULE DEBUGGING
   ============================================================ */
.thermal-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
}

.thermal-modules-panel,
.thermal-protocol-panel {
  align-self: start;
}

.thermal-live-panel,
.thermal-log-panel {
  min-width: 0;
}

.thermal-live-panel {
  scroll-margin-top: 16px;
}

.thermal-log-panel,
.thermal-protocol-panel {
  grid-column: span 1;
}

.thermal-ai-panel,
.thermal-training-panel,
.thermal-multimodal-panel,
.thermal-diagnostics-panel,
.thermal-identity-panel,
.thermal-ota-panel,
.thermal-debug-console-panel {
  grid-column: 1 / -1;
}

.thermal-multimodal-panel,
.thermal-diagnostics-panel,
.thermal-identity-panel {
  scroll-margin-top: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.thermal-section-focus {
  border-color: rgba(6, 182, 212, 0.62) !important;
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.12) !important;
}

.thermal-section-subtitle {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.thermal-multimodal-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.thermal-multimodal-metrics > div {
  min-width: 0;
  padding: 2px 12px 13px;
  border-right: 1px solid var(--border-color);
}

.thermal-multimodal-metrics > div:first-child { padding-left: 0; }
.thermal-multimodal-metrics > div:last-child { border-right: 0; }
.thermal-multimodal-metrics span,
.thermal-multimodal-metrics strong { display: block; overflow-wrap: anywhere; }
.thermal-multimodal-metrics span { margin-bottom: 5px; color: var(--text-muted); font-size: 0.7rem; }
.thermal-multimodal-metrics strong { color: var(--text-primary); font-size: 0.9rem; }

.thermal-fusion-overview {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  margin-bottom: 12px;
}

.thermal-sensing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  min-width: 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.thermal-sensor-pane {
  min-width: 0;
  padding: 12px 14px 14px;
}

.thermal-sensor-pane:first-child {
  padding-left: 0;
  border-right: 1px solid var(--border-color);
}

.thermal-sensor-pane:last-child {
  padding-right: 0;
}

.thermal-sensor-head {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.thermal-sensor-head > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.thermal-sensor-head svg {
  width: 15px;
  height: 15px;
  color: var(--cyan);
}

.thermal-sensor-head strong {
  color: var(--text-primary);
  font-size: 0.78rem;
}

.thermal-sensor-head > span {
  max-width: 58%;
  color: var(--text-muted);
  font-size: 0.66rem;
  text-align: right;
  overflow-wrap: anywhere;
}

.thermal-radar-status.online { color: var(--green); }
.thermal-radar-status.stale { color: var(--yellow); }
.thermal-radar-status.offline { color: var(--red); }

.thermal-radar-viewport {
  position: relative;
  width: 100%;
  height: 280px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #05070d;
}

#thermalRadarCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.thermal-radar-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 0.76rem;
  pointer-events: none;
}

.thermal-radar-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 8px;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.thermal-radar-metrics > div {
  min-width: 0;
  padding: 7px 8px;
  border-right: 1px solid var(--border-color);
}

.thermal-radar-metrics > div:last-child { border-right: 0; }
.thermal-radar-metrics span,
.thermal-radar-metrics strong { display: block; overflow-wrap: anywhere; }
.thermal-radar-metrics span { color: var(--text-muted); font-size: 0.62rem; }
.thermal-radar-metrics strong { margin-top: 3px; color: var(--text-primary); font-size: 0.73rem; }

.thermal-radar-targets {
  min-height: 44px;
  max-height: 118px;
  overflow-y: auto;
}

.thermal-radar-target-row {
  display: grid;
  grid-template-columns: minmax(70px, 0.8fr) repeat(4, minmax(58px, 1fr));
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 2px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  font: 0.64rem/1.35 var(--font-mono, monospace);
}

.thermal-radar-target-row strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
  font-family: var(--font-sans);
}

.thermal-radar-target-row strong::before {
  content: '';
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--target-color, var(--cyan));
}

.thermal-radar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.thermal-radar-feedback {
  min-height: 28px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.66rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.thermal-radar-feedback.success { color: var(--green); }
.thermal-radar-feedback.error { color: var(--red); }

.thermal-scenario-workspace {
  min-width: 0;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.thermal-scenario-head,
.thermal-scenario-head-actions,
.thermal-scenario-head > div:first-child > strong,
.thermal-scenario-hourly-head,
.thermal-scenario-hourly-head > div {
  display: flex;
  align-items: center;
}

.thermal-scenario-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
}

.thermal-scenario-head > div:first-child { min-width: 0; }
.thermal-scenario-head > div:first-child > strong { gap: 7px; color: var(--text-primary); font-size: 0.84rem; }
.thermal-scenario-head > div:first-child > strong svg { width: 16px; height: 16px; color: var(--cyan); }
.thermal-scenario-head > div:first-child > span { display: block; margin-top: 4px; color: var(--text-muted); font-size: 0.68rem; }
.thermal-scenario-head-actions { flex: 0 0 auto; gap: 10px; }

.thermal-scenario-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.thermal-scenario-progress > div {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 2px 8px;
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid var(--border-color);
}

.thermal-scenario-progress > div:last-child { border-right: 0; }
.thermal-scenario-progress span {
  grid-row: 1 / 3;
  align-self: center;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 0.68rem;
}
.thermal-scenario-progress strong { min-width: 0; color: var(--text-secondary); font-size: 0.72rem; }
.thermal-scenario-progress small { min-width: 0; color: var(--text-muted); font-size: 0.62rem; overflow-wrap: anywhere; }
.thermal-scenario-progress > div.active span { border-color: var(--cyan); color: var(--cyan); }
.thermal-scenario-progress > div.active strong { color: var(--cyan); }
.thermal-scenario-progress > div.done span { border-color: var(--green); background: rgba(34, 197, 94, 0.1); color: var(--green); }
.thermal-scenario-progress > div.done strong { color: var(--text-primary); }
.thermal-scenario-progress > div.failed span { border-color: var(--red); color: var(--red); }
.thermal-scenario-progress > div.failed strong { color: var(--red); }

.thermal-scenario-control-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(270px, 0.65fr);
  border-bottom: 1px solid var(--border-color);
}

.thermal-scenario-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) minmax(150px, 1fr) minmax(150px, 1fr);
  align-items: end;
  gap: 10px;
  min-width: 0;
  padding: 13px 14px 13px 0;
}

.thermal-scenario-name { grid-column: span 2; }

.thermal-scenario-form label,
.thermal-scenario-form fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--text-secondary);
  font-size: 0.66rem;
}

.thermal-scenario-form label { display: grid; gap: 5px; }
.thermal-scenario-form legend { margin-bottom: 5px; color: var(--text-secondary); font-size: 0.66rem; }
.thermal-scenario-form input[type="text"],
.thermal-scenario-form input[type="number"] {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.thermal-segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 34px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}
.thermal-segmented-control label { display: block; }
.thermal-segmented-control input { position: absolute; opacity: 0; pointer-events: none; }
.thermal-segmented-control span {
  display: grid;
  height: 100%;
  min-height: 32px;
  place-items: center;
  padding: 4px 7px;
  border-right: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.65rem;
  white-space: nowrap;
}
.thermal-segmented-control label:last-child span { border-right: 0; }
.thermal-segmented-control input:checked + span { background: rgba(6, 182, 212, 0.12); color: var(--cyan); }
.thermal-segmented-control input:disabled + span { cursor: not-allowed; opacity: 0.55; }

.thermal-scenario-run-state {
  min-width: 0;
  padding: 13px 0 13px 16px;
  border-left: 1px solid var(--border-color);
}
.thermal-scenario-clock { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; }
.thermal-scenario-clock span { color: var(--text-muted); font-size: 0.65rem; }
.thermal-scenario-clock strong { grid-row: 1 / 3; grid-column: 2; color: var(--text-primary); font: 700 1.05rem/1.2 var(--font-mono, monospace); }
.thermal-scenario-clock small { color: var(--text-secondary); font-size: 0.66rem; overflow-wrap: anywhere; }
.thermal-scenario-confirm { margin-top: 9px; }
.thermal-scenario-actions { margin: 9px 0 0; }
.thermal-scenario-actions [hidden] { display: none !important; }

.thermal-scenario-baseline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--border-color);
}
.thermal-scenario-baseline > div {
  min-width: 0;
  padding: 11px 12px;
  border-right: 1px solid var(--border-color);
}
.thermal-scenario-baseline > div:first-child { padding-left: 0; }
.thermal-scenario-baseline > div:last-child { padding-right: 0; border-right: 0; }
.thermal-scenario-baseline span,
.thermal-scenario-baseline strong,
.thermal-scenario-baseline small { display: block; overflow-wrap: anywhere; }
.thermal-scenario-baseline span { display: flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 0.64rem; }
.thermal-scenario-baseline span svg { width: 13px; height: 13px; }
.thermal-scenario-baseline strong { margin-top: 5px; color: var(--text-primary); font-size: 0.75rem; }
.thermal-scenario-baseline small { margin-top: 4px; color: var(--text-muted); font-size: 0.62rem; line-height: 1.4; }
.thermal-scenario-baseline > div.passed span,
.thermal-scenario-baseline > div.passed strong { color: var(--green); }
.thermal-scenario-baseline > div.failed span,
.thermal-scenario-baseline > div.failed strong { color: var(--red); }
.thermal-scenario-baseline > div.collecting span,
.thermal-scenario-baseline > div.collecting strong { color: var(--cyan); }

.thermal-scenario-diagnosis {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}
.thermal-scenario-diagnosis[hidden] { display: none; }
.thermal-scenario-diagnosis strong {
  flex: 0 0 132px;
  color: var(--text-primary);
  font-size: 0.7rem;
}
.thermal-scenario-diagnosis span {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 0.66rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.thermal-scenario-diagnosis.failed strong { color: var(--red); }
.thermal-scenario-diagnosis.warning strong { color: var(--yellow); }
.thermal-scenario-diagnosis.passed strong { color: var(--green); }
.thermal-scenario-diagnosis.collecting strong { color: var(--cyan); }

.thermal-background-legend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
  font-size: 0.62rem;
  white-space: nowrap;
}

.thermal-background-legend i {
  width: 8px;
  height: 8px;
  border: 1px solid rgba(34, 211, 238, 0.95);
}

.thermal-background-legend i:nth-of-type(2) {
  margin-left: 3px;
  border-color: rgba(250, 204, 21, 0.98);
}

.thermal-scenario-rssi {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}
.thermal-scenario-rssi > div {
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid var(--border-color);
}
.thermal-scenario-rssi > div:first-child { padding-left: 0; }
.thermal-scenario-rssi > span,
.thermal-scenario-rssi strong,
.thermal-scenario-rssi small { display: block; overflow-wrap: anywhere; }
.thermal-scenario-rssi span { color: var(--text-muted); font-size: 0.62rem; }
.thermal-scenario-rssi strong { margin-top: 4px; color: var(--text-primary); font-size: 0.72rem; }
.thermal-scenario-rssi small { margin-top: 3px; color: var(--text-muted); font-size: 0.6rem; line-height: 1.4; }
.thermal-scenario-rssi > button { margin-left: 12px; }

.thermal-scenario-hourly-head {
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  padding-top: 8px;
}
.thermal-scenario-hourly-head > div { min-width: 0; gap: 9px; }
.thermal-scenario-hourly-head strong { color: var(--text-primary); font-size: 0.73rem; }
.thermal-scenario-hourly-head span { color: var(--text-muted); font-size: 0.62rem; overflow-wrap: anywhere; }

.thermal-scenario-hourly { min-width: 0; overflow-x: auto; }
.thermal-scenario-hourly > .loading-placeholder { padding: 22px 12px; }
.thermal-scenario-hour-row {
  display: grid;
  grid-template-columns: 78px 90px 84px 96px 94px minmax(190px, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 690px;
  min-height: 40px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.66rem;
}
.thermal-scenario-hour-row.header { min-height: 30px; color: var(--text-muted); font-size: 0.6rem; }
.thermal-scenario-hour-row strong { color: var(--text-primary); }
.thermal-scenario-hour-row .ready { color: var(--green); }
.thermal-scenario-hour-row .collecting { color: var(--cyan); }
.thermal-scenario-hour-row .warning { color: var(--yellow); }
.thermal-scenario-hour-row .failed { color: var(--red); }

.thermal-scenario-history {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding-top: 9px;
  color: var(--text-muted);
  font-size: 0.62rem;
}
.thermal-scenario-history button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}
.thermal-scenario-history button:hover { color: var(--cyan); }

.thermal-multimodal-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

@media (max-width: 1480px) {
  .thermal-fusion-overview {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .thermal-fusion-overview > div:nth-child(4) { border-right: 0; }
  .thermal-fusion-overview > div:nth-child(-n+4) { border-bottom: 1px solid var(--border-color); }
}

@media (max-width: 1120px) {
  .thermal-sensing-grid { grid-template-columns: 1fr; }
  .thermal-sensor-pane:first-child {
    padding-right: 0;
    border-right: 0;
    border-bottom: 1px solid var(--border-color);
  }
  .thermal-sensor-pane:last-child { padding-left: 0; }
}

@media (max-width: 720px) {
  .thermal-fusion-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .thermal-fusion-overview > div:nth-child(2n) { border-right: 0; }
  .thermal-fusion-overview > div:nth-child(-n+6) { border-bottom: 1px solid var(--border-color); }
  .thermal-radar-viewport { height: 240px; }
  .thermal-radar-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .thermal-radar-metrics > div:nth-child(2n) { border-right: 0; }
  .thermal-radar-target-row { grid-template-columns: minmax(72px, 1fr) repeat(2, minmax(62px, 1fr)); }
  .thermal-radar-target-row span:nth-child(n+4) { display: none; }
}

.thermal-multimodal-section {
  min-width: 0;
}

.thermal-multimodal-section:first-child {
  padding-right: 22px;
  border-right: 1px solid var(--border-color);
}

.thermal-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.thermal-section-head > div { min-width: 0; }
.thermal-section-head strong,
.thermal-section-head span { display: block; }
.thermal-section-head strong { color: var(--text-primary); font-size: 0.82rem; }
.thermal-section-head > div > span { margin-top: 3px; color: var(--text-muted); font-size: 0.67rem; }
.thermal-inline-status {
  max-width: 50%;
  color: var(--cyan);
  font-size: 0.7rem;
  line-height: 1.4;
  text-align: right;
  overflow-wrap: anywhere;
}

.thermal-toggle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.thermal-sensitive-toggle { color: var(--yellow) !important; }

.thermal-multimodal-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.thermal-multimodal-fields label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 0.68rem;
}

.thermal-multimodal-fields input {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.thermal-fusion-config-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.thermal-section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 13px 0 10px;
}

.thermal-privacy-state {
  padding: 8px 10px;
  border-left: 3px solid var(--cyan);
  background: rgba(6, 182, 212, 0.06);
  color: var(--text-secondary);
  font-size: 0.7rem;
  line-height: 1.5;
}

.thermal-multimodal-summary {
  margin-top: 9px;
  color: var(--text-secondary);
  font-size: 0.71rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.thermal-probe-device-table {
  max-height: 220px;
  margin-top: 10px;
  overflow: auto;
}

.thermal-probe-device-table table { width: 100%; border-collapse: collapse; min-width: 620px; }
.thermal-probe-device-table th,
.thermal-probe-device-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.66rem;
  text-align: left;
  overflow-wrap: anywhere;
}
.thermal-probe-device-table th { position: sticky; top: 0; background: var(--bg-card); color: var(--text-muted); }

.thermal-history-list {
  max-height: 230px;
  margin-top: 10px;
  overflow-y: auto;
  border-top: 1px solid var(--border-color);
}

.thermal-history-row {
  display: grid;
  grid-template-columns: 76px minmax(92px, auto) minmax(92px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.67rem;
}
.thermal-history-row time,
.thermal-history-row small { color: var(--text-muted); }
.thermal-history-row strong { color: var(--text-primary); }
.thermal-history-row small { text-align: right; overflow-wrap: anywhere; }

.thermal-diagnostics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--border-color);
}

.thermal-diagnostics-grid > div {
  min-width: 0;
  min-height: 66px;
  padding: 10px 12px;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}
.thermal-diagnostics-grid > div:nth-child(3n) { border-right: 0; }
.thermal-diagnostics-grid span,
.thermal-diagnostics-grid strong { display: block; overflow-wrap: anywhere; }
.thermal-diagnostics-grid span { margin-bottom: 6px; color: var(--text-muted); font-size: 0.68rem; }
.thermal-diagnostics-grid strong { color: var(--text-primary); font-size: 0.76rem; line-height: 1.45; }

.thermal-diagnostics-detail {
  min-height: 106px;
  max-height: 230px;
  margin: 13px 0 0;
  padding: 11px 12px;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: rgba(2, 6, 23, 0.42);
  color: var(--text-secondary);
  font: 0.68rem/1.6 var(--font-mono, monospace);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.thermal-diagnostics-history {
  max-height: 250px;
  margin-top: 12px;
  overflow-y: auto;
}

.thermal-diagnostics-history-row {
  display: grid;
  grid-template-columns: 150px minmax(180px, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.68rem;
  line-height: 1.45;
}
.thermal-diagnostics-history-row time { color: var(--text-muted); }
.thermal-diagnostics-history-row strong { color: var(--text-primary); }

.thermal-identity-subtitle {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.thermal-identity-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 14px;
}

.thermal-identity-summary > div {
  min-width: 0;
  padding: 2px 14px 13px;
  border-right: 1px solid var(--border-color);
}

.thermal-identity-summary > div:first-child { padding-left: 0; }
.thermal-identity-summary > div:last-child { border-right: 0; }

.thermal-identity-summary span,
.thermal-identity-summary strong {
  display: block;
  overflow-wrap: anywhere;
}

.thermal-identity-summary span {
  color: var(--text-muted);
  font-size: 0.72rem;
  margin-bottom: 5px;
}

.thermal-identity-summary strong {
  color: var(--text-primary);
  font-size: 0.86rem;
}

.thermal-identity-progress {
  display: grid;
  grid-template-columns: repeat(7, minmax(86px, 1fr));
  overflow-x: auto;
  padding-bottom: 12px;
}

.thermal-identity-step {
  position: relative;
  min-height: 48px;
  padding: 7px 8px 6px 30px;
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.35;
  border-bottom: 2px solid var(--border-color);
}

.thermal-identity-step b {
  position: absolute;
  left: 5px;
  top: 7px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 0.65rem;
}

.thermal-identity-step.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

.thermal-identity-step.done {
  color: var(--green);
  border-bottom-color: var(--green);
}

.thermal-identity-step.failed {
  color: var(--red);
  border-bottom-color: var(--red);
}

.thermal-identity-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 20px;
}

.thermal-identity-editor {
  min-width: 0;
  padding-right: 20px;
  border-right: 1px solid var(--border-color);
}

.thermal-identity-mode {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  margin-bottom: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
}

.thermal-identity-mode label { cursor: pointer; }
.thermal-identity-mode input { position: absolute; opacity: 0; pointer-events: none; }
.thermal-identity-mode span {
  display: block;
  padding: 7px 11px;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-size: 0.74rem;
}
.thermal-identity-mode input:checked + span {
  background: rgba(6, 182, 212, 0.14);
  color: var(--cyan);
}

.thermal-identity-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px 12px;
}

.thermal-identity-fields label,
.thermal-identity-confirm-sn {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 0.72rem;
}

.thermal-identity-fields input,
.thermal-identity-confirm-sn input {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.thermal-identity-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 13px;
}

.thermal-identity-state {
  margin-top: 12px;
  padding-left: 10px;
  border-left: 3px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.74rem;
  line-height: 1.5;
}
.thermal-identity-state.success { border-left-color: var(--green); color: var(--green); }
.thermal-identity-state.error { border-left-color: var(--red); color: var(--red); }
.thermal-identity-state.warning { border-left-color: var(--yellow); color: var(--yellow); }

.thermal-identity-audit-section { min-width: 0; }
.thermal-identity-audit-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--border-color);
}
.thermal-identity-audit-head strong { font-size: 0.8rem; color: var(--text-primary); }
.thermal-identity-audit-head span { font-size: 0.68rem; color: var(--text-muted); }
.thermal-identity-audit { max-height: 310px; overflow-y: auto; }
.thermal-identity-audit-row {
  padding: 11px 0;
  border-bottom: 1px solid var(--border-color);
}
.thermal-identity-audit-row:last-child { border-bottom: 0; }
.thermal-identity-audit-row header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.thermal-identity-audit-row header strong { font-size: 0.76rem; color: var(--text-primary); }
.thermal-identity-audit-row header time { font-size: 0.65rem; color: var(--text-muted); white-space: nowrap; }
.thermal-identity-audit-row p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.thermal-identity-audit-row p b { color: var(--text-secondary); font-weight: 500; }

.thermal-identity-confirm-modal { max-width: 620px; }
.thermal-identity-confirm-summary {
  white-space: pre-line;
  padding: 12px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.65;
}
.thermal-identity-confirm-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 14px 0;
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.45;
}
.thermal-identity-confirm-check input { margin-top: 2px; }

.thermal-ota-subtitle {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.thermal-ota-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.thermal-ota-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: var(--radius-sm);
  background: linear-gradient(145deg, rgba(6, 182, 212, 0.07), rgba(15, 23, 42, 0.52));
}

.thermal-ota-card-head,
.thermal-ota-history-head,
.thermal-ota-task-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.thermal-ota-card-head {
  margin-bottom: 12px;
}

.thermal-ota-card-head strong,
.thermal-ota-history-head strong,
.thermal-ota-task-head strong {
  color: var(--text-primary);
  font-size: 0.86rem;
}

.thermal-ota-card-head span,
.thermal-ota-task-head span {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.thermal-ota-file-picker,
.thermal-ota-upload-fields label,
.thermal-ota-firmware-select {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.thermal-ota-file-picker input,
.thermal-ota-upload-fields input,
.thermal-ota-upload-fields textarea,
.thermal-ota-firmware-select select {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 7px 9px;
  font-family: inherit;
  line-height: 1.45;
  outline: none;
}

.thermal-ota-upload-fields textarea {
  min-height: 76px;
  resize: vertical;
}

.thermal-ota-upload-fields input:focus,
.thermal-ota-upload-fields textarea:focus {
  border-color: var(--cyan);
}

.thermal-ota-file-picker input::file-selector-button {
  margin-right: 10px;
  border: 0;
  border-radius: var(--radius-xs);
  background: rgba(6, 182, 212, 0.14);
  color: var(--cyan);
  padding: 6px 9px;
  cursor: pointer;
}

.thermal-ota-upload-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.thermal-ota-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.thermal-ota-hint,
.thermal-ota-firmware-meta {
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px dashed rgba(148, 163, 184, 0.22);
  border-radius: var(--radius-xs);
  background: rgba(2, 6, 23, 0.32);
  color: var(--text-secondary);
  font-size: 0.72rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.thermal-ota-hint.success {
  border-color: rgba(16, 185, 129, 0.34);
  color: var(--green);
}

.thermal-ota-hint.error {
  border-color: rgba(239, 68, 68, 0.34);
  color: var(--red);
}

.thermal-ota-firmware-meta-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}

.thermal-ota-firmware-meta-head > span {
  min-width: 0;
}

.thermal-ota-delete {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-xs);
  background: rgba(239, 68, 68, 0.08);
  color: var(--red);
  cursor: pointer;
}

.thermal-ota-delete:hover {
  background: rgba(239, 68, 68, 0.16);
}

.thermal-ota-delete svg {
  width: 15px;
  height: 15px;
}

.thermal-ota-force {
  margin-top: 10px;
}

.thermal-ota-current {
  margin-top: 10px;
}

.thermal-ota-task {
  padding: 13px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.5);
}

.thermal-ota-task.current {
  border-color: rgba(6, 182, 212, 0.34);
  box-shadow: inset 3px 0 0 rgba(6, 182, 212, 0.68);
}

.thermal-ota-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-secondary);
  font-size: 0.7rem;
}

.thermal-ota-status.active { color: var(--cyan); background: rgba(6, 182, 212, 0.12); }
.thermal-ota-status.success { color: var(--green); background: rgba(16, 185, 129, 0.12); }
.thermal-ota-status.error { color: var(--red); background: rgba(239, 68, 68, 0.12); }
.thermal-ota-status.warning { color: var(--yellow); background: rgba(245, 158, 11, 0.12); }

.thermal-ota-progress {
  position: relative;
  height: 9px;
  margin: 11px 0 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
}

.thermal-ota-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  transition: width 220ms ease;
}

.thermal-ota-task-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.thermal-ota-task-meta span {
  min-width: 0;
  padding: 7px 8px;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-muted);
  font-size: 0.68rem;
  overflow-wrap: anywhere;
}

.thermal-ota-task-meta strong {
  display: block;
  margin-top: 2px;
  color: var(--text-primary);
  font-size: 0.75rem;
}

.thermal-ota-task-meta .thermal-ota-task-notes {
  grid-column: 1 / -1;
}

.thermal-ota-task-error {
  margin-top: 8px;
  color: var(--red);
  font-size: 0.72rem;
}

.thermal-ota-history-head {
  margin: 16px 0 8px;
}

.thermal-ota-history {
  display: grid;
  gap: 8px;
}

.thermal-ota-records {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.38);
}

.thermal-ota-records > summary {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 13px;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.thermal-ota-records > summary::-webkit-details-marker {
  display: none;
}

.thermal-ota-records > summary:hover {
  background: rgba(148, 163, 184, 0.055);
}

.thermal-ota-records > summary:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: -2px;
}

.thermal-ota-records > summary > span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.thermal-ota-records > summary strong {
  font-size: 0.84rem;
}

.thermal-ota-records > summary small {
  color: var(--text-muted);
  font-size: 0.7rem;
  overflow-wrap: anywhere;
}

.thermal-ota-records > summary svg {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.thermal-ota-records[open] > summary svg {
  transform: rotate(180deg);
}

.thermal-ota-records-body {
  padding: 0 12px 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.thermal-ota-records-body .thermal-ota-history-head {
  margin-top: 10px;
}

.thermal-debug-toolbar,
.thermal-debug-filters {
  display: grid;
  align-items: end;
  gap: 10px;
}

.thermal-debug-toolbar {
  grid-template-columns: minmax(150px, 190px) minmax(150px, 190px) minmax(0, 1fr);
}

.thermal-debug-filters {
  grid-template-columns: minmax(150px, 190px) minmax(220px, 1fr) auto auto;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.thermal-debug-toolbar > label,
.thermal-debug-filters > label:not(.thermal-checkline) {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.thermal-debug-toolbar select,
.thermal-debug-toolbar input,
.thermal-debug-filters select,
.thermal-debug-filters input[type="search"] {
  width: 100%;
  min-width: 0;
  height: 36px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 0 10px;
  font-family: inherit;
  outline: none;
}

.thermal-debug-toolbar select:focus,
.thermal-debug-toolbar input:focus,
.thermal-debug-filters select:focus,
.thermal-debug-filters input[type="search"]:focus {
  border-color: var(--cyan);
}

.thermal-debug-command-actions,
.thermal-debug-data-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.thermal-debug-data-actions {
  justify-content: flex-end;
}

.thermal-debug-command-actions .btn svg,
.thermal-debug-data-actions .btn svg,
.thermal-debug-console-panel .panel-actions .btn svg {
  width: 15px;
  height: 15px;
}

.thermal-debug-autoscroll {
  min-height: 36px;
  align-self: end;
  white-space: nowrap;
}

.thermal-debug-summary {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) repeat(3, minmax(100px, 0.7fr)) minmax(190px, 1.25fr);
  gap: 1px;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: var(--radius-sm);
  background: rgba(148, 163, 184, 0.16);
}

.thermal-debug-summary > span {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  background: rgba(7, 12, 22, 0.92);
}

.thermal-debug-summary small {
  color: var(--text-muted);
  font-size: 0.68rem;
}

.thermal-debug-summary strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thermal-debug-summary .thermal-debug-error-count {
  color: var(--red);
}

.thermal-debug-summary .thermal-debug-drop-count {
  color: var(--yellow);
}

.thermal-debug-log {
  height: 410px;
  margin-top: 12px;
  overflow: auto;
  border: 1px solid rgba(100, 116, 139, 0.32);
  border-radius: var(--radius-sm);
  background: #060a10;
  color: #d7dee8;
  overscroll-behavior: contain;
}

.thermal-debug-log .loading-placeholder {
  min-height: 100%;
  display: grid;
  place-items: center;
}

.thermal-debug-log-row {
  display: grid;
  grid-template-columns: 190px 82px 150px minmax(260px, 1fr);
  gap: 10px;
  align-items: start;
  min-width: 760px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(100, 116, 139, 0.16);
  font-family: var(--font-mono, "SFMono-Regular", Consolas, monospace);
  font-size: 0.7rem;
  line-height: 1.45;
}

.thermal-debug-log-row:last-child {
  border-bottom: 0;
}

.thermal-debug-log-row:hover {
  background: rgba(148, 163, 184, 0.06);
}

.thermal-debug-log-time {
  min-width: 0;
  display: grid;
  gap: 1px;
  color: #aeb9c7;
}

.thermal-debug-log-time strong {
  color: #d7dee8;
  font-size: 0.7rem;
  font-weight: 600;
}

.thermal-debug-log-time small {
  overflow: hidden;
  color: #6f7f91;
  font-size: 0.62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thermal-debug-level {
  width: fit-content;
  min-width: 58px;
  border-radius: var(--radius-xs);
  background: rgba(148, 163, 184, 0.1);
  color: #b9c4d2;
  padding: 2px 6px;
  text-align: center;
  font-size: 0.64rem;
  font-weight: 700;
}

.thermal-debug-log-row.level-verbose .thermal-debug-level { color: #9aa8b8; }
.thermal-debug-log-row.level-debug .thermal-debug-level { color: #c4b5fd; background: rgba(139, 92, 246, 0.12); }
.thermal-debug-log-row.level-info .thermal-debug-level { color: var(--cyan); background: rgba(6, 182, 212, 0.1); }
.thermal-debug-log-row.level-warning .thermal-debug-level { color: var(--yellow); background: rgba(245, 158, 11, 0.12); }
.thermal-debug-log-row.level-error .thermal-debug-level,
.thermal-debug-log-row.level-fatal .thermal-debug-level { color: #fca5a5; background: rgba(239, 68, 68, 0.14); }

.thermal-debug-log-row code {
  min-width: 0;
  overflow: hidden;
  color: #7dd3fc;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thermal-debug-message {
  min-width: 0;
  color: #d7dee8;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.thermal-debug-status {
  margin-top: 7px;
  color: var(--text-muted);
  font-size: 0.68rem;
  text-align: right;
}

.thermal-register-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.thermal-register-form input,
.thermal-register-form select,
.thermal-custom-command input,
.thermal-custom-command select,
.thermal-custom-command textarea {
  height: 36px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-xs);
  padding: 0 10px;
  font-family: inherit;
  outline: none;
}

.thermal-custom-command textarea {
  min-height: 76px;
  padding: 9px 10px;
  line-height: 1.45;
  resize: vertical;
}

.thermal-register-form input:focus,
.thermal-register-form select:focus,
.thermal-custom-command input:focus,
.thermal-custom-command select:focus,
.thermal-custom-command textarea:focus {
  border-color: var(--accent);
}

.thermal-module-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 480px;
  overflow: auto;
}

.thermal-module-item {
  width: 100%;
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition), opacity var(--transition), filter var(--transition);
}

.thermal-module-item:hover {
  border-color: rgba(6,182,212,0.45);
  background: rgba(6,182,212,0.08);
}

.thermal-module-list.has-selection .thermal-module-item:not(.active) {
  opacity: 0.5;
  filter: saturate(0.55);
}

.thermal-module-list.has-selection .thermal-module-item:not(.active):hover,
.thermal-module-list.has-selection .thermal-module-item:not(.active):focus-visible {
  opacity: 0.86;
  filter: saturate(0.85);
}

.thermal-module-item.active {
  opacity: 1;
  border-color: rgba(34, 211, 238, 0.9);
  background: rgba(6, 182, 212, 0.14);
  box-shadow: inset 4px 0 0 var(--cyan), 0 0 0 1px rgba(34, 211, 238, 0.18);
}

.thermal-module-item:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.thermal-module-main,
.thermal-module-meta,
.thermal-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.thermal-module-main strong {
  color: var(--text-primary);
}

.thermal-module-title-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.thermal-module-selected-label {
  display: none;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.15);
  color: #67e8f9;
  padding: 2px 6px;
  font-size: 0.62rem;
  font-weight: 700;
}

.thermal-module-item.active .thermal-module-selected-label {
  display: inline-flex;
}

.thermal-module-main span,
.thermal-module-meta {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.thermal-status {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(148,163,184,0.12);
}
.thermal-status.online { color: var(--green); background: rgba(16,185,129,0.12); }
.thermal-status.stale { color: var(--yellow); background: rgba(245,158,11,0.12); }
.thermal-status.offline { color: var(--text-muted); }
.thermal-status.error { color: var(--red); background: rgba(239,68,68,0.12); }
.thermal-status.provisioned { color: var(--yellow); background: rgba(245,158,11,0.12); }
.thermal-status.maintenance { color: var(--cyan); background: rgba(6,182,212,0.1); }
.thermal-status.unknown { color: var(--text-muted); background: rgba(148,163,184,0.12); }

/* ============================================================
   TOF PEOPLE COUNTER LAB
   ============================================================ */
.tof-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
}

.tof-devices-panel,
.tof-protocol-panel {
  align-self: start;
}

.tof-events-panel {
  grid-column: 1 / 2;
}

.tof-log-panel {
  grid-column: 2 / 3;
  min-width: 0;
}

.tof-register-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.tof-register-form input,
.tof-register-form select,
.tof-config-grid input,
.tof-config-grid select,
.tof-command-bar input {
  height: 36px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-xs);
  padding: 0 10px;
  font-family: inherit;
  outline: none;
}

.tof-register-form input:focus,
.tof-register-form select:focus,
.tof-config-grid input:focus,
.tof-config-grid select:focus,
.tof-command-bar input:focus {
  border-color: var(--accent);
}

.tof-device-list,
.tof-event-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 460px;
  overflow: auto;
}

.tof-device-item,
.tof-event-item {
  width: 100%;
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: left;
}

.tof-device-item {
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.tof-device-item:hover,
.tof-device-item.active {
  border-color: rgba(16,185,129,0.42);
  background: rgba(16,185,129,0.08);
}

.tof-device-main,
.tof-device-meta,
.tof-event-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tof-device-main strong,
.tof-event-head strong {
  color: var(--text-primary);
}

.tof-device-main span,
.tof-device-meta,
.tof-event-item p {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.tof-live-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.tof-heatmap-wrap {
  position: relative;
  min-height: 330px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #05070d;
  overflow: hidden;
  display: grid;
  place-items: center;
}

#tofHeatmapCanvas {
  width: 100%;
  height: 100%;
  min-height: 330px;
  image-rendering: pixelated;
}

.tof-heatmap-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  color: var(--text-muted);
  text-align: center;
  pointer-events: none;
}

.tof-frame-meta,
.tof-command-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.tof-frame-meta span {
  padding: 5px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(148,163,184,0.14);
  background: rgba(15,23,42,0.42);
  color: var(--text-muted);
  font-size: 0.72rem;
}

.tof-command-bar input {
  width: 120px;
}

.tof-config-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.tof-config-grid label {
  display: grid;
  gap: 5px;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.tof-event-item p {
  margin: 6px 0 0;
}

@media (max-width: 1180px) {
  .tof-grid {
    grid-template-columns: 1fr;
  }
  .tof-events-panel,
  .tof-log-panel {
    grid-column: 1;
  }
  .tof-config-grid,
  .tof-live-summary {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

@media (max-width: 720px) {
  .tof-config-grid,
  .tof-live-summary {
    grid-template-columns: 1fr;
  }
}

.thermal-canvas-wrap {
  position: relative;
  height: 360px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #05070d;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.thermal-canvas-wrap.is-panning {
  cursor: grabbing;
}

.thermal-canvas-stage {
  position: relative;
  width: min(100%, 640px);
  max-height: 360px;
  aspect-ratio: 4 / 3;
  transform-origin: center center;
  will-change: transform;
}

.thermal-sensing-grid .thermal-canvas-wrap {
  height: 280px;
}

.thermal-sensing-grid .thermal-canvas-stage {
  max-height: 280px;
}

@media (max-width: 720px) {
  .thermal-sensing-grid .thermal-canvas-wrap {
    height: 240px;
  }

  .thermal-sensing-grid .thermal-canvas-stage {
    max-height: 240px;
  }
}

#thermalDebugCanvas {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: fill;
  image-rendering: pixelated;
}

.thermal-annotation-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: crosshair;
  touch-action: none;
}

.thermal-annotation-overlay:hover {
  cursor: crosshair;
}

.thermal-canvas-wrap.is-panning .thermal-annotation-overlay {
  cursor: grabbing;
}

.thermal-cursor-overlay {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 3;
  display: grid;
  gap: 3px;
  min-width: 86px;
  padding: 8px 10px;
  border: 1px solid rgba(148,163,184,0.16);
  border-radius: var(--radius-xs);
  background: rgba(2,6,23,0.78);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  pointer-events: none;
}

.thermal-cursor-overlay strong {
  color: var(--yellow);
  font-weight: 700;
}

.thermal-annotation-box {
  position: absolute;
  border: 2px solid rgba(34,197,94,0.95);
  background: rgba(34,197,94,0.13);
  border-radius: 3px;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(15,23,42,0.55);
}

.thermal-annotation-box.pending {
  border-color: rgba(6,182,212,0.98);
  background: rgba(6,182,212,0.16);
}

.thermal-annotation-box.algorithm {
  border-color: rgba(251,191,36,0.95);
  background: rgba(251,191,36,0.12);
}

.thermal-annotation-box.saved {
  border-color: rgba(34,197,94,0.95);
  background: rgba(34,197,94,0.13);
}

.thermal-annotation-box span {
  position: absolute;
  left: -2px;
  top: -24px;
  max-width: 180px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(2,6,23,0.88);
  color: var(--text-primary);
  font-size: 0.68rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thermal-canvas-empty {
  position: absolute;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.thermal-frame-stats,
.thermal-command-bar,
.thermal-custom-command {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.thermal-frame-stats span {
  padding: 6px 9px;
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  font-size: 0.76rem;
}

.thermal-version-info {
  margin-top: 12px;
  border: 1px solid rgba(96,165,250,0.18);
  border-radius: var(--radius-sm);
  background: rgba(15,23,42,0.42);
  overflow: hidden;
}

.thermal-version-head,
.thermal-version-empty {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  color: var(--text-secondary);
  font-size: 0.76rem;
}

.thermal-version-empty {
  flex-direction: column;
}

.thermal-version-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: rgba(148,163,184,0.12);
}

.thermal-version-grid section {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 11px 12px;
  background: rgba(15,23,42,0.94);
}

.thermal-version-grid section > span,
.thermal-version-grid small {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.thermal-version-grid strong {
  overflow-wrap: anywhere;
  color: var(--text-primary);
  font-size: 0.82rem;
}

@media (max-width: 980px) {
  .thermal-version-grid {
    grid-template-columns: 1fr;
  }
}

.thermal-frame-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.thermal-frame-meta span {
  padding: 5px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(148,163,184,0.14);
  background: rgba(15,23,42,0.42);
  color: var(--text-muted);
  font-size: 0.72rem;
}

.thermal-frame-playback {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.thermal-frame-playback input[type="range"] {
  width: 100%;
  min-width: 0;
}

.thermal-frame-playback span {
  padding: 5px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(148,163,184,0.14);
  background: rgba(15,23,42,0.42);
  color: var(--text-muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.thermal-background-quick-controls {
  display: grid;
  grid-template-columns: minmax(130px, 0.4fr) minmax(150px, 0.5fr) minmax(220px, 1fr) auto;
  align-items: end;
  gap: 8px;
  margin-top: 10px;
}

.thermal-background-quick-controls label {
  margin: 0;
}

.thermal-background-quick-controls > span {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px dashed rgba(148,163,184,0.18);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  background: rgba(15,23,42,0.34);
  font-size: 0.72rem;
}

.thermal-live-annotation {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(99,102,241,0.28);
  border-radius: var(--radius-sm);
  background: rgba(99,102,241,0.06);
}

.thermal-live-annotation-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.thermal-live-annotation-head strong {
  color: var(--text-primary);
  font-size: 0.9rem;
}

.thermal-live-annotation-head span {
  color: var(--text-muted);
  font-size: 0.72rem;
  text-align: right;
}

.thermal-live-annotation-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px;
}

.thermal-live-annotation-controls label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.thermal-live-annotation-controls select,
.thermal-live-annotation-controls input {
  height: 34px;
  min-width: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 0 9px;
}

.thermal-custom-command {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(280px, 1.1fr) auto;
  align-items: start;
}

.thermal-custom-command select {
  height: 40px;
}

.thermal-custom-command > .btn {
  min-width: 78px;
  min-height: 40px;
}

.thermal-device-agent-panel {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.thermal-device-agent-card,
.thermal-aiot-contract-card {
  display: grid;
  gap: 10px;
}

.thermal-device-agent-form {
  grid-template-columns: minmax(140px, 0.45fr) minmax(220px, 1fr) minmax(180px, 0.72fr);
}

.thermal-inline-setting {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid rgba(148,163,184,0.16);
  border-radius: var(--radius-xs);
  background: rgba(15,23,42,0.38);
  color: var(--text-muted);
  font-size: 0.72rem;
}

.thermal-inline-setting input {
  width: 72px;
  height: 28px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 0 8px;
}

.thermal-ai-toolbar,
.thermal-training-toolbar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.thermal-ai-toolbar select,
.thermal-training-toolbar select {
  min-width: 260px;
  height: 34px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 0 10px;
}

.thermal-training-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--text-muted);
  font-size: 0.74rem;
}

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

.thermal-ai-summary .metric-card {
  min-height: 96px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: rgba(255,255,255,0.035);
}

.thermal-ai-summary .metric-card.highlight {
  border-color: rgba(6,182,212,0.45);
  background: rgba(6,182,212,0.08);
}

.thermal-ai-summary .metric-card span,
.thermal-ai-summary .metric-card small {
  display: block;
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.thermal-ai-summary .metric-card strong {
  display: block;
  margin: 7px 0 4px;
  font-size: 1.35rem;
  color: var(--text-primary);
}

.thermal-compare-table {
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
}

.thermal-compare-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(6,182,212,0.08);
  color: var(--text-secondary);
  font-size: 0.76rem;
}

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

.thermal-compare-table th,
.thermal-compare-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  color: var(--text-secondary);
  font-size: 0.78rem;
  vertical-align: top;
}

.thermal-compare-table th {
  color: var(--text-muted);
  background: rgba(255,255,255,0.035);
  font-weight: 600;
}

.thermal-compare-table tr:last-child td {
  border-bottom: 0;
}

.thermal-training-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: 12px;
}

.thermal-tooling-panel {
  grid-column: 1 / -1;
}

.thermal-tooling-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 12px;
}

.thermal-tool-card {
  min-height: 210px;
  padding: 13px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.025);
}

.thermal-tool-card h4 {
  margin: 0 0 12px;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.thermal-tool-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.thermal-tool-card select,
.thermal-tool-card input {
  min-width: 0;
  height: 34px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 0 10px;
}

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

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

.thermal-record-rate-hint {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.thermal-background-display-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 0.9fr);
  gap: 8px;
}

.thermal-checkline {
  min-height: 34px;
  flex-direction: row !important;
  align-items: center;
  justify-content: flex-start;
  padding: 0 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
  color: var(--text-primary) !important;
}

.thermal-checkline input {
  width: 16px !important;
  height: 16px !important;
  padding: 0 !important;
}

.thermal-tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.thermal-tool-summary {
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid rgba(148,163,184,0.16);
  border-radius: var(--radius-xs);
  background: rgba(15,23,42,0.45);
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.45;
}

.thermal-fusion-summary {
  margin-top: 8px;
}

.thermal-fusion-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.thermal-fusion-grid span {
  display: block;
  min-width: 0;
  padding: 7px 8px;
  border-radius: var(--radius-xs);
  background: rgba(6,182,212,0.08);
  color: var(--text-muted);
  font-size: 0.68rem;
}

.thermal-fusion-grid strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text-primary);
  font-size: 0.88rem;
}

.thermal-fusion-detail {
  color: var(--text-secondary);
  font-size: 0.72rem;
}

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

.thermal-box-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0 8px;
}

.thermal-box-row input,
.thermal-note-input {
  width: 100%;
  min-width: 0;
  height: 32px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 0 9px;
}

.thermal-note-input {
  margin-bottom: 2px;
}

.thermal-annotation-summary {
  max-height: 118px;
  overflow: auto;
}

.thermal-annotation-entry {
  display: block;
  padding-bottom: 5px;
  margin-bottom: 5px;
  border-bottom: 1px solid rgba(148,163,184,0.12);
}

.thermal-annotation-entry:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: 0;
}

.thermal-migration-list {
  display: grid;
  gap: 8px;
  max-height: 190px;
  overflow: auto;
  padding-right: 4px;
}

.thermal-migration-item {
  padding: 9px 10px;
  border: 1px solid var(--border-color);
  border-left-width: 3px;
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.025);
}

.thermal-migration-item.done {
  border-left-color: rgba(34,197,94,0.8);
}

.thermal-migration-item.todo {
  border-left-color: rgba(245,158,11,0.85);
}

.thermal-migration-item strong,
.thermal-migration-item span {
  display: block;
  line-height: 1.45;
}

.thermal-migration-item strong {
  color: var(--text-primary);
  font-size: 0.76rem;
}

.thermal-migration-item span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.72rem;
}

.thermal-sample-list,
.thermal-model-list {
  min-height: 180px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
  padding: 10px;
}

.thermal-sample-item,
.thermal-model-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.035);
  margin-bottom: 8px;
}

.thermal-sample-item:last-child,
.thermal-model-item:last-child {
  margin-bottom: 0;
}

.thermal-sample-item strong,
.thermal-model-item strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.thermal-sample-item span,
.thermal-model-item span {
  display: block;
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.protocol-lines {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.protocol-lines div {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.protocol-lines span {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.protocol-lines code {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--cyan);
  background: rgba(6,182,212,0.08);
  border: 1px solid rgba(6,182,212,0.14);
  border-radius: var(--radius-xs);
  padding: 6px 8px;
  font-size: 0.72rem;
}

.protocol-term-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  color: var(--cyan);
}

.thermal-message-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 460px;
  overflow: auto;
}

.thermal-log-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  padding: 10px;
}

.thermal-log-item.downlink {
  border-color: rgba(99,102,241,0.25);
}

.thermal-log-head span {
  color: var(--accent-light);
  font-size: 0.7rem;
  font-weight: 700;
}

.thermal-log-head code {
  flex: 1;
  color: var(--text-secondary);
  font-size: 0.7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thermal-log-time {
  color: var(--text-muted);
  font-size: 0.7rem;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 150px;
  text-align: right;
}

.thermal-log-time strong {
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 700;
}

.thermal-log-time span,
.thermal-log-time small {
  color: var(--text-muted);
  font-size: 0.66rem;
  line-height: 1.1;
}

.thermal-log-item pre {
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
  font-size: 0.7rem;
  line-height: 1.45;
}

/* ============================================================
   USER & RBAC MANAGEMENT
   ============================================================ */
.users-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.users-panel {
  min-width: 0;
}

.users-side-panel,
.roles-panel {
  align-self: start;
}

.roles-panel {
  grid-column: 1 / -1;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.role-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.role-card {
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 14px;
}

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

.role-card-header strong {
  color: var(--text-primary);
}

.role-card-header span {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.role-card p {
  min-height: 34px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.5;
  margin-bottom: 12px;
}

.permission-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.permission-tags span {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px 7px;
  border-radius: var(--radius-xs);
  background: rgba(99,102,241,0.1);
  color: var(--accent-light);
  font-size: 0.68rem;
}

.permission-tags .term-note,
.role-card-header .term-note,
.nav-badge-new .term-note {
  font-size: 0.58rem;
}

/* ============================================================
   AUDIT LOG MANAGEMENT
   ============================================================ */
.logs-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.audit-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.audit-summary-card {
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.audit-summary-card span {
  color: var(--text-secondary);
  font-size: 0.76rem;
}

.audit-summary-card strong {
  color: var(--text-primary);
  font-size: 1.7rem;
  line-height: 1;
}

.audit-summary-card small {
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.4;
}

.login-logs-panel,
.operation-logs-panel {
  min-width: 0;
}

.login-logs-panel .data-table td,
.operation-logs-panel .data-table td {
  vertical-align: top;
}

.login-logs-panel code,
.operation-logs-panel code {
  font-size: 0.72rem;
  color: var(--cyan);
}

/* ============================================================
   RULE ENGINE
   ============================================================ */
.rule-engine-hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding: 20px 22px;
  margin-bottom: 18px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.14), rgba(34, 197, 94, 0.08)), var(--panel-bg);
}

.rule-engine-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--cyan);
  font-size: 0.76rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.rule-engine-hero h2 {
  margin: 0 0 8px;
  font-size: 1.55rem;
}

.rule-engine-hero p {
  margin: 0;
  max-width: 760px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.rule-engine-auth-note {
  margin-top: 8px !important;
  font-size: 0.78rem;
  color: var(--text-muted) !important;
}

.rule-engine-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 320px;
}

.rule-engine-stats {
  margin-bottom: 18px;
}

.rule-device-agent-panel {
  margin-bottom: 18px;
}

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

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

.rule-device-agent-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.rule-device-agent-kpis div {
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-xs);
  background: rgba(15, 23, 42, 0.36);
}

.rule-device-agent-kpis strong {
  display: block;
  font-size: 1rem;
  color: var(--cyan);
}

.rule-device-agent-kpis span {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.7rem;
}

.rule-device-agent-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.rule-device-agent-gates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rule-device-agent-gate {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.42);
  color: var(--text-secondary);
  font-size: 0.7rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.rule-device-agent-gate.pass {
  color: var(--green);
  border-color: rgba(34, 197, 94, 0.32);
  background: rgba(22, 163, 74, 0.1);
}

.rule-device-agent-gate.warn {
  color: var(--orange);
  border-color: rgba(245, 158, 11, 0.34);
  background: rgba(245, 158, 11, 0.1);
}

.rule-device-agent-gate.block {
  color: var(--danger-color);
  border-color: rgba(239, 68, 68, 0.34);
  background: rgba(239, 68, 68, 0.1);
}

.rule-object-panel {
  margin-bottom: 18px;
}

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

.rule-object-summary div {
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.32);
}

.rule-object-summary strong {
  display: block;
  font-size: 1.25rem;
  color: var(--cyan);
}

.rule-object-summary span {
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.rule-object-chain {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(150px, 0.8fr) auto minmax(180px, 1fr) auto minmax(190px, 1fr);
  gap: 10px;
  align-items: stretch;
}

.rule-object-chain > b {
  align-self: center;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.rule-chain-node {
  min-height: 94px;
  padding: 12px;
  border: 1px solid rgba(99, 102, 241, 0.32);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.44);
}

.rule-chain-node span {
  display: inline-block;
  margin-bottom: 8px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.18);
  color: var(--text-secondary);
  font-size: 0.72rem;
}

.rule-chain-node strong {
  display: block;
  line-height: 1.35;
}

.rule-chain-node small {
  display: block;
  margin-top: 8px;
  color: var(--text-muted);
  word-break: break-word;
}

.rule-chain-node.source { border-color: rgba(14, 165, 233, 0.45); }
.rule-chain-node.event { border-color: rgba(34, 197, 94, 0.45); }
.rule-chain-node.material { border-color: rgba(245, 158, 11, 0.45); }
.rule-chain-node.action { border-color: rgba(168, 85, 247, 0.45); }

.rule-chain-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.rule-chain-steps span {
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.55);
  color: var(--text-secondary);
  font-size: 0.76rem;
}

.rule-stat-card.online {
  border-top: 3px solid var(--green);
}

.rule-stat-card.offline {
  border-top: 3px solid var(--orange);
}

.rule-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.rule-status-dot.online {
  background: var(--green);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.7);
}

.rule-status-dot.offline {
  background: var(--orange);
}

.rule-engine-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
}

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

.rule-template-card {
  width: 100%;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  text-align: left;
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.38);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.rule-template-card:hover,
.rule-template-card.active {
  border-color: rgba(99, 102, 241, 0.8);
  background: rgba(30, 41, 59, 0.72);
  transform: translateY(-1px);
}

.rule-template-state {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  font-weight: 800;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.rule-template-state.s0 { background: rgba(239, 68, 68, 0.18); border-color: rgba(239, 68, 68, 0.42); }
.rule-template-state.s1 { background: rgba(34, 197, 94, 0.18); border-color: rgba(34, 197, 94, 0.42); }
.rule-template-state.s2 { background: rgba(14, 165, 233, 0.18); border-color: rgba(14, 165, 233, 0.42); }
.rule-template-state.s3 { background: rgba(245, 158, 11, 0.18); border-color: rgba(245, 158, 11, 0.42); }
.rule-template-state.s4 { background: rgba(168, 85, 247, 0.18); border-color: rgba(168, 85, 247, 0.42); }

.rule-template-card strong {
  display: block;
  margin-bottom: 5px;
}

.rule-template-card p {
  margin: 0 0 8px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.55;
}

.rule-template-meta,
.rule-template-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.rule-template-meta span,
.rule-template-flow span {
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.12);
}

.rule-template-flow {
  margin-top: 8px;
}

.rule-template-flow b {
  color: var(--text-muted);
}

.rule-template-scope {
  margin-top: 8px;
  color: var(--cyan);
  font-size: 0.74rem;
}

.rule-template-canvas-preview {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(99, 102, 241, 0.32);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.45);
}

.rule-canvas-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.rule-canvas-preview-head div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.rule-canvas-preview-head span,
.rule-template-canvas-preview p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.5;
}

.rule-canvas-preview-head code {
  color: var(--cyan);
  font-size: 0.72rem;
  word-break: break-all;
}

.rule-canvas-preview-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: var(--text-muted);
}

.rule-canvas-preview-flow span {
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.16);
  color: var(--text-secondary);
  font-size: 0.74rem;
}

.rule-test-form {
  display: grid;
  gap: 12px;
}

.rule-test-form label {
  display: grid;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.rule-test-form input,
.rule-test-form textarea,
.rule-test-form select {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: var(--input-bg);
  color: var(--text-primary);
  padding: 9px 10px;
  font-size: 0.84rem;
}

.rule-test-form textarea {
  min-height: 82px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.rule-test-advanced {
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
}

.rule-test-advanced summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.78rem;
}

.rule-test-advanced textarea {
  margin-top: 8px;
}

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

.rule-test-result {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.5);
  padding: 10px;
  display: grid;
  gap: 5px;
  color: var(--text-secondary);
}

.rule-test-result code {
  white-space: normal;
  word-break: break-all;
  color: var(--cyan);
}

.rule-action-preview {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.42);
  padding: 10px;
}

.rule-action-preview-head,
.rule-action-preview-title,
.rule-action-target-main,
.rule-action-target-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rule-action-preview-head {
  justify-content: space-between;
}

.rule-action-preview-head div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.rule-action-preview-head span,
.rule-action-preview-title span,
.rule-action-preview-title em,
.rule-action-target small,
.rule-action-target-meta span {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-style: normal;
}

.rule-action-preview-list {
  display: grid;
  gap: 8px;
}

.rule-action-preview-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.38);
}

.rule-action-preview-title {
  justify-content: space-between;
}

.rule-action-preview-title strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.rule-action-target {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  background: rgba(30, 41, 59, 0.42);
}

.rule-action-target.automation,
.rule-action-target.direct,
.rule-action-target.readonly {
  border-left-color: var(--green);
}

.rule-action-target.approval,
.rule-action-target.confirm,
.rule-action-target.preview {
  border-left-color: var(--orange);
}

.rule-action-target.blocked,
.rule-action-target.error {
  border-left-color: var(--danger-color);
}

.rule-action-target-main {
  justify-content: space-between;
}

.rule-action-target-main > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.rule-action-target-main b {
  white-space: nowrap;
  font-size: 0.78rem;
  color: var(--text-primary);
}

.rule-action-target-meta {
  flex-wrap: wrap;
}

.rule-action-target-meta span {
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.12);
}

.rule-action-target p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.5;
}

.rule-risk-badge {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 26px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.rule-risk-badge.l0 { color: var(--cyan); background: rgba(14, 165, 233, 0.13); }
.rule-risk-badge.l1 { color: var(--green); background: rgba(34, 197, 94, 0.13); }
.rule-risk-badge.l2 { color: var(--orange); background: rgba(245, 158, 11, 0.13); }
.rule-risk-badge.l3 { color: var(--danger-color); background: rgba(239, 68, 68, 0.13); }

.rule-action-reasons {
  display: grid;
  gap: 4px;
}

.rule-action-reasons code,
.rule-action-preview-error {
  white-space: normal;
  word-break: break-word;
  color: var(--orange);
  font-size: 0.72rem;
}

.rule-run-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.rule-run-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.36);
  overflow: hidden;
}

.rule-run-card.status-failed {
  border-color: rgba(239, 68, 68, 0.42);
}

.rule-run-card.status-success {
  border-color: rgba(34, 197, 94, 0.25);
}

.rule-run-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
}

.rule-run-row div {
  display: grid;
  gap: 4px;
}

.rule-run-row span,
.rule-run-row em {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-style: normal;
}

.rule-run-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.rule-run-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  padding: 2px 7px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 6px;
  color: var(--text-secondary);
  background: rgba(15, 23, 42, 0.42);
  font-size: 0.7rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.rule-run-badge.automation {
  border-color: rgba(34, 197, 94, 0.36);
  color: var(--green);
  background: rgba(22, 163, 74, 0.1);
}

.rule-run-badge.approval {
  border-color: rgba(245, 158, 11, 0.38);
  color: var(--orange);
  background: rgba(245, 158, 11, 0.1);
}

.rule-run-badge.muted,
.rule-run-badge.preview {
  color: var(--text-muted);
}

.rule-run-detail {
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(15, 23, 42, 0.28);
}

.rule-run-detail summary {
  cursor: pointer;
  padding: 8px 12px;
  color: var(--cyan);
  font-size: 0.76rem;
  user-select: none;
}

.rule-run-agent-list,
.rule-run-plain-output {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.rule-run-plain-output span {
  color: var(--text-secondary);
  font-size: 0.76rem;
}

.rule-run-agent-card {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.46);
}

.rule-run-agent-card.automation,
.rule-run-agent-card.direct {
  border-left-color: var(--green);
}

.rule-run-agent-card.approval,
.rule-run-agent-card.preview {
  border-left-color: var(--orange);
}

.rule-run-agent-card.blocked {
  border-left-color: var(--danger-color);
}

.rule-run-agent-head,
.rule-run-command-summary,
.rule-run-workorder-summary {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rule-run-agent-head {
  justify-content: space-between;
}

.rule-run-agent-head > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.rule-run-agent-head small,
.rule-run-command-summary span,
.rule-run-workorder-summary span,
.rule-run-command-summary em,
.rule-run-workorder-summary em {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-style: normal;
}

.rule-run-agent-head b {
  white-space: nowrap;
  color: var(--text-primary);
  font-size: 0.78rem;
}

.rule-run-agent-grid {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 5px 8px;
  color: var(--text-secondary);
  font-size: 0.74rem;
}

.rule-run-agent-grid span {
  color: var(--text-muted);
}

.rule-run-agent-grid b {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 600;
  color: var(--text-primary);
}

.rule-run-command-summary,
.rule-run-workorder-summary {
  flex-wrap: wrap;
  padding: 7px 8px;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.52);
}

.rule-run-command-summary code,
.rule-run-workorder-summary code {
  color: var(--cyan);
  white-space: normal;
  word-break: break-word;
  font-size: 0.72rem;
}

.entry-face-gallery,
.face-gallery-section {
  display: grid;
  gap: 12px;
}

.entry-gallery-metrics,
.face-gallery-summary,
.twin-gallery-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 8px;
}

.entry-gallery-metrics > div,
.face-gallery-summary > div,
.twin-gallery-metrics > div {
  background: rgba(15, 23, 42, 0.52);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
  min-width: 0;
}

.entry-gallery-metrics span,
.face-gallery-summary span,
.twin-gallery-metrics span {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
  margin-bottom: 4px;
}

.entry-gallery-metrics strong,
.face-gallery-summary strong,
.twin-gallery-metrics strong {
  color: var(--text-primary);
  font-size: 1.1rem;
}

.entry-gallery-actions,
.face-gallery-actions,
.face-gallery-form-actions,
.face-gallery-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.entry-gallery-person {
  display: grid;
  gap: 4px;
  text-align: left;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.48);
  color: var(--text-primary);
  padding: 10px;
  cursor: pointer;
}

.entry-gallery-person span,
.entry-gallery-person em {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-style: normal;
}

.entry-gallery-person em.success,
.face-gallery-person-head em.success,
.face-gallery-scan-row em.success {
  color: var(--success-color);
}

.entry-gallery-person em.warning,
.face-gallery-person-head em.warning,
.face-gallery-scan-row em.warning {
  color: var(--warning-color);
}

.entry-gallery-person em.danger,
.face-gallery-person-head em.danger,
.face-gallery-scan-row em.danger {
  color: var(--danger-color);
}

.glass-modal.face-gallery-modal {
  width: min(96vw, 1180px);
  max-width: 1180px;
  max-height: 92vh;
  overflow: hidden;
}

.glass-modal.face-gallery-modal .modal-body {
  max-height: calc(92vh - 58px);
  overflow: auto;
}

.face-gallery-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.face-gallery-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(420px, 1fr);
  gap: 16px;
  align-items: start;
}

.face-gallery-people-list {
  display: grid;
  gap: 10px;
  max-height: 58vh;
  overflow: auto;
  padding-right: 4px;
}

.face-gallery-person-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.46);
  padding: 12px;
}

.face-gallery-person-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.face-gallery-person-head button {
  display: grid;
  gap: 2px;
  background: transparent;
  border: 0;
  color: var(--text-primary);
  text-align: left;
  padding: 0;
  min-width: 0;
  cursor: pointer;
}

.face-gallery-person-head span,
.face-gallery-person-meta,
.face-gallery-scan-row small,
.twin-gallery-mini-list small {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.face-gallery-person-head em,
.face-gallery-scan-row em {
  font-style: normal;
  font-size: 0.72rem;
  white-space: nowrap;
}

.face-gallery-person-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.face-gallery-scan-list {
  display: grid;
  gap: 6px;
}

.face-gallery-scan-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  padding-top: 8px;
}

.face-gallery-scan-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.face-gallery-scan-thumb {
  width: 78px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.52);
  color: var(--text-muted);
  font-size: 0.68rem;
  text-align: center;
  padding: 0;
}

.face-gallery-scan-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.face-gallery-scan-thumb.pending {
  gap: 4px;
  padding: 6px;
}

.face-gallery-scan-thumb.empty {
  padding: 6px;
  opacity: 0.72;
}

.face-gallery-scan-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.face-gallery-face-preview {
  display: grid;
  place-items: center;
  min-height: 150px;
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.42);
  overflow: hidden;
  color: var(--text-muted);
}

.face-gallery-face-preview img {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
}

.face-gallery-face-preview span {
  padding: 10px;
  text-align: center;
}

.twin-face-gallery-preview {
  gap: 10px;
}

.twin-gallery-mini-list {
  display: grid;
  gap: 8px;
}

.twin-gallery-mini-list > span {
  display: grid;
  gap: 2px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 8px;
  padding: 8px;
  background: rgba(15, 23, 42, 0.42);
}

@media (max-width: 960px) {
  .thermal-scenario-control-grid { grid-template-columns: 1fr; }
  .thermal-scenario-form { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-right: 0; }
  .thermal-scenario-name { grid-column: 1 / -1; }
  .thermal-scenario-run-state { padding-left: 0; border-left: 0; border-top: 1px solid var(--border-color); }
  .thermal-scenario-baseline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .thermal-scenario-baseline > div:nth-child(2n) { border-right: 0; }
  .thermal-scenario-baseline > div:nth-child(-n+2) { border-bottom: 1px solid var(--border-color); }
  .thermal-scenario-baseline > div:nth-child(3) { padding-left: 0; }
  .thermal-scenario-rssi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .thermal-scenario-rssi > div:nth-child(2) { border-right: 0; }
  .thermal-scenario-rssi > div:nth-child(3) { padding-left: 0; border-top: 1px solid var(--border-color); }
  .thermal-scenario-rssi > button { justify-self: end; margin: 10px 0; }

  .thermal-multimodal-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .thermal-multimodal-metrics > div:nth-child(3n) { border-right: 0; }

  .thermal-multimodal-layout {
    grid-template-columns: 1fr;
  }

  .thermal-multimodal-section:first-child {
    padding-right: 0;
    padding-bottom: 18px;
    border-right: 0;
    border-bottom: 1px solid var(--border-color);
  }

  .thermal-debug-toolbar,
  .thermal-debug-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .thermal-debug-command-actions,
  .thermal-debug-data-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .thermal-debug-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .rule-engine-hero,
  .rule-run-row {
    flex-direction: column;
    align-items: stretch;
  }
  .rule-engine-actions {
    justify-content: flex-start;
    min-width: 0;
  }
  .rule-engine-grid {
    grid-template-columns: 1fr;
  }
  .rule-device-agent-grid,
  .rule-device-agent-kpis {
    grid-template-columns: 1fr;
  }
  .rule-object-summary,
  .rule-object-chain {
    grid-template-columns: 1fr;
  }
  .rule-object-chain > b {
    justify-self: start;
  }
  .banner-rule-layout,
  .screen-saver-layout {
    grid-template-columns: 1fr;
  }
  .entry-content-specs,
  .banner-rule-context,
  .banner-rule-help,
  .face-gallery-toolbar,
  .face-gallery-layout {
    grid-template-columns: 1fr;
  }
  .banner-rule-type-guide {
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  .thermal-scenario-head,
  .thermal-scenario-hourly-head { align-items: flex-start; flex-direction: column; }
  .thermal-scenario-head-actions { width: 100%; justify-content: space-between; }
  .thermal-scenario-progress { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .thermal-scenario-progress > div:nth-child(2n) { border-right: 0; }
  .thermal-scenario-progress > div:nth-child(-n+2) { border-bottom: 1px solid var(--border-color); }
  .thermal-scenario-form,
  .thermal-scenario-baseline,
  .thermal-scenario-rssi { grid-template-columns: 1fr; }
  .thermal-scenario-name { grid-column: auto; }
  .thermal-scenario-baseline > div,
  .thermal-scenario-baseline > div:first-child,
  .thermal-scenario-baseline > div:nth-child(3),
  .thermal-scenario-rssi > div,
  .thermal-scenario-rssi > div:first-child,
  .thermal-scenario-rssi > div:nth-child(3) {
    padding: 9px 0;
    border-right: 0;
    border-bottom: 1px solid var(--border-color);
  }
  .thermal-scenario-rssi > button { justify-self: start; }
  .thermal-scenario-diagnosis { display: grid; gap: 4px; }
  .thermal-scenario-diagnosis strong { flex-basis: auto; }

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

  .thermal-custom-command {
    grid-template-columns: 1fr;
  }

		  .thermal-ai-summary,
		  .thermal-training-layout,
		  .thermal-tooling-grid,
		  .thermal-live-annotation-controls,
		  .thermal-frame-playback,
		  .thermal-record-grid,
		  .thermal-background-quick-controls,
		  .thermal-background-display-controls,
		  .thermal-fusion-grid {
		    grid-template-columns: 1fr;
		  }

  .thermal-ota-layout,
  .thermal-ota-upload-fields,
  .thermal-ota-task-meta {
    grid-template-columns: 1fr;
  }

  .thermal-identity-summary,
  .thermal-identity-layout,
  .thermal-identity-fields {
    grid-template-columns: 1fr;
  }

  .thermal-identity-summary > div {
    padding: 8px 0;
    border-right: 0;
    border-bottom: 1px solid var(--border-color);
  }

  .thermal-identity-summary > div:last-child { border-bottom: 0; }
  .thermal-identity-editor { padding-right: 0; border-right: 0; }

  .thermal-identity-progress {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 8px;
    overflow-x: visible;
  }

  .thermal-multimodal-metrics,
  .thermal-toggle-grid,
  .thermal-multimodal-fields,
  .thermal-fusion-config-fields,
  .thermal-diagnostics-grid {
    grid-template-columns: 1fr;
  }

  .thermal-multimodal-metrics > div,
  .thermal-diagnostics-grid > div {
    padding: 8px 0;
    border-right: 0;
    border-bottom: 1px solid var(--border-color);
  }

  .thermal-history-row,
  .thermal-diagnostics-history-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .thermal-history-row small { text-align: left; }

  .thermal-debug-toolbar,
  .thermal-debug-filters,
  .thermal-debug-summary {
    grid-template-columns: 1fr;
  }

  .thermal-debug-command-actions,
  .thermal-debug-data-actions {
    grid-column: auto;
  }

  .thermal-debug-log {
    height: 440px;
  }

  .thermal-debug-log-row {
    grid-template-columns: minmax(0, 1fr) auto;
    min-width: 0;
  }

  .thermal-debug-log-row code,
  .thermal-debug-message {
    grid-column: 1 / -1;
  }

	  .thermal-annotation-grid,
	  .thermal-box-row {
	    grid-template-columns: repeat(2, minmax(0, 1fr));
	  }

	  .thermal-live-annotation-head {
	    flex-direction: column;
	  }

	  .thermal-live-annotation-head span {
	    text-align: left;
	  }

  .thermal-ai-toolbar select,
  .thermal-training-toolbar select {
    min-width: 100%;
  }

  .device-agent-deploy-strip,
  .device-agent-contract-grid,
  .device-agent-contract-grid.compact,
	  .device-agent-deploy-checklist,
	  .device-agent-deploy-gates,
	  .device-agent-rollout-steps,
  .device-agent-release-item,
	  .device-agent-env-grid {
    grid-template-columns: 1fr;
  }

  .device-agent-section-title,
  .device-agent-gate-head {
    flex-direction: column;
    align-items: flex-start;
  }

	  .device-agent-section-title span,
	  .device-agent-gate-status {
	    max-width: 100%;
	    text-align: left;
	  }

  .device-agent-release-rollback-btn {
    justify-self: start;
  }

  .users-layout {
    grid-template-columns: 1fr;
  }

  .tasks-table-header { display: none; }
  .tasks-table-row { flex-wrap: wrap; gap: 6px; padding: 10px 12px; }
  .tasks-col-title { flex: 1 1 100%; }
  .tasks-col-type, .tasks-col-person, .tasks-col-time { width: auto; flex: 1; }
  .form-grid-2,
  .twin-function-fields,
  .entry-panel-facts,
  .entry-topic-list,
  .entry-content-actions,
  .banner-rule-field,
  .entry-gallery-metrics,
  .entry-gallery-list,
  .face-gallery-summary,
  .twin-gallery-metrics {
    grid-template-columns: 1fr;
  }
  .banner-rule-field-head {
    align-items: stretch;
    flex-direction: column;
  }
  .banner-rule-field-head select {
    flex-basis: auto;
    width: 100%;
  }

  .face-gallery-scan-row {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .face-gallery-scan-thumb {
    width: 64px;
  }

.face-gallery-scan-row em,
.face-gallery-scan-actions {
  grid-column: 2;
  justify-content: flex-start;
}
}

.discovery-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.8fr);
  gap: 16px;
  margin-top: 16px;
}

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

.discovery-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.discovery-filter-row .filter-select {
  min-width: 180px;
  flex: 1 1 180px;
}

.discovery-device-card {
  border: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.42);
  border-radius: 8px;
  padding: 14px;
}

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

.discovery-device-head strong,
.discovery-device-head small,
.discovery-meta-grid strong,
.discovery-meta-grid small {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.discovery-device-head strong {
  display: block;
  color: var(--text-primary);
  font-size: 1rem;
  margin: 3px 0;
}

.discovery-device-head small,
.discovery-meta-grid small {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.discovery-type {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  color: #67e8f9;
  background: rgba(8, 145, 178, 0.14);
  font-size: 0.72rem;
  font-weight: 700;
}

.discovery-status-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  min-width: 120px;
}

.discovery-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.discovery-meta-grid > div {
  min-width: 0;
  border-radius: 8px;
  padding: 10px;
  background: rgba(2, 6, 23, 0.28);
  border: 1px solid rgba(148, 163, 184, 0.08);
}

.discovery-meta-grid span {
  display: block;
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-bottom: 4px;
}

.discovery-meta-grid strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.78rem;
  line-height: 1.35;
}

.discovery-bind-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, auto);
  gap: 8px;
  align-items: center;
}

.discovery-room-select {
  min-width: 0;
  width: 100%;
}

.discovery-flow {
  display: grid;
  gap: 10px;
}

.discovery-flow > div {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.24);
}

.discovery-flow strong {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.18);
  color: #c4b5fd;
}

.discovery-flow span {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.panel-actions-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 12px;
}

@media (max-width: 1100px) {
  .discovery-layout {
    grid-template-columns: 1fr;
  }
  .discovery-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .discovery-device-head,
  .discovery-status-stack {
    align-items: stretch;
    justify-content: flex-start;
  }
  .discovery-device-head {
    flex-direction: column;
  }
  .discovery-meta-grid,
  .discovery-bind-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .ai-native-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ai-native-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .ai-native-summary-grid,
  .ai-native-perspective-strip,
  .ai-native-perspective-brief,
  .ai-native-rule-meta,
  .ai-native-input-row {
    grid-template-columns: 1fr;
  }
  .ai-native-tool-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .ai-native-summary-card {
    min-height: auto;
  }
}

/* ============================================================
   V3 RESOURCE / SERVICE / AGENT WORKSPACE
   ============================================================ */
.v3-version-lock {
  border-color: rgba(16, 185, 129, 0.28);
  background: rgba(16, 185, 129, 0.08);
}

.v3-version-lock .nav-version-code { color: #34d399; }

.nav-item [data-lucide].nav-icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  flex: 0 0 17px;
}

.v3-page-shell {
  --v3-line: rgba(148, 163, 184, 0.16);
  --v3-line-strong: rgba(148, 163, 184, 0.28);
  --v3-surface: rgba(15, 23, 42, 0.42);
  --v3-surface-strong: rgba(15, 23, 42, 0.7);
  --v3-accent: #14b8a6;
  --v3-accent-soft: rgba(20, 184, 166, 0.12);
  --v3-blue: #38bdf8;
  --v3-amber: #fbbf24;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

[data-theme="light"] .v3-page-shell {
  --v3-line: rgba(15, 23, 42, 0.1);
  --v3-line-strong: rgba(15, 23, 42, 0.2);
  --v3-surface: rgba(255, 255, 255, 0.68);
  --v3-surface-strong: #ffffff;
  --v3-accent-soft: rgba(13, 148, 136, 0.1);
}

.v3-page-header {
  min-height: 58px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 2px 0 14px;
  border-bottom: 1px solid var(--v3-line);
}

.v3-page-header h1 {
  font-size: 1.4rem;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: 0;
}

.v3-page-header p {
  margin-top: 7px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.5;
}

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

.v3-page-shell .btn {
  min-height: 36px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 0.78rem;
  line-height: 1;
  white-space: nowrap;
}

.v3-page-shell .btn svg,
.v3-native-form .btn svg {
  width: 15px;
  height: 15px;
}

.v3-icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--v3-line);
  border-radius: 6px;
  display: inline-grid;
  place-items: center;
  color: var(--text-secondary);
  background: var(--v3-surface);
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.v3-icon-button:hover:not(:disabled) {
  border-color: var(--v3-accent);
  color: var(--text-primary);
  background: var(--v3-accent-soft);
}

.v3-icon-button:disabled { opacity: 0.38; cursor: not-allowed; }
.v3-icon-button.compact { width: 30px; height: 30px; }
.v3-icon-button svg { width: 16px; height: 16px; }

.v3-flow-rail {
  display: grid;
  grid-template-columns: repeat(5, minmax(132px, 1fr));
  border: 1px solid var(--v3-line);
  border-radius: 7px;
  overflow: hidden;
  background: var(--v3-surface);
}

.v3-flow-step {
  min-width: 0;
  height: 58px;
  border: 0;
  border-right: 1px solid var(--v3-line);
  padding: 0 13px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 140ms ease, color 140ms ease;
}

.v3-flow-step:last-child { border-right: 0; }

.v3-flow-step > span {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  border: 1px solid var(--v3-line-strong);
  grid-row: 1 / 3;
}

.v3-flow-step strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 600;
  color: inherit;
  grid-column: 2;
  grid-row: 1;
  align-self: end;
}

.v3-flow-step small {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  grid-column: 2;
  grid-row: 2;
  align-self: start;
}

.v3-flow-step:hover,
.v3-flow-step.active {
  background: var(--v3-accent-soft);
  color: var(--text-primary);
}

.v3-flow-step.active { box-shadow: inset 0 -2px 0 var(--v3-accent); }
.v3-flow-step.active > span { color: #062e2a; border-color: var(--v3-accent); background: var(--v3-accent); }

.v3-metrics-bar {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  min-height: 64px;
  border-top: 1px solid var(--v3-line);
  border-bottom: 1px solid var(--v3-line);
}

.v3-metrics-bar > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 10px 15px;
  border-right: 1px solid var(--v3-line);
}

.v3-metrics-bar > div:last-child { border-right: 0; }
.v3-metrics-bar span { color: var(--text-muted); font-size: 0.7rem; }
.v3-metrics-bar strong { font-size: 1.16rem; font-weight: 650; line-height: 1; }

.v3-tab-panel { display: none; min-width: 0; }
.v3-tab-panel.active { display: block; animation: fadeIn 180ms ease; }

.v3-filter-bar,
.v3-section-toolbar {
  min-height: 62px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--v3-line);
}

.v3-section-toolbar {
  justify-content: space-between;
  align-items: center;
}

.v3-filter-field {
  min-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.v3-filter-field > span {
  color: var(--text-muted);
  font-size: 0.68rem;
}

.v3-page-shell select,
.v3-page-shell input,
.v3-native-form select,
.v3-native-form input,
.v3-native-form textarea {
  min-height: 36px;
  border: 1px solid var(--v3-line-strong);
  border-radius: 6px;
  padding: 0 10px;
  background: rgba(10, 14, 26, 0.56);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.76rem;
  outline: none;
}

[data-theme="light"] .v3-page-shell select,
[data-theme="light"] .v3-page-shell input,
[data-theme="light"] .v3-native-form select,
[data-theme="light"] .v3-native-form input,
[data-theme="light"] .v3-native-form textarea {
  background: #ffffff;
}

.v3-page-shell select:focus,
.v3-page-shell input:focus,
.v3-native-form select:focus,
.v3-native-form input:focus,
.v3-native-form textarea:focus {
  border-color: var(--v3-accent);
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.13);
}

.v3-search-field {
  min-width: 220px;
  height: 36px;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--v3-line-strong);
  border-radius: 6px;
  color: var(--text-muted);
  background: rgba(10, 14, 26, 0.36);
}

[data-theme="light"] .v3-search-field { background: #ffffff; }
.v3-search-field:focus-within { border-color: var(--v3-accent); box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.13); }
.v3-search-field svg { width: 15px; height: 15px; flex: 0 0 15px; }
.v3-search-field input { min-width: 0; width: 100%; min-height: 32px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.v3-search-field input:focus { box-shadow: none; }

.v3-segmented {
  height: 36px;
  display: inline-flex;
  border: 1px solid var(--v3-line-strong);
  border-radius: 6px;
  overflow: hidden;
}

.v3-segmented button {
  min-width: 48px;
  border: 0;
  border-right: 1px solid var(--v3-line);
  padding: 0 10px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

.v3-segmented button:last-child { border-right: 0; }
.v3-segmented button.active { background: var(--v3-accent-soft); color: var(--v3-accent); font-weight: 600; }

.v3-resource-workspace {
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  min-height: 610px;
  height: calc(100vh - 372px);
  max-height: 820px;
  border: 1px solid var(--v3-line);
  border-radius: 7px;
  overflow: hidden;
  background: var(--v3-surface);
}

.v3-list-pane,
.v3-inspector-pane {
  min-width: 0;
  min-height: 0;
}

.v3-list-pane {
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr) 42px;
  border-right: 1px solid var(--v3-line);
  background: rgba(8, 13, 24, 0.18);
}

.v3-pane-header,
.v3-open-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--v3-line);
}

.v3-pane-header > div,
.v3-open-section-header > div {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.v3-pane-header h2,
.v3-open-section-header h2 {
  font-size: 0.82rem;
  font-weight: 650;
}

.v3-pane-header span,
.v3-open-section-header span {
  color: var(--text-muted);
  font-size: 0.68rem;
}

.v3-pane-header select {
  min-height: 28px;
  border-color: transparent;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.v3-resource-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.v3-loading-row,
.v3-list-empty {
  min-height: 96px;
  display: grid;
  place-items: center;
  padding: 18px;
  color: var(--text-muted);
  font-size: 0.74rem;
  text-align: center;
}

.v3-resource-row,
.v3-service-row,
.v3-agent-row {
  width: 100%;
  min-height: 78px;
  border: 0;
  border-bottom: 1px solid var(--v3-line);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease;
}

.v3-resource-row:hover,
.v3-resource-row.active,
.v3-service-row:hover,
.v3-service-row.active,
.v3-agent-row:hover,
.v3-agent-row.active { background: rgba(20, 184, 166, 0.08); }

.v3-resource-row.active,
.v3-service-row.active,
.v3-agent-row.active { box-shadow: inset 2px 0 0 var(--v3-accent); }

.v3-connection-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.1);
}

.v3-connection-dot.online { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12); }
.v3-connection-dot.offline { background: #f97316; box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12); }

.v3-row-content { min-width: 0; }
.v3-row-title { display: flex; align-items: center; gap: 7px; min-width: 0; }
.v3-row-title strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.78rem; font-weight: 600; }
.v3-row-code { margin-top: 3px; color: var(--text-muted); font-size: 0.66rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v3-row-meta { margin-top: 7px; display: flex; gap: 5px; flex-wrap: wrap; }

.v3-row-counts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  color: var(--text-muted);
  font-size: 0.64rem;
  white-space: nowrap;
}

.v3-tag {
  max-width: 190px;
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border: 1px solid var(--v3-line);
  border-radius: 4px;
  color: var(--text-secondary);
  background: rgba(148, 163, 184, 0.05);
  font-size: 0.62rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v3-tag.device { color: #67e8f9; border-color: rgba(34, 211, 238, 0.22); }
.v3-tag.service { color: #fcd34d; border-color: rgba(251, 191, 36, 0.22); }
.v3-tag.person { color: #c4b5fd; border-color: rgba(167, 139, 250, 0.22); }
.v3-tag.space { color: #86efac; border-color: rgba(34, 197, 94, 0.22); }
.v3-tag.organization { color: #fdba74; border-color: rgba(249, 115, 22, 0.22); }
.v3-tag.capability { color: #f9a8d4; border-color: rgba(236, 72, 153, 0.22); }
.v3-tag.project { color: #93c5fd; border-color: rgba(59, 130, 246, 0.22); }
.v3-tag.success { color: #4ade80; border-color: rgba(34, 197, 94, 0.24); }
.v3-tag.warning { color: #fbbf24; border-color: rgba(245, 158, 11, 0.24); }
.v3-tag.danger { color: #f87171; border-color: rgba(239, 68, 68, 0.24); }

.v3-list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border-top: 1px solid var(--v3-line);
  color: var(--text-muted);
  font-size: 0.66rem;
}

.v3-list-footer > div { display: flex; gap: 5px; }

.v3-inspector-pane {
  overflow-y: auto;
  background: rgba(8, 13, 24, 0.08);
}

.v3-inspector-empty {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 30px;
  color: var(--text-muted);
  text-align: center;
}

.v3-inspector-empty svg { width: 28px; height: 28px; opacity: 0.55; }
.v3-inspector-empty strong { color: var(--text-secondary); font-size: 0.8rem; }
.v3-inspector-empty span { font-size: 0.7rem; }

.v3-inspector-header {
  min-height: 92px;
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--v3-line);
}

.v3-inspector-title { min-width: 0; }
.v3-inspector-title h2 { margin-top: 7px; font-size: 1.04rem; line-height: 1.3; font-weight: 650; overflow-wrap: anywhere; }
.v3-inspector-title p { margin-top: 5px; color: var(--text-muted); font-size: 0.68rem; overflow-wrap: anywhere; }
.v3-inspector-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.v3-status-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.v3-status-line .v3-connection-dot { margin-top: 0; }

.v3-inspector-tabs {
  height: 42px;
  display: flex;
  align-items: stretch;
  padding: 0 12px;
  border-bottom: 1px solid var(--v3-line);
  overflow-x: auto;
}

.v3-inspector-tabs button {
  min-width: 76px;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0 10px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.7rem;
  white-space: nowrap;
  cursor: pointer;
}

.v3-inspector-tabs button.active { color: var(--v3-accent); border-bottom-color: var(--v3-accent); }
.v3-inspector-body { padding: 16px 18px 22px; }

.v3-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--v3-line);
  background: var(--v3-line);
}

.v3-detail-field {
  min-width: 0;
  min-height: 64px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--v3-surface-strong);
}

.v3-detail-field span { color: var(--text-muted); font-size: 0.64rem; }
.v3-detail-field strong,
.v3-detail-field code { color: var(--text-primary); font-size: 0.72rem; font-weight: 500; overflow-wrap: anywhere; }
.v3-detail-field code { color: var(--v3-blue); }

.v3-detail-section { margin-top: 18px; }
.v3-detail-section:first-child { margin-top: 0; }
.v3-detail-section-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.v3-detail-section-header h3 { font-size: 0.78rem; font-weight: 650; }
.v3-detail-section-header span { color: var(--text-muted); font-size: 0.66rem; }

.v3-json-view {
  max-height: 250px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--v3-line);
  border-radius: 5px;
  background: rgba(2, 6, 23, 0.4);
  color: #cbd5e1;
  font: 0.68rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

[data-theme="light"] .v3-json-view { background: #f8fafc; color: #334155; }

.v3-relation-list,
.v3-capability-list,
.v3-offering-list,
.v3-instance-list,
.v3-delegation-list {
  border-top: 1px solid var(--v3-line);
}

.v3-relation-row,
.v3-capability-row,
.v3-offering-row,
.v3-instance-row,
.v3-delegation-row {
  min-height: 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 9px 4px;
  border-bottom: 1px solid var(--v3-line);
}

.v3-relation-row button.v3-related-resource {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.v3-relation-main,
.v3-capability-main,
.v3-offering-main,
.v3-instance-main,
.v3-delegation-main { min-width: 0; }

.v3-relation-main strong,
.v3-capability-main strong,
.v3-offering-main strong,
.v3-instance-main strong,
.v3-delegation-main strong { display: block; font-size: 0.73rem; font-weight: 600; overflow-wrap: anywhere; }

.v3-relation-main small,
.v3-capability-main small,
.v3-offering-main small,
.v3-instance-main small,
.v3-delegation-main small { display: block; margin-top: 4px; color: var(--text-muted); font-size: 0.64rem; line-height: 1.45; overflow-wrap: anywhere; }

.v3-instance-card {
  border-bottom: 1px solid var(--v3-line);
}

.v3-instance-card .v3-instance-row {
  border-bottom: 0;
}

.v3-entitlement-list {
  margin: 0 4px 8px 18px;
  border-left: 2px solid color-mix(in srgb, var(--v3-teal) 40%, transparent);
}

.v3-entitlement-row {
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 7px 8px 7px 12px;
  border-top: 1px solid var(--v3-line);
}

.v3-entitlement-main { min-width: 0; }
.v3-entitlement-main strong { display: block; font-size: 0.68rem; font-weight: 600; overflow-wrap: anywhere; }
.v3-entitlement-main small { display: block; margin-top: 3px; color: var(--text-muted); font-size: 0.61rem; line-height: 1.4; overflow-wrap: anywhere; }
.v3-entitlement-empty { padding: 9px 12px; color: var(--text-muted); font-size: 0.64rem; border-top: 1px solid var(--v3-line); }

.v3-inline-select {
  height: 28px;
  max-width: 96px;
  padding: 0 24px 0 8px;
  border: 1px solid var(--v3-line);
  border-radius: 5px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.63rem;
}

.v3-check-fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--v3-line);
  border-radius: 6px;
}

.v3-check-fieldset legend { padding: 0 5px; color: var(--text-muted); font-size: 0.66rem; }
.v3-check-fieldset label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); font-size: 0.68rem; }
.v3-check-fieldset input { accent-color: var(--v3-teal); }

.v3-policy-controls {
  display: flex;
  align-items: center;
  gap: 9px;
}

.v3-switch {
  position: relative;
  width: 34px;
  height: 19px;
  flex: 0 0 auto;
}

.v3-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.v3-switch span {
  position: absolute;
  inset: 0;
  border: 1px solid var(--v3-line);
  border-radius: 10px;
  background: var(--bg-secondary);
  cursor: pointer;
}

.v3-switch span::after {
  content: '';
  position: absolute;
  width: 13px;
  height: 13px;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 160ms ease, background 160ms ease;
}

.v3-switch input:checked + span { border-color: color-mix(in srgb, var(--v3-teal) 65%, var(--v3-line)); background: color-mix(in srgb, var(--v3-teal) 18%, transparent); }
.v3-switch input:checked + span::after { transform: translateX(15px); background: var(--v3-teal); }
.v3-switch input:disabled + span { opacity: 0.45; cursor: not-allowed; }

.v3-risk {
  min-width: 30px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
  border: 1px solid var(--v3-line);
  font-size: 0.62rem;
  font-weight: 700;
}

.v3-risk.L0 { color: #4ade80; }
.v3-risk.L1 { color: #67e8f9; }
.v3-risk.L2 { color: #fbbf24; }
.v3-risk.L3 { color: #f87171; }

.v3-section-toolbar + .v3-resource-workspace { border-top-left-radius: 0; border-top-right-radius: 0; }
.v3-service-workspace,
.v3-agent-workspace { height: calc(100vh - 310px); max-height: 820px; }

.v3-service-row,
.v3-agent-row { grid-template-columns: 10px minmax(0, 1fr) auto; }
.v3-service-row .v3-connection-dot { border-radius: 2px; background: var(--v3-amber); }
.v3-agent-row .v3-row-counts strong { color: var(--text-secondary); font-size: 0.65rem; }

.v3-service-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 16px;
  border: 1px solid var(--v3-line);
  background: var(--v3-line);
}

.v3-service-summary > div {
  min-height: 58px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: var(--v3-surface-strong);
}

.v3-service-summary span { color: var(--text-muted); font-size: 0.63rem; }
.v3-service-summary strong { font-size: 0.82rem; font-weight: 600; }

.v3-domain-switch {
  width: fit-content;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--v3-line);
  border-radius: 6px;
  background: var(--v3-surface);
}

.v3-domain-switch button {
  min-width: 124px;
  height: 28px;
  border: 0;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.68rem;
  cursor: pointer;
}

.v3-domain-switch button.active {
  background: var(--v3-accent-soft);
  color: var(--v3-accent);
}

.v3-domain-switch svg { width: 14px; height: 14px; }
.v3-filter-field.compact-field { min-width: 300px; }
.v3-capability-workspace { height: min(680px, calc(100vh - 330px)); min-height: 560px; }

.v3-capability-model-row {
  width: 100%;
  min-height: 84px;
  border: 0;
  border-bottom: 1px solid var(--v3-line);
  padding: 11px 12px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.v3-capability-model-row:hover { background: var(--v3-surface-hover); }
.v3-capability-model-row.active { background: var(--v3-accent-soft); box-shadow: inset 3px 0 0 var(--v3-accent); }

.v3-capability-kind {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(34, 211, 238, 0.22);
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: #22d3ee;
  background: rgba(34, 211, 238, 0.07);
}

.v3-capability-kind.composite {
  border-color: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.07);
}

.v3-capability-kind svg { width: 15px; height: 15px; }

.v3-capability-trace {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr) 14px) minmax(0, 1fr);
  align-items: stretch;
  gap: 6px;
  margin-bottom: 14px;
}

.v3-capability-trace > div {
  min-width: 0;
  min-height: 112px;
  padding: 10px;
  border: 1px solid var(--v3-line);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: var(--v3-surface-strong);
}

.v3-capability-trace > div > svg { width: 17px; height: 17px; color: var(--v3-accent); }
.v3-capability-trace > div:nth-of-type(2) > svg { color: #fbbf24; }
.v3-capability-trace > div:nth-of-type(3) > svg { color: #4ade80; }
.v3-capability-trace > div:nth-of-type(4) > svg { color: #fb7185; }
.v3-capability-trace > svg { width: 15px; height: 15px; align-self: center; color: var(--text-muted); }
.v3-capability-trace span { color: var(--text-muted); font-size: 0.6rem; }
.v3-capability-trace strong { font-size: 0.72rem; line-height: 1.35; overflow-wrap: anywhere; }
.v3-capability-trace small { margin-top: auto; color: var(--text-secondary); font-size: 0.62rem; }

.v3-composition-flow { display: flex; flex-direction: column; gap: 7px; }
.v3-composition-step {
  min-height: 50px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--v3-line);
  border-radius: 5px;
  background: var(--v3-surface-strong);
}
.v3-composition-step > span:first-child,
.v3-step-index {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  font-size: 0.63rem;
  font-weight: 650;
}
.v3-composition-step strong { display: block; font-size: 0.7rem; }
.v3-composition-step small { display: block; margin-top: 3px; color: var(--text-muted); font-size: 0.61rem; line-height: 1.4; overflow-wrap: anywhere; }

.v3-composition-modal { width: min(980px, calc(100vw - 32px)); }
.v3-composition-editor-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.v3-composition-editor { max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.v3-composition-editor-row {
  min-height: 82px;
  display: grid;
  grid-template-columns: 28px 112px minmax(180px, 1fr) 104px;
  grid-template-rows: 32px 32px;
  align-items: center;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--v3-line);
  border-radius: 6px;
}
.v3-composition-editor-row > .v3-step-index { grid-row: 1 / 3; }
.v3-composition-editor-row > :nth-child(2) { grid-column: 2; grid-row: 1; }
.v3-composition-editor-row > :nth-child(3) { grid-column: 3; grid-row: 1; }
.v3-composition-editor-row > :nth-child(4) { grid-column: 4; grid-row: 1; }
.v3-composition-editor-row > :nth-child(5) { grid-column: 2 / 4; grid-row: 2; }
.v3-composition-editor-row > :nth-child(6) { grid-column: 4; grid-row: 2; }
.v3-composition-editor-row select,
.v3-composition-editor-row input { width: 100%; min-width: 0; height: 32px; font-size: 0.65rem; }

.v3-fulfillment-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--v3-line);
  border-bottom: 1px solid var(--v3-line);
}
.v3-fulfillment-facts > div { min-height: 58px; padding: 9px 11px; border-right: 1px solid var(--v3-line); border-bottom: 1px solid var(--v3-line); }
.v3-fulfillment-facts > div:nth-child(3n) { border-right: 0; }
.v3-fulfillment-facts > div:nth-last-child(-n+3) { border-bottom: 0; }
.v3-fulfillment-facts span { display: block; color: var(--text-muted); font-size: 0.59rem; }
.v3-fulfillment-facts strong { display: block; margin-top: 5px; font-size: 0.68rem; line-height: 1.4; overflow-wrap: anywhere; }
.v3-instance-capability-summary { padding: 10px 12px; border-bottom: 1px solid var(--v3-line); }
.v3-instance-capability-summary h4 { margin: 0; font-size: 0.7rem; }
.v3-inline-tags { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.v3-instance-capability-fieldset > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.v3-instance-capability-fieldset label { min-height: 40px; align-items: flex-start; padding: 7px; border: 1px solid var(--v3-line); border-radius: 5px; }
.v3-instance-capability-fieldset label span { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.v3-instance-capability-fieldset label small { color: var(--text-muted); font-size: 0.58rem; }
.v3-form-hint { color: var(--text-muted); font-size: 0.63rem; line-height: 1.5; }
.v3-icon-button.danger:hover { color: var(--red); border-color: rgba(239, 68, 68, 0.42); }

.v3-policy-layout,
.v3-quality-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
}

.v3-open-section {
  min-width: 0;
  min-height: 560px;
  border: 1px solid var(--v3-line);
  border-radius: 7px;
  overflow: hidden;
  background: var(--v3-surface);
}

.v3-open-section-header { min-height: 48px; }
.v3-policy-list,
.v3-decision-list,
.v3-quality-list,
.v3-migration-list { max-height: 680px; overflow-y: auto; }

.v3-policy-row,
.v3-decision-row,
.v3-quality-row,
.v3-migration-row {
  min-height: 70px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--v3-line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.v3-policy-row:last-child,
.v3-decision-row:last-child,
.v3-quality-row:last-child,
.v3-migration-row:last-child { border-bottom: 0; }

.v3-policy-main,
.v3-decision-main,
.v3-quality-main,
.v3-migration-main { min-width: 0; }
.v3-policy-main strong,
.v3-decision-main strong,
.v3-quality-main strong,
.v3-migration-main strong { display: block; font-size: 0.74rem; font-weight: 600; overflow-wrap: anywhere; }
.v3-policy-main small,
.v3-decision-main small,
.v3-quality-main small,
.v3-migration-main small { display: block; margin-top: 5px; color: var(--text-muted); font-size: 0.64rem; line-height: 1.5; overflow-wrap: anywhere; }

.v3-policy-effect,
.v3-decision-result,
.v3-quality-severity {
  min-width: 48px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--v3-line);
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 650;
}

.v3-policy-effect.allow,
.v3-decision-result.allow { color: #4ade80; border-color: rgba(34, 197, 94, 0.25); }
.v3-policy-effect.deny,
.v3-decision-result.deny,
.v3-quality-severity.error { color: #f87171; border-color: rgba(239, 68, 68, 0.25); }
.v3-quality-severity.warning { color: #fbbf24; border-color: rgba(245, 158, 11, 0.25); }

.v3-quality-summary { color: var(--text-secondary); font-size: 0.74rem; }

.v3-compatibility-footer {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  padding-top: 8px;
  color: var(--text-muted);
  font-size: 0.66rem;
}

.v3-compatibility-footer button {
  border: 0;
  padding: 5px 7px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
}

.v3-compatibility-footer button:hover { color: var(--v3-accent); }

.v3-form-modal { width: min(720px, calc(100vw - 32px)); }
.v3-form-modal.compact-modal { width: min(520px, calc(100vw - 32px)); }
.v3-native-form { display: flex; flex-direction: column; gap: 14px; }
.v3-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.v3-native-form textarea { min-height: 96px; padding: 10px; resize: vertical; line-height: 1.5; }
.v3-modal-footer { margin-top: 4px; display: flex; justify-content: flex-end; gap: 8px; }

.v3-action-toolbar,
.v3-delegation-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.v3-action-toolbar .v3-search-field,
.v3-delegation-filter-bar .v3-search-field { min-width: 180px; flex: 1 1 240px; }
.v3-action-toolbar > select { width: 104px; flex: 0 0 104px; }
.v3-action-toolbar .v3-segmented,
.v3-delegation-filter-bar .v3-segmented { flex: 0 0 auto; }

.v3-delegation-actions {
  max-height: 260px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.v3-delegation-action {
  min-height: 46px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  color: var(--text-secondary);
  font-size: 0.7rem;
}

.v3-delegation-action input { width: 16px; min-height: 16px; }
.v3-delegation-action[hidden] { display: none; }
.v3-token-result { padding: 12px; border: 1px solid rgba(34, 197, 94, 0.28); border-radius: 6px; background: rgba(34, 197, 94, 0.07); }
.v3-token-result strong { display: block; margin-bottom: 6px; color: #4ade80; font-size: 0.72rem; }
.v3-token-result code { display: block; padding: 8px; background: rgba(2, 6, 23, 0.5); color: var(--text-primary); font-size: 0.68rem; overflow-wrap: anywhere; user-select: all; }
.v3-token-result small { display: block; margin-top: 6px; color: var(--text-muted); font-size: 0.62rem; line-height: 1.5; }

.v3-inline-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.v3-inline-button {
  min-height: 28px;
  border: 1px solid var(--v3-line);
  border-radius: 5px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.65rem;
  cursor: pointer;
}
.v3-inline-button:hover { border-color: var(--v3-accent); color: var(--v3-accent); }
.v3-inline-button.danger:hover { border-color: var(--red); color: var(--red); }
.v3-inline-button svg { width: 13px; height: 13px; }

@media (max-width: 1180px) {
  .v3-flow-rail { overflow-x: auto; grid-template-columns: repeat(5, minmax(150px, 1fr)); }
  .v3-metrics-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .v3-metrics-bar > div:nth-child(3) { border-right: 0; }
  .v3-metrics-bar > div:nth-child(-n+3) { border-bottom: 1px solid var(--v3-line); }
  .v3-resource-workspace { grid-template-columns: minmax(300px, 350px) minmax(0, 1fr); }
  .v3-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 920px) {
  .v3-filter-bar { align-items: stretch; flex-wrap: wrap; }
  .v3-filter-field { flex: 1 1 150px; }
  .v3-search-field { flex: 1 1 100%; margin-left: 0; }
  .v3-resource-workspace,
  .v3-capability-workspace,
  .v3-service-workspace,
  .v3-agent-workspace {
    height: auto;
    max-height: none;
    grid-template-columns: 1fr;
  }
  .v3-list-pane { min-height: 410px; max-height: 520px; border-right: 0; border-bottom: 1px solid var(--v3-line); }
  .v3-inspector-pane { min-height: 520px; }
  .v3-policy-layout,
  .v3-quality-layout { grid-template-columns: 1fr; }
  .v3-open-section { min-height: 420px; }
  .v3-capability-trace { grid-template-columns: 1fr; }
  .v3-capability-trace > svg { transform: rotate(90deg); justify-self: center; }
  .v3-composition-editor-row {
    min-height: 121px;
    grid-template-columns: 28px 100px minmax(0, 1fr);
    grid-template-rows: repeat(3, 32px);
  }
  .v3-composition-editor-row > .v3-step-index { grid-row: 1 / 4; }
  .v3-composition-editor-row > :nth-child(2) { grid-column: 2; grid-row: 1; }
  .v3-composition-editor-row > :nth-child(3) { grid-column: 3; grid-row: 1; }
  .v3-composition-editor-row > :nth-child(4) { grid-column: 2; grid-row: 2; }
  .v3-composition-editor-row > :nth-child(5) { grid-column: 3; grid-row: 2; }
  .v3-composition-editor-row > :nth-child(6) { grid-column: 2 / 4; grid-row: 3; justify-self: end; }
}

@media (max-width: 640px) {
  .v3-page-shell { gap: 12px; }
  .v3-page-header { align-items: stretch; flex-direction: column; gap: 12px; }
  .v3-header-actions { justify-content: flex-end; }
  .v3-flow-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
  }
  .v3-flow-step {
    height: 48px;
    grid-template-columns: 22px minmax(0, 1fr);
    grid-template-rows: 1fr;
    border-right: 1px solid var(--v3-line);
    border-bottom: 1px solid var(--v3-line);
    padding: 0 10px;
  }
  .v3-flow-step:nth-child(2n) { border-right: 0; }
  .v3-flow-step:nth-last-child(-n+2) { border-bottom: 0; }
  .v3-flow-step:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    border-right: 0;
  }
  .v3-flow-step strong {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    line-height: 1.25;
    grid-row: 1;
    align-self: center;
  }
  .v3-flow-step small { display: none; }
  .v3-flow-step > span { width: 22px; height: 22px; grid-row: 1; }
  .v3-composition-editor-row {
    min-height: 199px;
    grid-template-columns: 24px minmax(0, 1fr);
    grid-template-rows: repeat(5, 32px);
  }
  .v3-composition-editor-row > .v3-step-index { grid-column: 1; grid-row: 1 / 6; }
  .v3-composition-editor-row > :nth-child(2) { grid-column: 2; grid-row: 1; }
  .v3-composition-editor-row > :nth-child(3) { grid-column: 2; grid-row: 2; }
  .v3-composition-editor-row > :nth-child(4) { grid-column: 2; grid-row: 3; }
  .v3-composition-editor-row > :nth-child(5) { grid-column: 2; grid-row: 4; }
  .v3-composition-editor-row > :nth-child(6) { grid-column: 2; grid-row: 5; justify-self: end; }
  .v3-metrics-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .v3-metrics-bar > div { border-bottom: 1px solid var(--v3-line); }
  .v3-metrics-bar > div:nth-child(2n) { border-right: 0; }
  .v3-metrics-bar > div:nth-last-child(-n+2) { border-bottom: 0; }
  .v3-section-toolbar { align-items: stretch; flex-direction: column; }
  .v3-action-toolbar,
  .v3-delegation-filter-bar { align-items: stretch; flex-direction: column; }
  .v3-action-toolbar .v3-search-field,
  .v3-delegation-filter-bar .v3-search-field,
  .v3-action-toolbar > select { width: 100%; min-width: 0; flex-basis: auto; }
  .v3-toolbar-filters,
  .v3-toolbar-actions { width: 100%; }
  .v3-toolbar-actions .btn { flex: 1; }
  .v3-domain-switch { width: 100%; }
  .v3-domain-switch button { min-width: 0; flex: 1; }
  .v3-filter-field.compact-field { width: 100%; min-width: 0; }
  .v3-detail-grid,
  .v3-service-summary,
  .v3-form-grid,
  .v3-delegation-actions,
  .v3-instance-capability-fieldset > div,
  .v3-fulfillment-facts { grid-template-columns: 1fr; }
  .v3-fulfillment-facts > div { border-right: 0; }
  .v3-fulfillment-facts > div:nth-last-child(-n+3) { border-bottom: 1px solid var(--v3-line); }
  .v3-fulfillment-facts > div:last-child { border-bottom: 0; }
  .v3-inspector-header { flex-direction: column; }
  .v3-inspector-actions { width: 100%; justify-content: flex-start; }
  .v3-inspector-body { padding: 13px; }
  .v3-compatibility-footer { align-items: flex-start; justify-content: flex-start; flex-wrap: wrap; }
}
