:root{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#172033;background:#f5f7fb;line-height:1.5}
*{box-sizing:border-box}
html{width:100%;overflow-x:hidden}
body{margin:0;width:100%;min-width:0;overflow-x:hidden}

.topbar{
  height:68px;
  background:#111827;
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 28px;
  position:sticky;
  top:0;
  z-index:5;
  gap:18px;
}
.topbar-brand{
  display:flex;
  align-items:center;
  gap:14px;
  min-width:0;
}
.topbar-brand a{
  color:#fff;
  text-decoration:none;
  font-weight:750;
  font-size:20px;
  white-space:nowrap;
}
.topbar-brand span,
.role-badge{
  font-size:11px;
  letter-spacing:.08em;
  text-transform:uppercase;
  padding:5px 9px;
  border:1px solid #d5d9e2;
  border-radius:999px;
  white-space:nowrap;
}
.topbar-user{
  display:flex;
  align-items:center;
  gap:18px;
  min-width:0;
}
.topbar-user strong,
.topbar-user small{
  display:block;
}
.topbar-user small{
  color:#c7cfdb;
}
.topbar-user button{
  background:transparent;
  color:#fff;
  border:1px solid #6b7280;
  border-radius:8px;
  padding:8px 12px;
  cursor:pointer;
  white-space:nowrap;
}

.admin-layout{
  display:flex;
  min-height:calc(100vh - 68px);
  min-width:0;
}
.sidebar{
  width:250px;
  background:#fff;
  border-right:1px solid #e5e7eb;
  padding:22px 14px;
  flex:0 0 250px;
}
.side-title {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #111827;
  background: #e5e7eb;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 9px 11px;
  margin-bottom: 10px;
}
.nav-item{
  display:block;
  padding:10px 12px;
  margin:3px 0;
  color:#374151;
  text-decoration:none;
  border-radius:8px;
  font-size:14px;
  white-space:nowrap;
}
.nav-item:hover,
.nav-item.active{
  background:#eef2ff;
  color:#111827;
  font-weight:650;
}

.admin-main{
  flex:1 1 auto;
  width:0;
  min-width:0;
  padding:32px;
  max-width:1500px;
}
.page-head{
  display:flex;
  justify-content:space-between;
  gap:24px;
  align-items:flex-start;
  margin-bottom:26px;
  min-width:0;
}
.page-head>div:first-child{
  min-width:0;
}
.eyebrow{
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:#6b7280;
  font-weight:700;
}
h1{
  margin:4px 0 8px;
  font-size:32px;
}
h2{
  margin:0 0 18px;
  font-size:18px;
}
.page-head p{
  margin:0;
  color:#64748b;
  max-width:780px;
}
.role-badge{
  color:#374151;
  background:#fff;
}

.metric-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(170px,1fr));
  gap:14px;
  margin-bottom:18px;
}
.metric{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:12px;
  padding:18px;
  box-shadow:0 1px 2px rgba(15,23,42,.04);
  min-width:0;
}
.metric span{
  display:block;
  color:#64748b;
  font-size:13px;
}
.metric strong{
  display:block;
  font-size:28px;
  margin-top:8px;
}

.panel{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:12px;
  padding:22px;
  margin-bottom:18px;
  box-shadow:0 1px 2px rgba(15,23,42,.04);
  min-width:0;
}
.status-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(120px,1fr));
  gap:10px;
}
.status-grid div{
  border:1px solid #edf0f4;
  border-radius:9px;
  padding:12px;
  min-width:0;
}
.status-grid span{
  display:block;
  font-size:12px;
  color:#64748b;
}
.status-grid strong{
  font-size:20px;
}

.table-wrap{
  width:100%;
  max-width:100%;
  overflow-x:auto;
  overflow-y:hidden;
  -webkit-overflow-scrolling:touch;
}
table{
  width:100%;
  border-collapse:collapse;
  font-size:13px;
}
th,
td{
  text-align:left;
  padding:11px 10px;
  border-bottom:1px solid #edf0f4;
  white-space:nowrap;
}
th{
  color:#64748b;
  font-weight:650;
}
.pill{
  display:inline-block;
  border-radius:999px;
  padding:3px 8px;
  background:#eef2f7;
  white-space:nowrap;
}
.intro-panel{
  color:#475569;
}

.auth{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:24px;
  background:#f5f7fb;
}
.card{
  width:min(440px,100%);
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:14px;
  padding:28px;
  box-shadow:0 12px 30px rgba(15,23,42,.08);
}
.card h1{
  font-size:28px;
}
.card label{
  display:block;
  font-weight:600;
  font-size:14px;
  margin:15px 0;
}
.card input{
  display:block;
  width:100%;
  padding:11px;
  margin-top:7px;
  border:1px solid #cbd5e1;
  border-radius:8px;
}
.button{
  display:inline-block;
  border:0;
  border-radius:8px;
  padding:11px 16px;
  text-decoration:none;
  cursor:pointer;
}
.primary{
  background:#111827;
  color:#fff;
}
.alert{
  padding:10px 12px;
  background:#fff1f2;
  border:1px solid #fecdd3;
  border-radius:8px;
  color:#9f1239;
}
.brand{
  color:#111827;
  text-decoration:none;
  font-weight:750;
}

/* Plataforma / Operaciones */

.platform-panel{
  overflow:hidden;
}
.panel-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  margin-bottom:18px;
  min-width:0;
}
.panel-head>div{
  min-width:0;
}
.panel-head h2{
  margin:0;
}
.panel-subtitle{
  margin:5px 0 0;
  color:#64748b;
  font-size:13px;
}
.live-dot,
.section-status{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.07em;
  color:#64748b;
  white-space:nowrap;
}
.live-dot i{
  display:inline-block;
  width:8px;
  height:8px;
  border-radius:50%;
  background:#16a34a;
  margin-right:6px;
  box-shadow:0 0 0 4px #dcfce7;
}
.gauge-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(170px,1fr));
  gap:18px;
}
.gauge-card{
  border:1px solid #e5e7eb;
  border-radius:14px;
  padding:18px;
  text-align:center;
  background:#fbfcfe;
  min-width:0;
}
.gauge-ring{
  width:126px;
  height:126px;
  border-radius:50%;
  margin:0 auto 13px;
  display:grid;
  place-items:center;
  background:conic-gradient(var(--gauge-color) var(--gauge-deg),#e9edf3 0deg);
  position:relative;
}
.gauge-ring:after{
  content:"";
  position:absolute;
  inset:10px;
  border-radius:50%;
  background:#fff;
}
.gauge-center{
  position:relative;
  z-index:1;
}
.gauge-center strong{
  font-size:25px;
  line-height:1;
}
.gauge-center small{
  display:block;
  font-size:13px;
  color:#64748b;
  margin-top:4px;
}
.gauge-label{
  font-weight:750;
  font-size:14px;
}
.gauge-detail{
  font-size:12px;
  color:#64748b;
  margin-top:4px;
  min-height:36px;
}
.status-ok{--gauge-color:#16a34a}
.status-warning{--gauge-color:#eab308}
.status-critical{--gauge-color:#dc2626}
.status-unknown{--gauge-color:#94a3b8}

.platform-info-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(190px,1fr));
  gap:10px;
  margin-bottom:18px;
}
.platform-info{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:10px;
  padding:12px 14px;
  min-width:0;
}
.platform-info span{
  display:block;
  color:#64748b;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.05em;
}
.platform-info strong{
  display:block;
  margin-top:4px;
  font-size:13px;
  overflow-wrap:anywhere;
}

.colored-status .status-tile{
  border-left:4px solid #cbd5e1;
}
.status-tile{
  background:#fff;
}
.state-pending{
  border-left-color:#eab308!important;
}
.state-running,
.state-claimed,
.state-active,
.state-idle,
.state-busy{
  border-left-color:#16a34a!important;
}
.state-paused{
  border-left-color:#f59e0b!important;
}
.state-failed,
.state-error,
.state-cancelled,
.state-offline{
  border-left-color:#dc2626!important;
}
.state-completed{
  border-left-color:#2563eb!important;
}
.state-waiting{
  border-left-color:#eab308!important;
}
.state-warning{
  border-left:4px solid #eab308!important;
}
.state-critical{
  border-left:4px solid #dc2626!important;
}

.status-pill.status-ok,
.status-pill.status-healthy{
  background:#dcfce7;
  color:#166534;
}
.status-pill.status-warning,
.status-pill.status-degraded{
  background:#fef3c7;
  color:#854d0e;
}
.status-pill.status-critical,
.status-pill.status-error{
  background:#fee2e2;
  color:#991b1b;
}
.status-pill.status-unknown{
  background:#e2e8f0;
  color:#475569;
}

/* Identidad */

.identity-nav-panel{
  margin-bottom:18px;
}

.identity-tabs{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:14px;
  width:100%;
  min-width:0;
}

.identity-tab{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:38px;
  padding:8px 12px;
  border:1px solid #d9dee8;
  border-radius:10px;
  text-decoration:none;
  color:#39445a;
  background:#fff;
  font-weight:600;
  font-size:13px;
  line-height:1.2;
  white-space:nowrap;
  flex:0 1 auto;
  max-width:100%;
}

.identity-tab:hover{
  border-color:#aab5c8;
}

.identity-tab.active{
  background:#172033;
  color:#fff;
  border-color:#172033;
  font-weight:700;
}

code{
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:12px;
}

.detail-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:12px;
  margin-top:18px;
}
.detail-item{
  padding:14px;
  border:1px solid var(--border,#e5e7eb);
  border-radius:12px;
  background:var(--surface-soft,#f8fafc);
  min-width:0;
}
.detail-item span{
  display:block;
  font-size:.78rem;
  color:#64748b;
  margin-bottom:6px;
}
.detail-item strong{
  display:block;
  overflow-wrap:anywhere;
}
.detail-link{
  font-weight:700;
  color:#172033;
  text-decoration:none;
  overflow-wrap:anywhere;
  display:inline-block;
  padding:2px 5px;
  border:1px solid transparent;
  border-radius:5px;
}

.detail-link:visited{
  color:#172033;
}

.detail-link:hover{
  color:#14532d;
  background:#bbf7d0;
  border-color:#86efac;
}

.detail-link:focus{
  color:#172033;
  outline:2px solid #cbd5e1;
  outline-offset:1px;
}

.detail-link:active{
  color:#172033;
}
.subtle{
  color:#64748b;
}
.detail-panel{
  margin-top:16px;
}

/* Responsive principal */

@media(max-width:800px){

  .topbar{
    padding:0 14px;
    gap:10px;
  }

  .topbar-brand{
    gap:9px;
  }

  .topbar-brand a{
    font-size:17px;
  }

  .topbar-brand span{
    font-size:9px;
    padding:4px 7px;
  }

  .topbar-user{
    gap:8px;
  }

  .topbar-user>div{
    display:none;
  }

  .topbar-user button{
    padding:7px 10px;
    font-size:12px;
  }

  .admin-layout{
    display:block;
    min-width:0;
  }

  .sidebar{
    width:100%;
    flex-basis:auto;
    border-right:0;
    border-bottom:1px solid #e5e7eb;
    display:flex;
    gap:4px;
    overflow-x:auto;
    overflow-y:hidden;
    padding:12px 14px;
    -webkit-overflow-scrolling:touch;
  }

  .side-title{
    display:none;
  }

  .nav-item{
    flex:0 0 auto;
    white-space:nowrap;
    margin:0;
  }

  .admin-main{
    width:100%;
    max-width:none;
    padding:20px;
  }

  .page-head{
    display:block;
  }

  .role-badge{
    display:inline-block;
    margin-top:12px;
  }

  .panel{
    padding:18px;
  }

  .panel-head{
    align-items:flex-start;
    flex-direction:column;
  }

  .panel-head .section-status,
  .panel-head .live-dot{
    align-self:flex-start;
  }

  .identity-tabs{
    gap:7px;
  }

  .identity-tab{
    min-height:40px;
    padding:9px 12px;
  }

  .gauge-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .gauge-ring{
    width:108px;
    height:108px;
  }

  .detail-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media(max-width:600px){

  .admin-main{
    padding:14px;
  }

  .panel{
    padding:15px;
    border-radius:10px;
  }

  h1{
    font-size:27px;
  }

  h2{
    font-size:17px;
  }

  .page-head{
    margin-bottom:18px;
  }

  .identity-tabs{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
  }

  .identity-tab{
    width:100%;
    min-width:0;
    white-space:normal;
    text-align:center;
    padding:10px 8px;
  }

  .detail-grid{
    grid-template-columns:1fr;
  }

  .platform-info-grid{
    grid-template-columns:1fr;
  }

  .status-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .metric-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media(max-width:480px){

  .topbar{
    height:62px;
  }

  .admin-layout{
    min-height:calc(100vh - 62px);
  }

  .topbar-brand a{
    font-size:15px;
  }

  .topbar-brand span{
    display:none;
  }

  .topbar-user button{
    font-size:11px;
    padding:7px 9px;
  }

  .admin-main{
    padding:12px;
  }

  .panel{
    padding:14px;
  }

  .identity-tabs{
    grid-template-columns:1fr 1fr;
  }

  .identity-tab{
    font-size:12px;
    min-height:42px;
  }

  .gauge-grid{
    grid-template-columns:1fr;
  }

  .gauge-ring{
    width:126px;
    height:126px;
  }

  .status-grid{
    grid-template-columns:1fr;
  }

  .metric-grid{
    grid-template-columns:1fr;
  }

  .page-head p{
    font-size:14px;
  }
}