/* Identidad visual única de la aplicación, alineada con la consola EMQX. */
:root {
  --bg: #f5f7fa !important;
  --surface: #ffffff !important;
  --surface-soft: #eef2f7 !important;
  --surface-muted: #e7edf4 !important;
  --text: #1f2937 !important;
  --muted: #64748b !important;
  --line: #d9e2ec !important;
  --primary: #0478b2 !important;
  --primary-rgb: 4, 120, 178 !important;
  --primary-strong: #035e8c !important;
  --primary-strong-rgb: 3, 94, 140 !important;
  --accent: #0478b2 !important;
  --accent-rgb: 4, 120, 178 !important;
  --accent-soft: #e8f4fa !important;
  --success: #20b486 !important;
  --warning: #d99a2b !important;
  --danger: #d95c5c !important;
}

html[data-theme="dark"] {
  --bg: #101821 !important;
  --surface: #172331 !important;
  --surface-soft: #1e2d3d !important;
  --surface-muted: #26384b !important;
  --text: #e7edf4 !important;
  --muted: #aab7c7 !important;
  --line: #304256 !important;
}

html[data-theme="light"] body.app-sidebar-page .app-sidebar {
  background: #17202c !important;
  border-right: 1px solid #2a3748 !important;
  box-shadow: 8px 0 24px rgba(15, 23, 42, .08) !important;
  color: #b8c3d1 !important;
}

html[data-theme="light"] body.app-sidebar-page .app-sidebar-brand,
html[data-theme="light"] body.app-sidebar-page .app-sidebar-nav,
html[data-theme="light"] body.app-sidebar-page .app-sidebar-footer,
html[data-theme="light"] body.app-sidebar-page .app-sidebar-section,
html[data-theme="light"] body.app-sidebar-page .app-sidebar-panel {
  background: transparent !important;
  border-color: #2a3748 !important;
}

html[data-theme="light"] body.app-sidebar-page .app-sidebar-logo-copy strong,
html[data-theme="light"] body.app-sidebar-page .app-sidebar-user-copy strong {
  color: #ffffff !important;
}

html[data-theme="light"] body.app-sidebar-page .app-sidebar-logo-copy small,
html[data-theme="light"] body.app-sidebar-page .app-sidebar-user-copy small,
html[data-theme="light"] body.app-sidebar-page .app-sidebar-footer {
  color: #9eacbc !important;
}

html[data-theme="light"] body.app-sidebar-page :where(.app-sidebar-link, .app-sidebar-section > summary) {
  background: transparent !important;
  color: #b8c3d1 !important;
}

html[data-theme="light"] body.app-sidebar-page :where(.app-sidebar-link:hover,
  .app-sidebar-link:focus-visible, .app-sidebar-section > summary:hover,
  .app-sidebar-section > summary:focus-visible) {
  background: #253449 !important;
  color: #ffffff !important;
}

html[data-theme="light"] body.app-sidebar-page :where(.app-sidebar-link.active,
  .app-sidebar-section[open] > summary) {
  background: #253449 !important;
  box-shadow: inset 3px 0 0 #0478b2 !important;
  color: #ffffff !important;
}

html[data-theme="light"] body.app-sidebar-page :where(.app-sidebar-icon, .app-sidebar-chevron) {
  color: #8fa3ba !important;
}

html[data-theme="light"] body.app-sidebar-page .app-sidebar-panel a { color: #9eacbc !important; }
html[data-theme="light"] body.app-sidebar-page .app-sidebar-panel a:hover,
html[data-theme="light"] body.app-sidebar-page .app-sidebar-panel a.active {
  background: #202d3d !important;
  color: #ffffff !important;
}

html[data-theme="light"] body.app-sidebar-page .topbar,
html[data-theme="light"] body.app-sidebar-page .topbar-inner {
  background: #ffffff !important;
  border-color: #d9e2ec !important;
}

html[data-theme="light"] body.app-sidebar-page .topbar-global-search button,
body :where(.btn-primary, button.btn-primary, a.btn-primary) {
  background: #0478b2 !important;
  border-color: #0478b2 !important;
  color: #ffffff !important;
}

html[data-theme="light"] body.app-sidebar-page .topbar-global-search button:hover,
html[data-theme="light"] body.app-sidebar-page .topbar-global-search button:focus-visible,
body :where(.btn-primary, button.btn-primary, a.btn-primary):hover,
body :where(.btn-primary, button.btn-primary, a.btn-primary):focus-visible {
  background: #035e8c !important;
  border-color: #035e8c !important;
  color: #ffffff !important;
}

body :where(.badge.primary, .badge-info, .status-pill.info, .is-info) {
  background: #e8f4fa !important;
  border-color: #bedeef !important;
  color: #035e8c !important;
}

body :where(.badge.success, .badge-success, .status-pill.success, .is-ok) {
  background: #e5f7f0 !important;
  border-color: #bcebd9 !important;
  color: #14795a !important;
}

body :where(input, select, textarea):focus {
  border-color: #0478b2 !important;
  box-shadow: 0 0 0 3px rgba(4, 120, 178, .16) !important;
}

html[data-theme="dark"] body.app-sidebar-page .app-sidebar {
  background: #111923 !important;
  border-right-color: #26384b !important;
}

html[data-theme="dark"] body.app-sidebar-page .topbar,
html[data-theme="dark"] body.app-sidebar-page .topbar-inner {
  background: #172331 !important;
  border-color: #304256 !important;
}

/* La misma gramática visual se aplica también a páginas públicas, login y
   pantallas administrativas que no muestran el sidebar global. */
html[data-theme="light"] body,
html[data-theme="light"] body.auth-page,
html[data-theme="light"] body.public-page {
  background: #f5f7fa !important;
  color: #1f2937 !important;
}

html[data-theme="dark"] body,
html[data-theme="dark"] body.auth-page,
html[data-theme="dark"] body.public-page {
  background: #101821 !important;
  color: #e7edf4 !important;
}

body :where(.topbar, .footer) {
  background: #ffffff !important;
  border-color: #d9e2ec !important;
  color: #64748b !important;
}

body.auth-page :where(.topbar, .footer) {
  background: #17202c !important;
  border-color: #2a3748 !important;
  color: #b8c3d1 !important;
}

body :where(.brand-title, .brand-title span, .nav a, .nav button,
  .nav-menu > summary, .topbar-menu-toggle) {
  color: #1f2937 !important;
}

body.auth-page :where(.brand-title, .brand-title span, .nav a,
  .nav button, .nav-menu > summary, .topbar-menu-toggle) {
  color: #e7edf4 !important;
}

body :where(.nav a:hover, .nav a.active, .nav button:hover,
  .nav-menu > summary:hover, .nav-menu > summary.active,
  .topbar-menu-toggle:hover, .topbar-menu-toggle:focus-visible) {
  background: #e8f4fa !important;
  color: #035e8c !important;
}

body.auth-page :where(.nav a:hover, .nav a.active, .nav button:hover,
  .nav-menu > summary:hover, .nav-menu > summary.active,
  .topbar-menu-toggle:hover, .topbar-menu-toggle:focus-visible) {
  background: #253449 !important;
  color: #ffffff !important;
}

body :where(.card, .panel, .auth-card, .login-page-panel, .auth-reference-card,
  .admin-sidebar, .admin-shell > :not(.admin-sidebar), .modal-content,
  .dropdown-menu, .nav-menu-panel) {
  background: #ffffff !important;
  border-color: #d9e2ec !important;
  color: #1f2937 !important;
}

body :where(.admin-sidebar) {
  background: #17202c !important;
  border-color: #2a3748 !important;
  color: #b8c3d1 !important;
}

body :where(.admin-sidebar a, .admin-sidebar button, .admin-sidebar summary) {
  color: #b8c3d1 !important;
}

body :where(.admin-sidebar a:hover, .admin-sidebar a.active,
  .admin-sidebar button:hover, .admin-sidebar summary:hover) {
  background: #253449 !important;
  color: #ffffff !important;
}

body :where(.section-head h1, .section-head h2, .section-head h3,
  .page-header h1, .page-header h2, .page-header h3, .card h1, .card h2,
  .card h3, .panel h1, .panel h2, .panel h3) {
  color: #1f2937 !important;
}

body :where(.muted, .text-muted, .helper-text, .field-help, small) {
  color: #64748b !important;
}

body :where(a:not(.btn):not(.btn-primary)) {
  color: #035e8c;
}

body :where(.table-simple, .table-wrap, .table-responsive, .table-wrapper,
  .admin-list-table, .admin-demand-table, .infra-browser-table-wrap) {
  background: #ffffff !important;
  border-color: #d9e2ec !important;
}

body :where(.table-simple th, .table-wrap thead th, .table-responsive thead th,
  .table-wrapper thead th) {
  background: #eef2f7 !important;
  border-color: #d9e2ec !important;
  color: #475569 !important;
}

body :where(.table-simple td, .table-wrap td, .table-responsive td,
  .table-wrapper td) {
  border-color: #e2e8f0 !important;
  color: #1f2937 !important;
}

body :where(.table-simple tbody tr:hover, .table-wrap tbody tr:hover,
  .table-responsive tbody tr:hover, .table-wrapper tbody tr:hover) {
  background: #f5f8fc !important;
}

body :where(.flash, .alert, .notice) {
  background: #ffffff !important;
  border-color: #bedeef !important;
  color: #334155 !important;
}

body :where(.flash.success, .alert-success, .notice.success) {
  background: #e5f7f0 !important;
  border-color: #bcebd9 !important;
  color: #14795a !important;
}

body :where(.flash.error, .alert-error, .notice.error) {
  background: #fff1f1 !important;
  border-color: #f2c5c5 !important;
  color: #a63838 !important;
}

html[data-theme="dark"] body :where(.topbar, .footer, .card, .panel,
  .auth-card, .login-page-panel, .auth-reference-card, .modal-content,
  .dropdown-menu, .nav-menu-panel, .table-simple, .table-wrap,
  .table-responsive, .table-wrapper) {
  background: #172331 !important;
  border-color: #304256 !important;
  color: #e7edf4 !important;
}

html[data-theme="dark"] body :where(.table-simple th, .table-wrap thead th,
  .table-responsive thead th, .table-wrapper thead th) {
  background: #1e2d3d !important;
  border-color: #304256 !important;
  color: #cbd5e1 !important;
}

html[data-theme="dark"] body :where(.table-simple td, .table-wrap td,
  .table-responsive td, .table-wrapper td, .section-head h1, .section-head h2,
  .section-head h3, .page-header h1, .page-header h2, .page-header h3,
  .card h1, .card h2, .card h3, .panel h1, .panel h2, .panel h3) {
  color: #e7edf4 !important;
  border-color: #304256 !important;
}

/* Tablas: una cabecera compacta y estable en todas las vistas. */
body :where(table) thead th {
  background: #eef2f7 !important;
  background-image: none !important;
  border-bottom: 1px solid #cbd5e1 !important;
  border-color: #d9e2ec !important;
  color: #475569 !important;
  font-size: .72rem !important;
  font-weight: 800 !important;
  letter-spacing: .035em !important;
  line-height: 1.25 !important;
  min-height: 0 !important;
  padding: 10px 12px !important;
  text-transform: uppercase;
  vertical-align: middle !important;
  white-space: normal !important;
}

body :where(table) thead th:first-child { border-top-left-radius: 7px; }
body :where(table) thead th:last-child { border-top-right-radius: 7px; }

html[data-theme="dark"] body :where(table) thead th {
  background: #1e2d3d !important;
  border-color: #304256 !important;
  color: #cbd5e1 !important;
}

/* El color y la anchura del sidebar son idénticos plegado y desplegado. */
html[data-theme="light"] body.app-sidebar-page .app-sidebar,
html[data-theme="light"] body.app-sidebar-page.app-sidebar-collapsed .app-sidebar {
  background: #17202c !important;
  background-color: #17202c !important;
  background-image: none !important;
  border-color: #2a3748 !important;
  color: #b8c3d1 !important;
}

html[data-theme="light"] body.app-sidebar-page .app-sidebar-logo-mark,
html[data-theme="light"] body.app-sidebar-page.app-sidebar-collapsed .app-sidebar-logo-mark {
  background: #0478b2 !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

html[data-theme="light"] body.app-sidebar-page .app-sidebar-toggle,
html[data-theme="light"] body.app-sidebar-page.app-sidebar-collapsed .app-sidebar-toggle {
  background: #253449 !important;
  border-color: #3a4b61 !important;
  color: #d9e2ec !important;
}

html[data-theme="light"] body.app-sidebar-page .app-sidebar-toggle:hover,
html[data-theme="light"] body.app-sidebar-page .app-sidebar-toggle:focus-visible,
html[data-theme="light"] body.app-sidebar-page.app-sidebar-collapsed .app-sidebar-toggle:hover,
html[data-theme="light"] body.app-sidebar-page.app-sidebar-collapsed .app-sidebar-toggle:focus-visible {
  background: #30445e !important;
  color: #ffffff !important;
}

html[data-theme="light"] body.app-sidebar-page .app-sidebar-footer,
html[data-theme="light"] body.app-sidebar-page.app-sidebar-collapsed .app-sidebar-footer {
  border-color: #2a3748 !important;
}

/* Submenús anidados del área Admin permanecen visibles y legibles. */
html[data-theme="light"] body.app-sidebar-page .app-sidebar-panel-admin {
  max-height: 1200px !important;
  overflow: visible !important;
  padding-left: 34px !important;
}

html[data-theme="light"] body.app-sidebar-page .app-sidebar-panel-admin .nav-menu-section {
  display: block !important;
  min-width: 0;
}

html[data-theme="light"] body.app-sidebar-page .app-sidebar-panel-admin .nav-menu-section > summary {
  align-items: center;
  color: #9eacbc !important;
  cursor: pointer;
  display: flex !important;
  font-size: .72rem !important;
  font-weight: 800;
  justify-content: space-between;
  letter-spacing: .04em;
  min-height: 32px;
  padding: 7px 8px !important;
  text-transform: uppercase;
}

html[data-theme="light"] body.app-sidebar-page .app-sidebar-panel-admin .nav-menu-section > summary:hover,
html[data-theme="light"] body.app-sidebar-page .app-sidebar-panel-admin .nav-menu-section[open] > summary {
  background: #202d3d !important;
  color: #ffffff !important;
}

html[data-theme="light"] body.app-sidebar-page .app-sidebar-panel-admin .nav-menu-subpanel {
  display: grid !important;
  gap: 2px;
  max-height: none !important;
  opacity: 1 !important;
  overflow: visible !important;
  padding: 2px 0 6px 8px !important;
  transform: none !important;
}

html[data-theme="light"] body.app-sidebar-page .app-sidebar-panel-admin .nav-menu-subpanel a {
  display: flex !important;
  min-height: 30px;
  padding: 6px 8px !important;
}

html[data-theme="light"] body.app-sidebar-page .app-sidebar-panel-admin .nav-menu-subpanel a.active {
  background: #253449 !important;
  color: #ffffff !important;
  box-shadow: inset 2px 0 0 #0478b2 !important;
}

html[data-theme="light"] body.app-sidebar-page.app-sidebar-collapsed .app-sidebar-panel-admin {
  display: none !important;
}

html[data-theme="dark"] body.app-sidebar-page .app-sidebar-panel-admin .nav-menu-section > summary:hover,
html[data-theme="dark"] body.app-sidebar-page .app-sidebar-panel-admin .nav-menu-section[open] > summary,
html[data-theme="dark"] body.app-sidebar-page .app-sidebar-panel-admin .nav-menu-subpanel a.active {
  background: #253449 !important;
  color: #ffffff !important;
}

.sim-detail-page { max-width: 1180px; }
.sim-detail-header { align-items: flex-start; }
.sim-detail-header h2 { margin-top: 10px; }
.back-link {
  color: #035e8c !important;
  display: inline-flex;
  font-size: .86rem;
  font-weight: 700;
  text-decoration: none;
}
.back-link:hover { color: #1f56ad !important; text-decoration: underline; }
.sim-detail-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.detail-card {
  background: #ffffff;
  border: 1px solid #d9e2ec;
  border-radius: 12px;
  min-width: 0;
  padding: 20px;
}
.sim-instrument-card { grid-column: 1 / -1; }
.detail-card-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 16px;
}
.eyebrow {
  color: #64748b;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.detail-list { display: grid; gap: 0; margin: 0; }
.detail-list > div {
  align-items: baseline;
  border-top: 1px solid #e2e8f0;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(120px, .7fr) minmax(0, 1.3fr);
  padding: 12px 0;
}
.detail-list > div:first-child { border-top: 0; padding-top: 0; }
.detail-list dt { color: #64748b; font-size: .82rem; font-weight: 700; }
.detail-list dd { color: #1f2937; font-weight: 700; margin: 0; overflow-wrap: anywhere; }
.sim-detail-security-note {
  background: #f5f8fc;
  border: 1px solid #d9e2ec;
  border-radius: 10px;
  color: #64748b;
  font-size: .82rem;
  margin: 16px 0 0;
  padding: 12px 14px;
}
html[data-theme="dark"] .detail-card {
  background: #172331;
  border-color: #304256;
}
html[data-theme="dark"] .detail-list > div { border-color: #304256; }
html[data-theme="dark"] .detail-list dt,
html[data-theme="dark"] .sim-detail-security-note { color: #aab7c7; }
html[data-theme="dark"] .detail-list dd { color: #e7edf4; }
html[data-theme="dark"] .sim-detail-security-note { background: #1e2d3d; border-color: #304256; }
@media (max-width: 760px) {
  .sim-detail-grid { grid-template-columns: 1fr; }
  .sim-instrument-card { grid-column: auto; }
  .detail-list > div { grid-template-columns: 1fr; gap: 4px; }
}

/* Shared UI contract: EMQX geometry, Moeve digital blue. These rules own
   layout/interaction; feature styles retain only domain-specific content. */
:root {
  --nav-bg: #17202c;
  --nav-hover: #233345;
  --nav-line: #324255;
  --nav-text: #bdcad7;
  --nav-active: #ffffff;
  --focus-ring: 0 0 0 3px rgb(4 120 178 / 20%);
}
body.app-sidebar-page { --app-sidebar-width: clamp(256px, 20vw, 304px); --app-sidebar-collapsed-width: 68px; }
body #main-content { min-width: 0; color: var(--text); }
body #main-content :where(.container, .admin-shell, .admin-main-panel, .admin-list-page, .panel, .card, .grid, .form-grid) { min-width: 0; max-width: 100%; }
body #main-content :where(.section-head, .page-header, .admin-list-header, .detail-card-header) { gap: 16px; flex-wrap: wrap; }
body #main-content :where(.section-head, .page-header, .admin-list-header) :is(h1,h2) { font-size: clamp(1.3rem, 2vw, 1.65rem) !important; line-height: 1.3 !important; letter-spacing: -.02em; }
body #main-content :where(.card, .panel, .detail-card, .admin-form-block) { border-radius: 8px !important; box-shadow: none !important; }
body #main-content :where(.row-actions, .actions, .filters-actions, .admin-filters, .pagination) { flex-wrap: wrap; gap: 8px; }
body #main-content :where(.filters-actions, .admin-filters) > :is(input, select) { flex: 1 1 170px; width: auto; min-width: 0 !important; max-width: 100%; }
body #main-content :where(.filters-actions, .admin-filters) > input[type=search] { flex-basis: 260px; }
body #main-content :where(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=hidden]),select,textarea) {
  background-color: var(--surface) !important; color: var(--text) !important;
  border: 1px solid var(--line) !important; border-radius: 5px !important;
  font: inherit; font-size: .875rem; min-height: 36px; max-width: 100%;
}
body :where(input,select,textarea)::placeholder { color: var(--muted); opacity: 1; }
body :where(input,select,textarea):focus { border-color: var(--primary) !important; box-shadow: var(--focus-ring) !important; }
body :where(button,a,summary,input,select,textarea):focus-visible { outline: 2px solid var(--primary) !important; outline-offset: 3px; }
body :where(input[type=checkbox],input[type=radio],input[type=range]) { accent-color: var(--primary); }
body #main-content :where(input,select,textarea):disabled { background: var(--surface-soft) !important; color: var(--muted) !important; cursor: not-allowed; }
body :where(.btn,button.btn) { border-radius: 5px !important; min-height: 34px; font-size: .83rem; line-height: 1.3; box-shadow: none !important; }
html body #main-content :where(.btn-primary), html body :where(.topbar-global-search button,.app-sidebar-logo-mark) {
  background: var(--primary) !important; border-color: var(--primary) !important; color: #fff !important;
}
html body #main-content :where(.btn-primary:hover,.btn-primary:focus-visible) { background: var(--primary-strong) !important; border-color: var(--primary-strong) !important; }
html body #main-content :where(.btn-outline,.btn-secondary) { background: var(--surface) !important; border-color: var(--line) !important; color: var(--text) !important; }
html body #main-content :where(.btn-outline:hover,.btn-secondary:hover) { background: var(--accent-soft) !important; border-color: var(--primary) !important; color: var(--primary-strong) !important; }
html body #main-content :where(.badge.primary,.badge-info,.status-pill.info,.is-info) { background: var(--accent-soft) !important; border-color: #bedeeE !important; color: var(--primary-strong) !important; }
html body #main-content :where(.badge.success,.badge-success,.status-pill.success,.is-ok) { background: #e5f7f0 !important; border-color: #bcebd9 !important; color: #14795a !important; }
html body #main-content :where(.badge.warning,.badge-warning,.status-pill.warning) { background: #fff5df !important; color: #865a0a !important; border-color: #ead19b !important; }
html body #main-content :where(.badge.danger,.badge-danger,.status-pill.danger,.btn-danger) { background: #fff1f1 !important; color: #a63838 !important; border-color: #f2c5c5 !important; }

/* One sidebar at every nesting depth. Native details controls visibility;
   panel height must never clamp a longer administration branch. */
html body.app-sidebar-page .app-sidebar,
html body.app-sidebar-page.app-sidebar-collapsed .app-sidebar { background: var(--nav-bg) !important; background-image: none !important; color: var(--nav-text) !important; border-color: var(--nav-line) !important; box-shadow: none !important; }
html body.app-sidebar-page .app-sidebar :where(.app-sidebar-brand,.app-sidebar-nav,.app-sidebar-footer,.app-sidebar-section,.app-sidebar-panel) { background: transparent !important; border-color: var(--nav-line) !important; }
html body.app-sidebar-page .app-sidebar :where(a,summary,.app-sidebar-toggle,.app-sidebar-icon,.app-sidebar-chevron) { color: var(--nav-text) !important; }
html body.app-sidebar-page .app-sidebar :where(.app-sidebar-logo-copy strong,.app-sidebar-user-copy strong) { color: #fff !important; }
html body.app-sidebar-page .app-sidebar :where(small,.app-sidebar-logo-copy small,.app-sidebar-user-copy small) { color: #a5b5c5 !important; }
html body.app-sidebar-page .app-sidebar :where(.app-sidebar-toggle) { background: var(--nav-hover) !important; border-color: var(--nav-line) !important; }
html body.app-sidebar-page .app-sidebar :where(.app-sidebar-link,summary,.app-sidebar-panel a) { border-radius: 5px !important; box-shadow: none !important; transform: none !important; font-weight: 500; }
html body.app-sidebar-page .app-sidebar :where(a:hover,summary:hover,a:focus-visible,summary:focus-visible) { background: var(--nav-hover) !important; color: #fff !important; }
html body.app-sidebar-page .app-sidebar :where(a.active,a[aria-current=page],.app-sidebar-section[open] > summary,.nav-menu-section[open] > summary) { background: var(--nav-hover) !important; box-shadow: inset 3px 0 var(--primary) !important; color: var(--nav-active) !important; }
html body.app-sidebar-page .app-sidebar .app-sidebar-nav { overflow-y: auto; overflow-x: hidden; min-height: 0; scrollbar-width: thin; scrollbar-color: #50657b transparent; }
html body.app-sidebar-page .app-sidebar .app-sidebar-panel { max-height: none !important; height: auto !important; overflow: visible !important; padding: 3px 0 6px 20px !important; opacity: 1 !important; transform: none !important; transition: none !important; }
html body.app-sidebar-page .app-sidebar .nav-menu-subpanel { display: grid !important; position: static !important; width: auto !important; min-width: 0 !important; max-height: none !important; height: auto !important; overflow: visible !important; opacity: 1 !important; transform: none !important; padding: 3px 0 5px 12px !important; background: transparent !important; border-left: 1px solid var(--nav-line); }
html body.app-sidebar-page .app-sidebar details:not([open]) > :not(summary) { display: none !important; }
html body.app-sidebar-page .app-sidebar .nav-menu-section > summary { font-size: .77rem !important; font-weight: 600 !important; letter-spacing: 0 !important; text-transform: none !important; min-height: 36px; padding: 8px !important; }
html body.app-sidebar-page .app-sidebar .app-sidebar-panel a { display: flex !important; min-height: 34px; padding: 8px !important; font-size: .8rem !important; white-space: normal !important; overflow-wrap: anywhere; }
html body.app-sidebar-page .app-sidebar .app-sidebar-text { white-space: normal; line-height: 1.3; }
html body.app-sidebar-page.app-sidebar-collapsed .app-sidebar .app-sidebar-panel { display: none !important; }
html body.app-sidebar-page.app-sidebar-collapsed .app-sidebar .app-sidebar-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* Data stays tabular: dense tables scroll within their own region, never
   squeeze actions into invisible cells or reflow headers into mobile cards. */
html body #main-content .ui-table-region {
  display: block !important; width: 100% !important; min-width: 0 !important; max-width: 100% !important;
  overflow: auto !important; overscroll-behavior-x: contain; position: relative;
  border: 1px solid var(--line) !important; border-radius: 7px !important; background: var(--surface) !important;
}
html body #main-content table.ui-data-table { display: table !important; width: 100% !important; min-width: var(--table-min-width, 560px) !important; max-width: none !important; table-layout: fixed !important; border-collapse: separate !important; border-spacing: 0 !important; margin: 0 !important; }
html body #main-content table.ui-data-table thead { display: table-header-group !important; visibility: visible !important; }
html body #main-content table.ui-data-table tbody { display: table-row-group !important; }
html body #main-content table.ui-data-table tr { display: table-row !important; padding: 0 !important; border: 0 !important; background: var(--surface) !important; box-shadow: none !important; transform: none !important; }
html body #main-content table.ui-data-table :is(th,td) { display: table-cell !important; min-width: 0 !important; max-width: none !important; width: auto; border: 0 !important; border-bottom: 1px solid var(--line) !important; border-radius: 0 !important; padding: 10px 12px !important; text-align: left; vertical-align: middle !important; white-space: normal !important; overflow-wrap: anywhere; box-shadow: none !important; transform: none !important; }
html body #main-content table.ui-data-table thead th { height: auto !important; min-height: 0 !important; background: var(--surface-soft) !important; color: #475569 !important; font-size: .76rem !important; font-weight: 600 !important; text-transform: none !important; letter-spacing: 0 !important; line-height: 1.35 !important; }
html body #main-content table.ui-data-table tbody td { background: var(--surface) !important; color: var(--text) !important; font-size: .82rem !important; line-height: 1.45 !important; }
html body #main-content table.ui-data-table td::before { display: none !important; }
html body #main-content table.ui-data-table tbody tr:last-child td { border-bottom: 0 !important; }
html body #main-content table.ui-data-table tbody tr:hover td { background: #f3f8fb !important; }
html body #main-content table.ui-data-table :is(th,td).ui-actions-cell { position: sticky !important; right: 0; width: 172px !important; min-width: 172px !important; z-index: 2; box-shadow: -1px 0 0 var(--line) !important; }
html body #main-content table.ui-data-table th.ui-actions-cell { z-index: 3; }
html body #main-content table.ui-data-table td.ui-actions-cell :where(.row-actions,.actions,.table-actions,.sim-actions) { display: flex !important; flex-wrap: wrap !important; gap: 6px !important; justify-content: flex-start; }
html body #main-content table.ui-data-table td :where(button,.btn) { min-height: 30px !important; width: auto !important; max-width: 100% !important; white-space: nowrap !important; overflow-wrap: normal !important; padding: 6px 9px !important; font-size: .75rem !important; }
html body #main-content table.ui-data-table td :where(.btn-icon) { flex-shrink: 0; }
html body #main-content table.ui-data-table td :where(small) { display: block; line-height: 1.45; margin-top: 3px; }
html body #main-content table.ui-data-table th :where(button,a) { color: inherit !important; font: inherit !important; min-height: 0 !important; padding: 0 !important; }
html body #main-content table.ui-data-table .empty-state { padding: 28px 16px !important; text-align: center; }
@media(max-width: 760px) {
  html body #main-content table.ui-data-table :is(th,td).ui-actions-cell { width: 140px !important; min-width: 140px !important; }
  body #main-content :where(.section-head,.page-header,.admin-list-header) { align-items: flex-start; }
  body #main-content :where(.filters-actions,.admin-filters) { display: flex !important; flex-wrap: wrap; }
  body #main-content :where(.filters-actions,.admin-filters) > :is(input,select) { flex-basis: 100%; }
  body #main-content :where(.form-grid,.admin-form-grid) { grid-template-columns: minmax(0,1fr) !important; }
  body #main-content :where(.form-grid,.admin-form-grid) > * { grid-column: auto !important; min-width: 0; }
}
@media(prefers-reduced-motion: reduce) { body .app-sidebar * { transition: none !important; animation: none !important; } }

/* Restore page orientation: breadcrumbs complement, not replace, titles. */
html[data-theme] body.app-sidebar-page #main-content :where(.app-page-header,.admin-list-header,.admin-overview-head,.section-head.page-header,.user-notifications-header,.user-requests-header,.user-tickets-header,.my-alarm-history-header,.support-form-header,.request-form-header,.report-form-header,.report-preview-header,.support-success-header,.request-success-header,.service-ops-head,.gateway-detail-header,.phd-record-head,.solution-catalog-header,.admin-ticket-queue-header,.mqtt-retention-header) {
  display: flex !important; justify-content: space-between !important; align-items: flex-start !important; height: auto !important; gap: 16px !important; margin: 0 0 20px !important;
}
html[data-theme] body.app-sidebar-page #main-content :where(.app-page-header,.admin-list-header,.admin-overview-head,.section-head.page-header,.user-notifications-header,.user-requests-header,.user-tickets-header,.my-alarm-history-header,.support-form-header,.request-form-header,.report-form-header,.report-preview-header,.support-success-header,.request-success-header,.service-ops-head,.gateway-detail-header,.phd-record-head,.solution-catalog-header,.admin-ticket-queue-header,.mqtt-retention-header) :is(h1,h2),
html[data-theme] body.app-sidebar-page #main-content .breadcrumb-duplicate-title {
  display: block !important; clip: auto !important; clip-path: none !important; height: auto !important; width: auto !important; margin: 0 !important; overflow: visible !important; position: static !important; white-space: normal !important;
}
html[data-theme] body.app-sidebar-page #main-content :where(.admin-list-header,.app-page-header,.section-head.page-header) > div:first-child > p { display: block !important; margin: 6px 0 0 !important; max-width: 65ch; color: var(--muted) !important; font-size: .875rem !important; line-height: 1.5 !important; }
html body.app-sidebar-page .app-sidebar .nav-menu-section,
html body.app-sidebar-page .app-sidebar .nav-menu-section > summary,
html body.app-sidebar-page .app-sidebar .nav-menu-subpanel { border: 0 !important; border-radius: 0 !important; }
html body.app-sidebar-page .app-sidebar .nav-menu-subpanel { border-left: 1px solid var(--nav-line) !important; }
html body #main-content .sim-cards-table.ui-data-table th:first-child { width: 184px !important; }
html body #main-content .sim-cards-table.ui-data-table td:first-child strong { font-size: .77rem; font-variant-numeric: tabular-nums; }
@media(max-width:760px) {
  html[data-theme] body #main-content .admin-list-header > .row-actions { display: flex !important; flex-direction: row !important; width: 100%; }
  html[data-theme] body #main-content .admin-list-header > .row-actions .btn { width: auto !important; }
}
html body #main-content table.ui-data-table td :where(button,.btn) { white-space: normal !important; overflow-wrap: anywhere !important; }
html body #main-content table.ui-data-table tbody td { font-size: 13px !important; }
html body #main-content table.ui-data-table thead th { font-size: 12px !important; }
html body #main-content table.ui-data-table td :where(small) { font-size: 12px !important; }
@media(max-width:900px) {
  html body.app-sidebar-page:not(.nav-open) .topbar #topbar-nav { display: none !important; }
  html body.app-sidebar-page.nav-open .topbar #topbar-nav { display: flex !important; flex-direction: column !important; width: 100% !important; min-width: 0 !important; max-width: 100% !important; max-height: calc(100dvh - 170px) !important; overflow: auto !important; }
  html body.app-sidebar-page .topbar #topbar-nav :where(.nav-menu,.nav-menu-panel,.nav-menu-subpanel,.nav-menu-section) { position: static !important; width: 100% !important; min-width: 0 !important; max-width: 100% !important; }
  html body.app-sidebar-page .topbar #topbar-nav a { white-space: normal !important; }
  html body.app-sidebar-page .topbar #topbar-nav details:not([open]) > :not(summary) { display: none !important; }
}
@media(max-width:1100px) {
  html body #main-content .ui-table-region::before { content: '↔ Desplaza la tabla para ver todas las columnas'; display: block; position: sticky; left: 0; padding: 8px 12px; background: var(--surface); color: var(--muted); font-size: 11px; border-bottom: 1px solid var(--line); }
}
html[data-theme] body.auth-page #main-content .login-page-header > div > span { color: var(--primary) !important; }
html[data-theme] body.ui-unified-page.app-standard #main-content form .field { align-content: start; }
html[data-theme] body.ui-unified-page.app-standard #main-content form :where(.specs,.form-grid,.admin-form-grid) { align-items: start; }
html[data-theme] body #main-content .admin-form-block > .specs + .field { margin-top: 14px !important; }

/* Sidebar aligned with NeuronEX. Keep IoTHub's permission-aware navigation. */
html[data-theme] body.app-sidebar-page {
  --app-sidebar-width: clamp(256px, 20vw, 304px);
  --app-sidebar-collapsed-width: 68px;
  --sidebar-nav-bg: #17202c;
  --sidebar-nav-hover: #233345;
  --sidebar-nav-line: #324255;
  --sidebar-nav-text: #bdcad7;
}
html[data-theme] body.app-sidebar-page .app-sidebar {
  height: 100dvh;
  padding: 16px 12px 10px;
  background: var(--sidebar-nav-bg) !important;
  border-color: var(--sidebar-nav-line) !important;
  box-shadow: none !important;
  color: var(--sidebar-nav-text) !important;
}
html[data-theme] body.app-sidebar-page .app-sidebar-brand {
  flex-shrink: 0;
  min-height: 0;
  padding: 4px 8px 20px !important;
  border-color: var(--sidebar-nav-line) !important;
  grid-template-columns: minmax(0, 1fr) 30px;
}
html[data-theme] body.app-sidebar-page .app-sidebar-logo-mark { border-radius: 5px !important; }
html[data-theme] body.app-sidebar-page .app-sidebar-logo-copy { line-height: 1.2; }
html[data-theme] body.app-sidebar-page .app-sidebar-logo-copy strong { font-size: .9rem; letter-spacing: .03em; }
html[data-theme] body.app-sidebar-page .app-sidebar-logo-copy small { font-size: .7rem; font-weight: 400; color: var(--sidebar-nav-text) !important; }
html[data-theme] body.app-sidebar-page .app-sidebar-toggle { width: 30px; height: 30px; }
html[data-theme] body.app-sidebar-page .app-sidebar-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  gap: 4px;
  padding: 16px 0 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: #50657b transparent;
}
html[data-theme] body.app-sidebar-page .app-sidebar :is(.app-sidebar-link, .app-sidebar-section > summary) {
  flex-shrink: 0;
  min-height: 40px;
  padding: 10px;
  gap: 11px;
  grid-template-columns: 20px minmax(0, 1fr);
  border-radius: 5px !important;
  font-size: .85rem;
  font-weight: 500;
  color: var(--sidebar-nav-text) !important;
}
html[data-theme] body.app-sidebar-page .app-sidebar-section { flex-shrink: 0; }
html[data-theme] body.app-sidebar-page .app-sidebar-section > summary { grid-template-columns: 20px minmax(0, 1fr) 7px !important; }
html[data-theme] body.app-sidebar-page .app-sidebar-text { white-space: normal; line-height: 1.3; }
html[data-theme] body.app-sidebar-page .app-sidebar-icon { width: 20px; height: 20px; color: inherit !important; transform: none !important; }
html[data-theme] body.app-sidebar-page .app-sidebar-icon svg { width: 20px; height: 20px; stroke-width: 1.7; }
html[data-theme] body.app-sidebar-page .app-sidebar :is(a, summary, button):hover,
html[data-theme] body.app-sidebar-page .app-sidebar :is(a, summary, button):focus-visible {
  background: var(--sidebar-nav-hover) !important;
  color: #fff !important;
  transform: none !important;
}
html[data-theme] body.app-sidebar-page .app-sidebar :is(a, summary, button):focus-visible { outline: 2px solid #54b8e8; outline-offset: -2px; }
html[data-theme] body.app-sidebar-page .app-sidebar-section[open] > summary {
  background: transparent !important;
  box-shadow: none !important;
}
html[data-theme] body.app-sidebar-page .app-sidebar :is(a.active, a[aria-current="page"], .app-sidebar-section.active > summary) {
  background: var(--sidebar-nav-hover) !important;
  color: #fff !important;
  box-shadow: inset 3px 0 #0478b2 !important;
}
html[data-theme] body.app-sidebar-page .app-sidebar-panel { padding-left: 31px !important; }
html[data-theme] body.app-sidebar-page .app-sidebar-panel :is(a, summary) {
  font-size: .8rem !important;
  font-weight: 500;
  color: var(--sidebar-nav-text) !important;
  border-radius: 5px;
  white-space: normal;
  line-height: 1.3;
}
html[data-theme] body.app-sidebar-page .app-sidebar-panel-admin .nav-menu-section > summary {
  font-size: .68rem !important;
  font-weight: 700;
  letter-spacing: .08em;
  color: #94a9bd !important;
  padding: 14px 8px 6px !important;
  background: transparent !important;
}
html[data-theme] body.app-sidebar-page .app-sidebar-panel-admin .nav-menu-subpanel { padding-left: 0 !important; }
html[data-theme] body.app-sidebar-page .app-sidebar-footer {
  flex-shrink: 0;
  margin-top: 12px;
  padding: 12px 6px 4px;
  border-color: var(--sidebar-nav-line) !important;
}
html[data-theme] body.app-sidebar-page .app-sidebar-user-copy small { color: var(--sidebar-nav-text) !important; }
html[data-theme] body.app-sidebar-page.app-sidebar-collapsed .app-sidebar { padding-inline: 10px; }
html[data-theme] body.app-sidebar-page.app-sidebar-collapsed .app-sidebar-brand { padding-inline: 6px !important; grid-template-columns: 1fr; }
html[data-theme] body.app-sidebar-page.app-sidebar-collapsed .app-sidebar :is(.app-sidebar-link, .app-sidebar-section > summary) { grid-template-columns: 20px !important; justify-content: center; }
@media (max-width: 900px) {
  html[data-theme] body.app-sidebar-page { --app-sidebar-width: min(304px, calc(100vw - 48px)); }
}
html[data-theme] body.app-sidebar-page .app-sidebar-panel-admin .nav-menu-section[open] > summary {
  background: transparent !important;
  box-shadow: none !important;
  color: #94a9bd !important;
}
html[data-theme] body.app-sidebar-page .app-sidebar-footer { display: flex; align-items: center; gap: 8px; }
html[data-theme] body.app-sidebar-page .app-sidebar-user { flex: 1; min-width: 0; margin: 0; padding: 0; }
html[data-theme] body.app-sidebar-page .app-sidebar-user-avatar { width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px; }
html[data-theme] body.app-sidebar-page .app-sidebar-logout-form .app-sidebar-link { display: flex; padding: 6px; font-size: .72rem; }
html[data-theme] body.app-sidebar-page:not(.app-sidebar-collapsed) .app-sidebar-logout-form .app-sidebar-icon { display: none; }
html[data-theme] body.app-sidebar-page.app-sidebar-collapsed .app-sidebar-nav { padding-inline: 0; gap: 4px; }
html[data-theme] body.app-sidebar-page.app-sidebar-collapsed .app-sidebar :is(.app-sidebar-link, .app-sidebar-section > summary) { width: 46px; min-height: 40px; }
html[data-theme] body.app-sidebar-page.app-sidebar-collapsed .app-sidebar-footer { justify-content: center; padding-inline: 0; }
html[data-theme] body.app-sidebar-page.app-sidebar-collapsed .app-sidebar-user { display: none; }
