:root{
  --ot-bg:#070713;--ot-bg-2:#0d0b1d;--ot-surface:#111022;--ot-surface-2:#17142d;
  --ot-surface-3:#201943;--ot-line:rgba(151,126,255,.18);--ot-line-strong:rgba(151,126,255,.34);
  --ot-text:#f8f7ff;--ot-muted:#a7a1bd;--ot-purple:#7b39fc;--ot-purple-2:#9c6bff;
  --ot-green:#39d98a;--ot-red:#ff617c;--ot-amber:#ffb84d;--ot-blue:#65a4ff;
  --ot-shadow:0 26px 80px rgba(0,0,0,.36);--ot-radius:18px;
}
html{background:var(--ot-bg)}
body{font-family:Manrope,Inter,"Segoe UI Variable Text","Segoe UI",system-ui,sans-serif;background:
  radial-gradient(circle at 82% -8%,rgba(123,57,252,.24),transparent 31%),
  radial-gradient(circle at 10% 92%,rgba(69,37,162,.18),transparent 34%),
  linear-gradient(150deg,var(--ot-bg),var(--ot-bg-2));color:var(--ot-text)}

/* Centro de Operaciones y acceso */
body .auth-shell{background:transparent}
body .auth-card{border-color:var(--ot-line);background:rgba(17,16,34,.92);box-shadow:var(--ot-shadow);color:var(--ot-text)}
body .auth-card h1,body .auth-copy h1,body .auth-brand strong{color:var(--ot-text)}
body .auth-brand small,body .auth-copy p,body .auth-card>p,body .muted{color:var(--ot-muted)}
body .eyebrow{color:var(--ot-purple-2)}
body .brand-mark{background:linear-gradient(145deg,var(--ot-purple-2),var(--ot-purple));box-shadow:0 12px 32px rgba(123,57,252,.34)}
body label{color:#ddd9ef}
body input,body select,body textarea{border-color:var(--ot-line);background:#0c0b19;color:var(--ot-text)}
body input::placeholder,body textarea::placeholder{color:#77718d}
body input:focus,body select:focus,body textarea:focus{border-color:var(--ot-purple-2);box-shadow:0 0 0 4px rgba(123,57,252,.15)}
body .manual-key,body .dialog-card pre{background:#0c0b19;color:var(--ot-text)}
body .emergency-link,body .link-button,body .text-button{color:var(--ot-purple-2)}

body .dashboard{background:transparent}
body .sidebar{border-color:var(--ot-line);background:rgba(8,7,20,.94);box-shadow:12px 0 46px rgba(0,0,0,.24)}
body .sidebar-brand strong,body .profile-copy strong{color:var(--ot-text)}
body .sidebar-brand small,body .profile-copy small{color:var(--ot-muted)}
body .sidebar-footer{border-color:var(--ot-line)}
body .nav{color:#bbb5cd}
body .nav:hover{background:rgba(123,57,252,.11);color:#fff}
body .nav.active{background:linear-gradient(90deg,rgba(123,57,252,.36),rgba(123,57,252,.12));color:#fff;box-shadow:inset 0 0 0 1px rgba(156,107,255,.2)}
body .content{background:transparent}
body .page-heading h1,body .workspace-card h2,body .workspace-card h3,body .card-header h2,body .card-header h3,body .kpi-card strong{color:var(--ot-text)}
body .page-heading>p:last-child,body .breadcrumb,body .card-header p,body .session-clock{color:var(--ot-muted)}
body .breadcrumb span:first-child{color:var(--ot-purple-2)}
body .workspace-card,body .kpi-card,body .account-card,body .audit-filter-card,body .sessions-open-card,body .sessions-history-card,body .alerts-workspace,body .history-workspace,body .incidents-workspace{border-color:var(--ot-line);background:linear-gradient(155deg,rgba(24,20,49,.95),rgba(14,13,30,.95));box-shadow:0 18px 54px rgba(0,0,0,.2)}
body .kpi-icon{background:rgba(123,57,252,.16)!important;color:var(--ot-purple-2)!important}
body .kpi-card span,body .kpi-card small,body .detail-item span:first-child{color:var(--ot-muted)}
body .section-purpose{border-color:var(--ot-line);background:rgba(123,57,252,.08);color:#c8c2d7}
body .section-purpose strong{color:var(--ot-purple-2)}
body .section-toolbar,body .card-header,body .table-footer,body .incident-head{border-color:var(--ot-line);background:rgba(11,10,24,.5)}
body table{color:var(--ot-text)}
body th{color:#9f98b4;background:rgba(11,10,24,.65);border-color:var(--ot-line)}
body td{border-color:var(--ot-line);color:#dcd8e8}
body tbody tr,body .recent-access-item,body .incident-card,body .alert-card{background:rgba(14,13,30,.65);border-color:var(--ot-line)}
body tbody tr:hover,body .recent-access-item:hover{background:rgba(123,57,252,.08)}
body .alert-card.critical,body .incident-card.blocked{background:linear-gradient(90deg,rgba(255,97,124,.12),rgba(14,13,30,.75) 48%)}
body .alert-card.warning{background:linear-gradient(90deg,rgba(255,184,77,.12),rgba(14,13,30,.75) 48%)}
body .status-list,body .detail-panel,body .diagnostic-summary,body .audit-detail-item,body .permission-group,body .profile-selector,body .permission-readable,body .security-check,body .security-policy-summary>div{border-color:var(--ot-line);background:rgba(10,9,22,.72);color:var(--ot-text)}
body .permission-group h5,body .profile-selector{background:rgba(123,57,252,.08);color:var(--ot-text)}
body .permission-readable strong,body .permission-readable small,body .profile-selector small{color:inherit}
body .permission-readable small,body .profile-selector small{color:var(--ot-muted)}
body .primary{background:linear-gradient(135deg,var(--ot-purple),#6022df);box-shadow:0 10px 24px rgba(123,57,252,.26)}
body .primary:hover{background:linear-gradient(135deg,#8c50ff,var(--ot-purple))}
body .secondary,body .mini,body .icon-button,body .history-detail-button,body .audit-detail-button{border-color:var(--ot-line);background:rgba(255,255,255,.045);color:#e3dff0}
body .secondary:hover,body .mini:hover,body .icon-button:hover{border-color:var(--ot-line-strong);background:rgba(123,57,252,.12);color:#fff}
body .danger{background:rgba(255,97,124,.08);border-color:rgba(255,97,124,.32);color:#ff8599}
body .warning-banner{border-color:rgba(255,184,77,.34);background:rgba(255,184,77,.1);color:#ffd28b}
body dialog{border:1px solid var(--ot-line);background:var(--ot-surface);color:var(--ot-text);box-shadow:0 38px 105px rgba(0,0,0,.55)}
body dialog::backdrop{background:rgba(2,2,8,.74);backdrop-filter:blur(6px)}
body .dialog-header p,body .form-message{color:var(--ot-muted)}
body .toast{background:#201747;border:1px solid var(--ot-line-strong)}
body .skeleton-list span{background:linear-gradient(90deg,#131126 25%,#211943 50%,#131126 75%);background-size:220% 100%}
body .empty-state,body .empty-state span,body .empty-state small{color:var(--ot-muted)}

/* Página pública de estado */
body.status-page{min-height:100vh;margin:0;padding:22px}
.status-shell{width:min(1480px,100%);margin:0 auto;min-height:calc(100vh - 44px);display:grid;grid-template-rows:auto 1fr auto;border:1px solid var(--ot-line);border-radius:26px;background:rgba(8,7,20,.78);box-shadow:var(--ot-shadow);overflow:hidden}
.status-nav{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:20px 26px;border-bottom:1px solid var(--ot-line)}
.status-brand{display:flex;align-items:center;gap:13px}.status-brand-mark{display:grid;place-items:center;width:44px;height:44px;border-radius:14px;background:linear-gradient(145deg,var(--ot-purple-2),var(--ot-purple));box-shadow:0 12px 28px rgba(123,57,252,.32)}
.status-brand-mark svg{width:28px;height:28px;fill:#fff}.status-brand strong,.status-brand small{display:block}.status-brand strong{font-size:1.03rem;letter-spacing:.08em}.status-brand small{margin-top:2px;color:var(--ot-muted);font-size:.72rem;letter-spacing:.11em}
.status-nav-actions{display:flex;gap:10px;flex-wrap:wrap}.status-link{display:inline-flex;align-items:center;justify-content:center;min-height:42px;padding:0 16px;border:1px solid var(--ot-line);border-radius:11px;color:#f7f5ff;text-decoration:none;font-weight:750}.status-link:hover{border-color:var(--ot-line-strong);background:rgba(123,57,252,.1)}.status-link.primary{border:0;background:linear-gradient(135deg,var(--ot-purple),#6224e5)}
.status-main{display:grid;grid-template-columns:minmax(0,1.05fr) minmax(500px,.95fr);gap:42px;align-items:center;padding:64px clamp(28px,5vw,78px)}
.status-copy .eyebrow{display:inline-flex;align-items:center;gap:8px;margin-bottom:18px;padding:8px 12px;border:1px solid var(--ot-line);border-radius:999px;background:rgba(123,57,252,.1);color:#cbb7ff;font-size:.74rem;font-weight:800;letter-spacing:.08em}
.status-copy h1{max-width:760px;margin:0;color:#fff;font-family:"Instrument Serif",Georgia,serif;font-size:clamp(3rem,6vw,6.4rem);font-weight:400;line-height:.94;letter-spacing:-.045em}.status-copy h1 em{color:#c9adff;font-weight:400}.status-copy p{max-width:700px;margin:24px 0 0;color:var(--ot-muted);font-size:1.05rem;line-height:1.7}
.status-badge{display:inline-flex;align-items:center;gap:9px;margin-top:25px;color:var(--ot-green);font-weight:800}.status-badge i{width:10px;height:10px;border-radius:50%;background:var(--ot-green);box-shadow:0 0 0 7px rgba(57,217,138,.1)}.status-badge.pending{color:var(--ot-amber)}.status-badge.pending i{background:var(--ot-amber);box-shadow:0 0 0 7px rgba(255,184,77,.1)}
.status-panel{padding:22px;border:1px solid var(--ot-line);border-radius:22px;background:linear-gradient(155deg,rgba(30,24,61,.96),rgba(12,11,25,.96));box-shadow:0 24px 60px rgba(0,0,0,.24)}
.status-panel-head{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;padding:6px 4px 20px}.status-panel-head h2{margin:0;font-size:1.16rem}.status-panel-head p{margin:5px 0 0;color:var(--ot-muted);font-size:.8rem}.status-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.status-card{min-height:120px;padding:17px;border:1px solid var(--ot-line);border-radius:15px;background:rgba(255,255,255,.025)}.status-card span{display:block;color:var(--ot-muted);font-size:.69rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.status-card b{display:block;margin-top:16px;color:#fff;font-size:1rem}.status-card b.ok{color:var(--ot-green)}.status-card b.mock{color:var(--ot-blue)}.status-card b.pending{color:var(--ot-amber)}.status-card b.error{color:var(--ot-red)}
.status-footer{display:flex;justify-content:space-between;gap:18px;padding:17px 26px;border-top:1px solid var(--ot-line);color:var(--ot-muted);font-size:.74rem}
@media(max-width:980px){.status-main{grid-template-columns:1fr;padding-top:42px}.status-copy h1{font-size:clamp(3rem,10vw,5.4rem)}}
@media(max-width:640px){body.status-page{padding:0}.status-shell{min-height:100vh;border-radius:0}.status-nav{align-items:flex-start;flex-direction:column}.status-nav-actions{width:100%}.status-link{flex:1}.status-main{padding:36px 18px}.status-grid{grid-template-columns:1fr}.status-footer{flex-direction:column}}

/* Paneles desplegables heredados, unificados con el tema oscuro */
body .system-health-panel,body .sessions-history-card,body .network-diagnostic{border:1px solid var(--ot-line);border-radius:18px;background:linear-gradient(155deg,rgba(24,20,49,.95),rgba(14,13,30,.95));color:var(--ot-text);overflow:hidden;box-shadow:0 18px 54px rgba(0,0,0,.2)}
body .system-health-panel>summary,body .sessions-history-card>summary,body .network-diagnostic>summary{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:18px 20px;background:rgba(11,10,24,.55);color:var(--ot-text);cursor:pointer;list-style:none}
body .system-health-panel>summary::-webkit-details-marker,body .sessions-history-card>summary::-webkit-details-marker,body .network-diagnostic>summary::-webkit-details-marker{display:none}
body .system-health-panel>summary strong,body .sessions-history-card>summary strong,body .network-diagnostic>summary strong{display:block;color:var(--ot-text)}
body .system-health-panel>summary small,body .sessions-history-card>summary small,body .network-diagnostic>summary small{display:block;margin-top:4px;color:var(--ot-muted)}
body .system-health-panel[open]>summary,body .sessions-history-card[open]>summary,body .network-diagnostic[open]>summary{border-bottom:1px solid var(--ot-line)}
body .system-health-panel .status-list,body .sessions-history-card .table-wrap,body .network-diagnostic .diagnostic-summary{margin:16px}

/* Preview Beta 3.1 — corrección de superficies dinámicas del Centro de Operaciones */
body .compact-search,
body .filter-search,
body .summary-alert,
body .summary-user,
body .action-menu>summary,
body .action-menu-panel,
body .user-detail-panel,
body .detail-tabs,
body .detail-panel,
body .alert-card,
body .history-detail-button,
body .audit-detail-button,
body .incident-card,
body .technical-details[open],
body .security-policy-summary,
body .recent-access-item,
body .pagination button,
body .empty-state,
body .dialog-card {
  border-color:var(--ot-line)!important;
  background:rgba(12,11,25,.9)!important;
  color:var(--ot-text)!important;
}
body .summary-alert.critical,
body .alert-card.critical,
body .incident-card.blocked {
  border-color:rgba(255,97,124,.3)!important;
  border-left-color:var(--ot-red)!important;
  background:linear-gradient(90deg,rgba(255,97,124,.14),rgba(12,11,25,.94) 48%)!important;
}
body .summary-alert.warning,
body .alert-card.warning {
  border-color:rgba(255,184,77,.3)!important;
  border-left-color:var(--ot-amber)!important;
  background:linear-gradient(90deg,rgba(255,184,77,.13),rgba(12,11,25,.94) 48%)!important;
}
body .summary-user:hover,
body .recent-access-item:hover,
body tbody tr:hover>td,
body .pagination button:hover,
body .pagination button.active {
  border-color:var(--ot-line-strong)!important;
  background:rgba(123,57,252,.11)!important;
  color:#fff!important;
}
body .summary-alert strong,
body .summary-user strong,
body .summary-user .person strong,
body .alert-card h3,
body .history-alert strong,
body .incident-card h3,
body .incident-person strong,
body .recent-access-person strong,
body .recent-access-main h3,
body .detail-panel h4,
body .empty-state strong,
body .security-policy-summary strong,
body .action-menu-panel strong {
  color:var(--ot-text)!important;
}
body .summary-alert small,
body .summary-alert time,
body .summary-user .person small,
body .alert-card p,
body .alert-label,
body .alert-value small,
body .history-alert p,
body .history-alert small,
body .incident-main p,
body .incident-person small,
body .incident-count-secondary,
body .incident-status>small,
body .recent-access-person small,
body .recent-access-main p,
body .recent-access-main small,
body .recent-access-time strong,
body .security-policy-summary span,
body .technical-details ul,
body .empty-state span,
body .empty-state small {
  color:var(--ot-muted)!important;
}
body .role-label,
body .alert-value,
body .detail-item>span:last-child {
  color:#ddd8ee!important;
}
body .compact-search,
body .filter-search {
  color:var(--ot-muted)!important;
}
body .compact-search input,
body .filter-search input {
  color:var(--ot-text)!important;
  background:transparent!important;
}
body .compact-search input::placeholder,
body .filter-search input::placeholder {
  color:#77718d!important;
}
body .user-main-row.is-expanded>td,
body .detail-row>td {
  background:rgba(123,57,252,.055)!important;
  border-color:var(--ot-line)!important;
}
body .detail-tabs {
  border-color:var(--ot-line)!important;
}
body .detail-tab {
  color:var(--ot-muted)!important;
}
body .detail-tab:hover,
body .detail-tab.active {
  color:var(--ot-purple-2)!important;
}
body .action-menu-panel {
  box-shadow:0 24px 65px rgba(0,0,0,.5)!important;
}
body .incident-head {
  border-color:var(--ot-line)!important;
  background:rgba(11,10,24,.72)!important;
  color:#aaa3bc!important;
}
body .incident-card,
body .recent-access-item,
body .history-alert {
  border-color:var(--ot-line)!important;
}
body .technical-details summary {
  color:var(--ot-purple-2)!important;
}
body .pagination button:disabled {
  background:rgba(255,255,255,.025)!important;
  color:#625d73!important;
}
body .empty-state.success {
  border-color:rgba(57,217,138,.25)!important;
  background:rgba(57,217,138,.055)!important;
}
body .avatar,
body .profile-avatar {
  background:rgba(123,57,252,.16)!important;
  color:#cbb7ff!important;
}
body .status-badge.active,
body .user-pill.active,
body .status-pill.ok {
  background:rgba(57,217,138,.12)!important;
  color:#62e8a5!important;
}
body .status-badge.blocked,
body .user-pill.blocked,
body .status-pill.bad {
  background:rgba(255,97,124,.12)!important;
  color:#ff8398!important;
}
body .status-badge.pending,
body .user-pill.pending,
body .status-pill.pending {
  background:rgba(255,184,77,.12)!important;
  color:#ffc970!important;
}
body .status-badge.info {
  background:rgba(101,164,255,.12)!important;
  color:#8bbaff!important;
}
body .alert-icon,
body .action-icon,
body .info-icon,
body .recent-access-icon,
body .security-check-icon {
  background:rgba(101,164,255,.11)!important;
  color:#8bbaff!important;
}
body .critical .alert-icon,
body .security-check.warning .security-check-icon {
  background:rgba(255,97,124,.12)!important;
  color:#ff8398!important;
}
body .warning .alert-icon,
body .security-check.pending .security-check-icon {
  background:rgba(255,184,77,.12)!important;
  color:#ffc970!important;
}
body .security-check.ready .security-check-icon {
  background:rgba(57,217,138,.12)!important;
  color:#62e8a5!important;
}
body .count-chip.neutral {
  background:rgba(255,255,255,.055)!important;
  color:#b8b2c7!important;
}
body .section-purpose {
  border-color:var(--ot-line)!important;
  background:linear-gradient(135deg,rgba(123,57,252,.1),rgba(101,164,255,.045))!important;
  color:#c7c1d5!important;
}
body dialog,
body .dialog-card {
  background:var(--ot-surface)!important;
}
body .dialog-card pre {
  background:#0b0a17!important;
  color:var(--ot-text)!important;
}
body .card-footer,
body .table-footer {
  border-color:var(--ot-line)!important;
}
body code {
  color:#cbb7ff;
}

@media (max-width:760px){
  body .summary-alert{grid-template-columns:40px 1fr}
  body .summary-alert>div:last-child{grid-column:2;text-align:left}
  body .summary-alert time{text-align:left!important}
}
body .profile-selector select,
body .permission-readable select,
body .permission-friendly-panel select,
body .section-toolbar select,
body .history-tools select,
body .incident-tools select,
body .audit-filters select {
  border-color:var(--ot-line)!important;
  background:#0c0b19!important;
  color:var(--ot-text)!important;
  color-scheme:dark;
}
body .profile-selector option,
body .permission-readable option,
body select option {
  background:#0c0b19;
  color:var(--ot-text);
}

/* Preview Beta 3.2 — escala y acabado común del estado y Centro de Operaciones. */
@media (min-width:1100px){
  body .admin-sidebar{width:292px!important}
  body .admin-main{margin-left:292px!important}
}
body .admin-sidebar .brand strong,body .sidebar-brand strong{font-size:17px!important}
body .admin-nav button,body .sidebar-nav button{min-height:48px!important;font-size:14px!important;padding:0 16px!important}
body .admin-main,body .dashboard-main{font-size:14px}
body .dashboard-header,body .section-header{padding-top:28px!important;padding-bottom:21px!important}
body .dashboard-header h1,body .section-header h1{font-size:34px!important;letter-spacing:-.035em!important}
body .dashboard-header p,body .section-header p{font-size:13px!important}
body .metric-card,body .summary-card,body .admin-card{border-radius:18px!important;box-shadow:0 0 0 1px rgba(155,114,255,.055),0 20px 55px rgba(22,8,55,.18)!important}
body .metric-card{min-height:150px!important;padding:22px!important}
body .metric-card strong{font-size:28px!important}
body table th{font-size:10px!important;padding:15px 17px!important}
body table td{font-size:12px!important;padding:16px 17px!important}
body .summary-alert,body .summary-user,body .alert-card,body .recent-access-item{padding:16px!important;border-radius:14px!important}
body button.primary,body .primary-button{min-height:43px!important;border-radius:11px!important}


/* Portal 3.8 — teclado, movimiento reducido y consistencia visual */
body :where(button,a,input,select,textarea,summary,[tabindex]):focus-visible{outline:3px solid #9f79ff!important;outline-offset:3px!important}
.status-grid-compact{grid-template-columns:repeat(2,minmax(0,1fr))}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}
@media(max-width:640px){.status-grid-compact{grid-template-columns:1fr}}
