/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  /* ── Grupo Jerónimo corporate palette ─────────────────── */
  --bg:         #0f1311;
  --bg2:        #171d19;
  --bg3:        #1e2721;
  --border:     #2a3830;
  --accent:     #8ABAA0;   /* sage green — color primario corporativo */
  --accent2:    #35B5E8;   /* sky blue — secundario */
  --green:      #4AC5BB;   /* teal — online / éxito */
  --red:        #FC5027;   /* orange-red corporativo */
  --yellow:     #F4D25A;   /* amarillo corporativo */
  --text:       #E8EDEA;
  --text2:      #7A9186;
  --radius:     10px;
  --sidebar-w:  220px;
}
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  height: 100vh; overflow: hidden; font-size: 14px;
}

/* ── Login ────────────────────────────────────────────────────────────────── */
#view-login {
  display: flex; align-items: center; justify-content: center;
  height: 100vh;
  background: radial-gradient(ellipse at 50% 0%, #1a2e22 0%, var(--bg) 70%);
}
.login-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; padding: 40px; width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.login-logo .icon { font-size: 28px; }
.login-logo .name { font-size: 18px; font-weight: 800; }
.login-logo .sub  { font-size: 11px; color: var(--text2); }
.login-card h2    { font-size: 20px; margin-bottom: 4px; }
.login-card p     { color: var(--text2); font-size: 13px; margin-bottom: 28px; }
#login-error { color: var(--red); font-size: 13px; margin-top: 10px; text-align: center; min-height: 18px; }

/* ── Shared form elements ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 11px; font-weight: 700; color: var(--text2);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 12px; color: var(--text); font-size: 13px;
  outline: none; transition: border-color .2s; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--accent);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  border: none; cursor: pointer; transition: all .15s;
}
.btn-primary  { background: var(--accent); color: #0f1311; }
.btn-primary:hover  { background: #72AA8C; }
.btn-success  { background: var(--green); color: #0f1311; }
.btn-success:hover  { background: #3AAAA0; }
.btn-danger   { background: var(--red); color: #fff; }
.btn-danger:hover   { background: #d9401c; }
.btn-ghost    { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover    { background: var(--bg3); color: var(--text); }
.btn-sm  { padding: 5px 11px; font-size: 12px; border-radius: 6px; }
.btn-full { width: 100%; justify-content: center; }

.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 7px; border: none; cursor: pointer;
  font-size: 15px; background: transparent; color: var(--text2); transition: all .15s;
}
.btn-icon:hover          { background: var(--bg3); color: var(--text); }
.btn-icon.danger:hover   { background: rgba(252,80,39,.12);   color: var(--red); }
.btn-icon.accent:hover   { background: rgba(138,186,160,.12); color: var(--accent); }
.btn-icon.success:hover  { background: rgba(74,197,187,.12);  color: var(--green); }

/* ── App shell ────────────────────────────────────────────────────────────── */
#view-app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w); background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto;
}
.sb-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px; border-bottom: 1px solid var(--border);
}
.sb-logo .icon { font-size: 22px; }
.sb-logo .txt  { line-height: 1.3; }
.sb-logo .name { font-weight: 800; font-size: 14px; display: block; }
.sb-logo .ver  { font-size: 10px; color: var(--text2); }
.sb-section { padding: 14px 8px 2px; }
.sb-label {
  font-size: 10px; font-weight: 800; color: var(--text2);
  text-transform: uppercase; letter-spacing: .09em;
  padding: 0 8px; margin-bottom: 3px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  color: var(--text2); font-size: 13px; font-weight: 500;
  transition: all .15s; user-select: none;
}
.nav-item:hover  { background: var(--bg3); color: var(--text); }
.nav-item.active { background: rgba(138,186,160,.12); color: var(--accent); }
.nav-item .ni    { font-size: 16px; width: 22px; text-align: center; }
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 800; padding: 1px 6px;
  border-radius: 20px; min-width: 18px; text-align: center;
}
.sb-footer {
  margin-top: auto; padding: 10px 8px;
  border-top: 1px solid var(--border);
}
.user-pill { display: flex; align-items: center; gap: 8px; padding: 8px 8px; border-radius: 8px; }
.user-av {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent2); display: flex; align-items: center;
  justify-content: center; font-size: 11px; font-weight: 800; flex-shrink: 0;
}
.user-name { font-size: 12px; font-weight: 700; }
.user-role { font-size: 11px; color: var(--text2); }
.logout-btn {
  margin-left: auto; background: transparent; border: none;
  color: var(--text2); cursor: pointer; font-size: 16px; padding: 4px;
  border-radius: 6px; transition: color .15s;
}
.logout-btn:hover { color: var(--red); }

/* ── Main ─────────────────────────────────────────────────────────────────── */
#main { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.page { display: none; flex-direction: column; flex: 1; padding-bottom: 30px; }
.page.active { display: flex; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 26px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.page-title    { font-size: 18px; font-weight: 800; }
.page-subtitle { font-size: 12px; color: var(--text2); margin-top: 2px; }
.page-actions  { display: flex; gap: 8px; align-items: center; }
.page-body     { padding: 22px 26px; }

/* ── Stat cards ───────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px; margin-bottom: 22px;
}
.stat-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 18px 14px;
  position: relative; overflow: hidden;
}
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; }
.stat-val  { font-size: 34px; font-weight: 900; line-height: 1; }
.stat-ico  { font-size: 26px; opacity: .18; }
.stat-lbl  { font-size: 11px; font-weight: 700; color: var(--text2);
  text-transform: uppercase; letter-spacing: .06em; margin-top: 8px; }
.stat-bar  { height: 2px; border-radius: 1px; margin-top: 10px; }
.stat-bar.blue   { background: var(--accent); }
.stat-bar.green  { background: var(--green); }
.stat-bar.red    { background: var(--red); }
.stat-bar.yellow { background: var(--yellow); }
.stat-bar.purple { background: var(--accent2); }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.card + .card { margin-top: 14px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 18px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 13px; font-weight: 700; }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; padding: 9px 16px;
  font-size: 11px; font-weight: 700; color: var(--text2);
  text-transform: uppercase; letter-spacing: .07em;
  background: var(--bg3); border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.025); }
tbody td { padding: 9px 16px; font-size: 13px; vertical-align: middle; }
.act { display: flex; gap: 3px; align-items: center; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 700;
}
.badge::before { content:''; width:6px; height:6px; border-radius:50%; }
.b-online  { background:rgba(74,197,187,.12); color:var(--green); }
.b-online::before  { background:var(--green); box-shadow:0 0 0 2px rgba(74,197,187,.25); }
.b-offline { background:rgba(252,80,39,.12); color:var(--red); }
.b-offline::before { background:var(--red); }
.b-neutral { background:rgba(148,163,184,.1); color:var(--text2); }
.b-neutral::before { background:var(--text2); }
.b-blue    { background:rgba(138,186,160,.12); color:var(--accent); }
.b-blue::before { background:var(--accent); }

/* ── Search / filter bar ──────────────────────────────────────────────────── */
.filter-bar { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.search-input {
  background:var(--bg3); border:1px solid var(--border);
  border-radius:8px; padding:7px 12px; color:var(--text); font-size:13px;
  outline:none; width:200px; transition:border-color .2s;
}
.search-input:focus { border-color:var(--accent); }
.filter-select {
  background:var(--bg3); border:1px solid var(--border);
  border-radius:8px; padding:7px 10px; color:var(--text); font-size:13px;
  outline:none; cursor:pointer;
}

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,.65);
  display:flex; align-items:center; justify-content:center;
  z-index:1000; padding:16px;
}
.modal-overlay.hidden { display:none; }
.modal {
  background:var(--bg2); border:1px solid var(--border);
  border-radius:14px; width:100%; max-width:920px;
  max-height:92vh; display:flex; flex-direction:column;
  box-shadow:0 25px 80px rgba(0,0,0,.7);
}
.modal-sm { max-width:460px; }
.modal-md { max-width:600px; }
.modal-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 20px; border-bottom:1px solid var(--border); flex-shrink:0;
}
.modal-title { font-size:15px; font-weight:800; display:flex; align-items:center; gap:9px; }
.modal-close {
  background:transparent; border:none; color:var(--text2);
  font-size:18px; cursor:pointer; padding:4px; border-radius:6px; line-height:1;
}
.modal-close:hover { color:var(--text); }
.modal-body  { flex:1; overflow-y:auto; padding:20px; }
.modal-footer {
  padding:14px 20px; border-top:1px solid var(--border);
  display:flex; justify-content:flex-end; gap:8px; flex-shrink:0;
}

/* ── Tab bar (inside modal) ───────────────────────────────────────────────── */
.tab-bar {
  display:flex; gap:2px; border-bottom:1px solid var(--border);
  padding:0 20px; flex-shrink:0; overflow-x:auto;
}
.tab-btn {
  padding:11px 14px; font-size:13px; font-weight:600; color:var(--text2);
  background:transparent; border:none; cursor:pointer;
  border-bottom:2px solid transparent; margin-bottom:-1px; white-space:nowrap;
  transition:color .15s;
}
.tab-btn:hover  { color:var(--text); }
.tab-btn.active { color:var(--accent); border-bottom-color:var(--accent); }
.tab-panel { display:none; padding-top:16px; }
.tab-panel.active { display:block; }

/* ── Command buttons ──────────────────────────────────────────────────────── */
.cmd-section { margin-bottom:18px; }
.cmd-section-title {
  font-size:10px; font-weight:800; color:var(--text2);
  text-transform:uppercase; letter-spacing:.08em;
  margin-bottom:8px; padding-bottom:5px;
  border-bottom:1px solid var(--border);
}
.cmd-grid { display:flex; flex-wrap:wrap; gap:5px; }
.cmd-btn {
  display:inline-flex; align-items:center; gap:6px;
  padding:5px 11px; border-radius:7px;
  background:var(--bg3); border:1px solid var(--border);
  color:var(--text); font-size:12px; cursor:pointer; transition:all .15s;
  white-space:nowrap;
}
.cmd-btn:hover { background:var(--bg); border-color:var(--accent); color:var(--accent); }
.cmd-btn .ci   { font-size:14px; }
.cmd-btn.red:hover   { border-color:var(--red);    color:var(--red);    }
.cmd-btn.green:hover { border-color:var(--green);  color:var(--green);  }

/* ── Terminal ─────────────────────────────────────────────────────────────── */
.terminal {
  background:#080e0a; border-radius:8px; border:1px solid var(--border);
  display:flex; flex-direction:column; height:340px; font-family:monospace;
}
.term-out {
  flex:1; overflow-y:auto; padding:10px 12px;
  font-size:12px; line-height:1.65; color:#8ABAA0;
}
.term-out .t-cmd  { color:#35B5E8; }
.term-out .t-err  { color:#FC5027; }
.term-out .t-info { color:#6b7280; }
.term-row {
  display:flex; align-items:center;
  border-top:1px solid var(--border); padding:0 12px;
}
.term-ps  { color:var(--accent); font-size:13px; margin-right:6px; }
.term-in  {
  flex:1; background:transparent; border:none; outline:none;
  color:var(--text); font-family:monospace; font-size:13px; padding:9px 0;
}

/* ── Info grid ────────────────────────────────────────────────────────────── */
.info-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.info-grid.cols3 { grid-template-columns:1fr 1fr 1fr; }
.ii { }
.ii label { display:block; font-size:10px; font-weight:700; color:var(--text2);
  text-transform:uppercase; letter-spacing:.05em; margin-bottom:3px; }
.ii span  { font-size:13px; word-break:break-all; }
.ii.full  { grid-column:1/-1; }

/* ── Captures ─────────────────────────────────────────────────────────────── */
.captures-grid {
  display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:8px;
}
.cap-thumb {
  border-radius:8px; overflow:hidden; border:1px solid var(--border);
  cursor:pointer; aspect-ratio:16/10; position:relative; background:var(--bg3);
}
.cap-thumb img { width:100%; height:100%; object-fit:cover; display:block; }
.cap-time {
  position:absolute; bottom:0; left:0; right:0;
  background:rgba(0,0,0,.7); padding:3px 7px; font-size:10px; color:var(--text2);
}

/* ── Map ──────────────────────────────────────────────────────────────────── */
#map { width:100%; height:280px; border-radius:8px; overflow:hidden; background:var(--bg3); }

/* ── Progress bar ─────────────────────────────────────────────────────────── */
.prog { background:var(--bg3); border-radius:4px; height:5px; overflow:hidden; margin-top:4px; }
.prog-fill { height:100%; border-radius:4px; background:var(--accent); }
.prog-fill.warn   { background:var(--yellow); }
.prog-fill.danger { background:var(--red); }

/* ── Assignment ───────────────────────────────────────────────────────────── */
.assign-pill {
  background:var(--bg3); border-radius:10px; padding:12px 14px;
  display:flex; align-items:center; gap:12px; border:1px solid var(--border);
}
.assign-av {
  width:38px; height:38px; border-radius:50%; background:var(--accent2);
  display:flex; align-items:center; justify-content:center;
  font-size:14px; font-weight:800; flex-shrink:0;
}
.assign-name { font-weight:700; font-size:13px; }
.assign-dept { font-size:11px; color:var(--text2); }

/* ── Color dot ────────────────────────────────────────────────────────────── */
.cdot { display:inline-block; width:9px; height:9px; border-radius:50%; margin-right:5px; vertical-align:middle; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
#toasts {
  position:fixed; bottom:22px; right:22px;
  display:flex; flex-direction:column; gap:7px; z-index:9999;
}
.toast {
  background:var(--bg2); border:1px solid var(--border);
  border-radius:10px; padding:11px 16px; font-size:13px;
  display:flex; align-items:center; gap:9px;
  box-shadow:0 8px 24px rgba(0,0,0,.4); min-width:250px;
  animation:toastIn .2s ease;
}
.toast.s { border-left:3px solid var(--green); }
.toast.e { border-left:3px solid var(--red); }
.toast.i { border-left:3px solid var(--accent); }
@keyframes toastIn { from{opacity:0;transform:translateX(16px)} to{opacity:1} }

/* ── Spinner ──────────────────────────────────────────────────────────────── */
.spin {
  width:16px; height:16px; border:2px solid var(--border);
  border-top-color:var(--accent); border-radius:50%;
  animation:rot .6s linear infinite; display:inline-block;
}
@keyframes rot { to{transform:rotate(360deg)} }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty { text-align:center; padding:48px 20px; color:var(--text2); }
.empty .ei { font-size:44px; opacity:.35; margin-bottom:10px; }
.empty p   { font-size:13px; }

/* ── Tooltip ──────────────────────────────────────────────────────────────── */
[data-tip] { position:relative; }
[data-tip]::after {
  content:attr(data-tip); position:absolute; bottom:calc(100% + 5px); left:50%;
  transform:translateX(-50%); background:#1a2820; border:1px solid var(--border);
  color:var(--text); font-size:11px; padding:3px 8px;
  border-radius:5px; white-space:nowrap; pointer-events:none;
  opacity:0; transition:opacity .15s; z-index:100;
}
[data-tip]:hover::after { opacity:1; }

/* ── Scrollbars ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar       { width:5px; height:5px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:3px; }
::-webkit-scrollbar-thumb:hover { background:#3a4c42; }

hr { border:none; border-top:1px solid var(--border); margin:14px 0; }

/* ── Live pulse (online indicator) ───────────────────────────────────────── */
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0   rgba(74,197,187,.6); }
  70%  { box-shadow: 0 0 0 7px rgba(74,197,187,0);  }
  100% { box-shadow: 0 0 0 0   rgba(74,197,187,0);  }
}
.pulse-dot {
  display:inline-block; width:8px; height:8px; border-radius:50%;
  background:var(--green); animation:pulse 2s infinite; vertical-align:middle;
  margin-right:5px; flex-shrink:0;
}

/* ── Skeleton loading ─────────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}
.skel {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg2) 50%, var(--bg3) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 6px;
}

/* ── Command palette ──────────────────────────────────────────────────────── */
#palette-overlay {
  position:fixed; inset:0; z-index:2000;
  background:rgba(0,0,0,.75); backdrop-filter:blur(6px);
  display:flex; align-items:flex-start; justify-content:center;
  padding-top:12vh;
}
#palette-overlay.hidden { display:none; }
.palette-box {
  background:var(--bg2); border:1px solid var(--border);
  border-radius:14px; width:100%; max-width:620px;
  box-shadow:0 30px 80px rgba(0,0,0,.8);
  overflow:hidden;
}
.palette-input-wrap {
  display:flex; align-items:center; gap:10px;
  padding:14px 18px; border-bottom:1px solid var(--border);
}
.palette-icon { font-size:18px; opacity:.5; }
#palette-input {
  flex:1; background:transparent; border:none; outline:none;
  color:var(--text); font-size:16px; font-family:inherit;
}
#palette-input::placeholder { color:var(--text2); }
.palette-hint {
  font-size:11px; color:var(--text2); padding:0 4px;
  background:var(--bg3); border:1px solid var(--border);
  border-radius:5px; white-space:nowrap;
}
.palette-results { max-height:400px; overflow-y:auto; }
.palette-section-label {
  padding:8px 18px 4px; font-size:10px; font-weight:800;
  color:var(--text2); text-transform:uppercase; letter-spacing:.08em;
}
.palette-item {
  display:flex; align-items:center; gap:12px;
  padding:10px 18px; cursor:pointer; transition:background .1s;
  border-left:3px solid transparent;
}
.palette-item:hover, .palette-item.selected {
  background:rgba(138,186,160,.1); border-left-color:var(--accent);
}
.palette-item .pi-icon { font-size:18px; width:24px; text-align:center; flex-shrink:0; }
.palette-item .pi-name { font-size:13px; font-weight:600; }
.palette-item .pi-desc { font-size:11px; color:var(--text2); margin-top:1px; }
.palette-item .pi-kbd  {
  margin-left:auto; font-size:11px; color:var(--text2);
  background:var(--bg3); border:1px solid var(--border);
  border-radius:4px; padding:2px 7px; flex-shrink:0;
}
.palette-footer {
  padding:9px 18px; border-top:1px solid var(--border);
  display:flex; gap:14px; font-size:11px; color:var(--text2);
}
.palette-footer kbd {
  background:var(--bg3); border:1px solid var(--border);
  border-radius:4px; padding:1px 6px; margin:0 2px;
}

/* ── Bulk action bar ──────────────────────────────────────────────────────── */
#bulk-bar {
  position:sticky; top:0; z-index:100;
  background:rgba(138,186,160,.12); border:1px solid rgba(138,186,160,.3);
  border-radius:10px; margin:0 26px 14px;
  padding:10px 16px; display:flex; align-items:center; gap:12px;
  animation:slideDown .2s ease; backdrop-filter:blur(4px);
}
#bulk-bar.hidden { display:none; }
@keyframes slideDown { from{opacity:0;transform:translateY(-8px)} to{opacity:1} }
.bulk-count { font-weight:700; font-size:13px; color:var(--accent); }
.bulk-actions { display:flex; gap:6px; flex-wrap:wrap; }
.bulk-sep { flex:1; }

/* ── Notification panel ───────────────────────────────────────────────────── */
#notif-btn { position:relative; }
#notif-dot {
  position:absolute; top:4px; right:4px; width:8px; height:8px;
  border-radius:50%; background:var(--red); display:none;
  box-shadow:0 0 0 2px var(--bg2);
}
#notif-panel {
  position:fixed; top:0; right:0; bottom:0; width:340px;
  background:var(--bg2); border-left:1px solid var(--border);
  z-index:500; display:flex; flex-direction:column;
  box-shadow:-20px 0 40px rgba(0,0,0,.4);
  transform:translateX(100%); transition:transform .25s ease;
}
#notif-panel.open { transform:translateX(0); }
.notif-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 18px; border-bottom:1px solid var(--border); flex-shrink:0;
}
.notif-title { font-size:14px; font-weight:800; }
.notif-list  { flex:1; overflow-y:auto; padding:8px 0; }
.notif-item  {
  padding:12px 18px; border-bottom:1px solid rgba(255,255,255,.04);
  animation:toastIn .2s ease; cursor:default;
}
.notif-item:hover { background:rgba(255,255,255,.03); }
.notif-item-head { display:flex; align-items:center; gap:8px; margin-bottom:4px; }
.notif-item-icon { font-size:16px; }
.notif-item-title{ font-size:13px; font-weight:700; }
.notif-item-ts   { margin-left:auto; font-size:11px; color:var(--text2); }
.notif-item-body { font-size:12px; color:var(--text2); line-height:1.5;
  font-family:monospace; white-space:pre-wrap; word-break:break-all;
  max-height:80px; overflow:hidden; }
.notif-empty { padding:40px; text-align:center; color:var(--text2); font-size:13px; }

/* ── SSE status indicator ─────────────────────────────────────────────────── */
#sse-indicator {
  display:flex; align-items:center; gap:5px;
  font-size:11px; color:var(--text2); padding:4px 8px;
  margin:8px 10px; border-radius:6px; background:var(--bg3);
}
#sse-dot { width:7px; height:7px; border-radius:50%; background:var(--text2); flex-shrink:0; }
#sse-dot.live { background:var(--green); animation:pulse 2s infinite; }
#sse-dot.err  { background:var(--red); }

/* ── Checkbox selection ───────────────────────────────────────────────────── */
.dev-checkbox {
  width:16px; height:16px; cursor:pointer; accent-color:var(--accent);
}
tbody tr.selected { background:rgba(138,186,160,.06) !important; }

/* ── Smooth page transition ───────────────────────────────────────────────── */
.page { animation:fadeIn .15s ease; }
@keyframes fadeIn { from{opacity:0;transform:translateY(4px)} to{opacity:1;transform:none} }

/* ── Device hero bar ──────────────────────────────────────────────────────── */
#dev-hero {
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 20px; border-bottom:1px solid var(--border);
  background:var(--bg3); gap:16px; flex-wrap:wrap;
}
.dev-hero-metrics {
  display:flex; gap:20px; flex-wrap:wrap; align-items:center;
}
.dev-metric {
  display:flex; flex-direction:column; align-items:center; gap:2px;
  min-width:58px;
}
.dev-metric .dm-val { font-size:20px; font-weight:900; line-height:1; }
.dev-metric .dm-lbl { font-size:10px; color:var(--text2); font-weight:600;
  text-transform:uppercase; letter-spacing:.05em; }
.dev-metric .dm-bar { width:100%; }

.dev-quick-actions { display:flex; gap:5px; align-items:center; flex-wrap:wrap; }
.qa-btn {
  width:36px; height:36px; border-radius:9px; border:1px solid var(--border);
  background:var(--bg2); font-size:17px; cursor:pointer; transition:all .15s;
  display:flex; align-items:center; justify-content:center; position:relative;
}
.qa-btn:hover          { background:var(--bg); border-color:var(--accent); transform:scale(1.08); }
.qa-btn.qa-danger:hover{ background:rgba(252,80,39,.1); border-color:var(--red); }
.qa-sep { width:1px; height:28px; background:var(--border); margin:0 3px; }

/* ── Security cards ───────────────────────────────────────────────────────── */
.sec-card {
  background:var(--bg3); border:1px solid var(--border);
  border-radius:10px; padding:18px; margin-bottom:14px;
}
.sec-card.danger-zone { border-color:rgba(252,80,39,.3); background:rgba(252,80,39,.04); }
.sec-card-head { display:flex; align-items:flex-start; gap:14px; margin-bottom:14px; }
.sec-icon { font-size:26px; flex-shrink:0; margin-top:2px; }
.sec-title { font-size:14px; font-weight:700; margin-bottom:3px; }
.sec-desc  { font-size:12px; color:var(--text2); line-height:1.5; }
.sec-actions { display:flex; gap:8px; flex-wrap:wrap; }

/* ── PIN display ──────────────────────────────────────────────────────────── */
.pin-display {
  font-size:44px; font-weight:900; letter-spacing:.18em;
  font-family:'Cascadia Code','Consolas',monospace;
  background:var(--bg3); border:2px solid var(--accent);
  border-radius:12px; padding:18px 24px; display:inline-block;
  color:var(--accent); user-select:all;
}

/* ── Command result box ───────────────────────────────────────────────────── */
.cmd-result-box {
  margin-bottom:14px;
  border-radius:10px;
  overflow:hidden;
  animation:cr-fadein .3s ease;
}
@keyframes cr-fadein { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:none} }

/* ── KPI Renderer base ────────────────────────────────────────────────────── */
.cr-wrap {
  background:#0d1610;
  border:1px solid rgba(138,186,160,.2);
  border-radius:10px;
  overflow:hidden;
}
.cr-header {
  background:linear-gradient(90deg,#0d2218,#0d1610);
  border-bottom:1px solid rgba(138,186,160,.2);
  padding:10px 16px;
  font-size:13px;
  font-weight:700;
  color:#D8EDE3;
  letter-spacing:.02em;
}
.cr-plain {
  padding:12px 16px;
  font-size:13px;
  color:rgba(255,255,255,.65);
  white-space:pre-wrap;
}
.cr-plain.cr-ok { color:#2ecc71; }
.cr-empty {
  padding:24px;
  text-align:center;
  font-size:13px;
  color:rgba(255,255,255,.3);
}

/* ── Disco ────────────────────────────────────────────────────────────────── */
.cr-disk-list { padding:12px; display:flex; flex-direction:column; gap:10px; }
.cr-disk-card {
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.08);
  border-radius:8px;
  padding:14px 16px;
  display:flex;
  align-items:center;
  gap:14px;
}
.cr-disk-icon { font-size:28px; flex-shrink:0; }
.cr-pct-badge {
  font-size:11px;
  font-weight:700;
  padding:2px 8px;
  border-radius:20px;
  color:#fff;
}

/* ── Sysinfo gauges ───────────────────────────────────────────────────────── */
.cr-sysinfo-top {
  padding:14px 16px 0;
}
.cr-sysinfo-hostname { font-size:16px; font-weight:700; color:#D8EDE3; }
.cr-sysinfo-os       { font-size:11px; color:rgba(216,237,227,.4); margin-top:2px; }
.cr-gauges-row {
  display:flex;
  gap:12px;
  padding:16px;
  flex-wrap:wrap;
}
.cr-gauge-card {
  flex:1;
  min-width:130px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.08);
  border-radius:10px;
  padding:16px 12px;
  text-align:center;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
}
.cr-gauge-ring {
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  width:76px;
  height:76px;
}
.cr-gauge-val {
  position:absolute;
  font-size:16px;
  font-weight:800;
}
.cr-gauge-label { font-size:13px; font-weight:700; color:#D8EDE3; }
.cr-gauge-sub   { font-size:10px; color:rgba(216,237,227,.4); text-align:center; }

/* ── Tabla genérica ───────────────────────────────────────────────────────── */
.cr-table {
  width:100%;
  border-collapse:collapse;
  font-size:12px;
}
.cr-table thead th {
  padding:8px 12px;
  text-align:left;
  font-size:10px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.06em;
  color:rgba(216,237,227,.45);
  border-bottom:1px solid rgba(138,186,160,.12);
  background:#0a1410;
  position:sticky;
  top:0;
}
.cr-table tbody tr { border-bottom:1px solid rgba(138,186,160,.07); }
.cr-table tbody tr:hover { background:rgba(138,186,160,.04); }
.cr-table tbody td { padding:7px 12px; color:#C8DFCF; }

/* ── Buscador software ────────────────────────────────────────────────────── */
.cr-search {
  width:100%;
  background:rgba(138,186,160,.07);
  border:1px solid rgba(138,186,160,.18);
  border-radius:7px;
  padding:8px 12px;
  font-size:13px;
  color:#D8EDE3;
  outline:none;
}
.cr-search:focus { border-color:rgba(138,186,160,.55); }
.cr-search::placeholder { color:rgba(216,237,227,.3); }

/* ── Red ──────────────────────────────────────────────────────────────────── */
.cr-net-grid {
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  padding:14px;
}
.cr-net-card {
  flex:1;
  min-width:180px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.08);
  border-radius:8px;
  padding:14px;
}
.cr-net-row {
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-size:12px;
  margin-top:5px;
  padding-top:5px;
  border-top:1px solid rgba(255,255,255,.06);
}
.cr-net-row span { color:rgba(255,255,255,.4); }
.cr-net-row code {
  font-family:monospace;
  font-size:12px;
  color:#8ABAA0;
  background:rgba(138,186,160,.12);
  padding:2px 6px;
  border-radius:4px;
}

/* ── Wifi rows ────────────────────────────────────────────────────────────── */
.cr-wifi-row {
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 16px;
  border-bottom:1px solid rgba(255,255,255,.05);
}
.cr-wifi-row:last-child { border-bottom:none; }

/* ── Security badge ───────────────────────────────────────────────────────── */
.cr-sec-badge {
  flex:1;
  min-width:140px;
  background:rgba(255,255,255,.04);
  border:1px solid;
  border-radius:10px;
  padding:16px;
  text-align:center;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:4px;
}

/* ── Users ────────────────────────────────────────────────────────────────── */
.cr-user-grid {
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  padding:14px;
}
.cr-user-card {
  min-width:130px;
  background:rgba(255,255,255,.04);
  border:1px solid;
  border-radius:10px;
  padding:14px;
  text-align:center;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:4px;
}
.cr-user-badge {
  font-size:10px;
  font-weight:700;
  padding:2px 8px;
  border-radius:20px;
  margin-top:2px;
}

/* ── USB row ──────────────────────────────────────────────────────────────── */
.cr-usb-row {
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 16px;
  border-bottom:1px solid rgba(255,255,255,.05);
}
.cr-usb-row:last-child { border-bottom:none; }

/* ── Terminal / JSON ─────────────────────────────────────────────────────── */
.cr-terminal {
  background:#060e08;
  color:#8ABAA0;
  font-family:'Cascadia Code','Consolas',monospace;
  font-size:12px;
  padding:14px 16px;
  margin:0;
  white-space:pre-wrap;
  word-break:break-all;
  max-height:300px;
  overflow-y:auto;
}
.cr-json { color:#35B5E8; }

@media(max-width:700px){
  :root{ --sidebar-w:58px; }
  .nav-item span,.sb-logo .txt,.sb-label,.user-name,.user-role{ display:none; }
  .nav-item{ justify-content:center; }
  .sb-logo { justify-content:center; }
  .page-body{ padding:14px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LIVE SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */
.live-toolbar {
  display:flex; align-items:center; gap:8px;
  padding:10px 14px;
  background:#0a100d;
  border-bottom:1px solid var(--border);
  flex-wrap:wrap;
}
.live-status-off  { font-size:12px; font-weight:600; color:rgba(255,255,255,.3); }
.live-status-on   { font-size:12px; font-weight:600; color:#4AC5BB; }
.live-fps         { font-size:11px; color:rgba(255,255,255,.4); background:rgba(255,255,255,.07); padding:2px 8px; border-radius:20px; }
.live-fps-sel     { background:#1a1d19; border:1px solid var(--border); color:#D8EDE3; border-radius:6px; padding:4px 8px; font-size:12px; cursor:pointer; }
.live-container   { background:#000; min-height:300px; display:flex; align-items:center; justify-content:center; position:relative; }
.live-placeholder { text-align:center; color:rgba(255,255,255,.3); font-size:13px; padding:40px; max-width:300px; line-height:1.6; }
.live-img         { width:100%; height:auto; display:block; }
.live-info        { padding:6px 14px; font-size:11px; color:rgba(216,237,227,.35); background:#060e08; border-top:1px solid var(--border); min-height:24px; }

/* ═══════════════════════════════════════════════════════════════════════════
   MENSAJES / CHAT
   ═══════════════════════════════════════════════════════════════════════════ */
.chat-wrap {
  display:flex; flex-direction:column; height:100%; min-height:420px;
}
.chat-active-win {
  display:flex; align-items:center; gap:8px;
  padding:8px 14px;
  background:#0a1410;
  border-bottom:1px solid var(--border);
  flex-shrink:0;
}
.chat-history {
  flex:1; overflow-y:auto; padding:14px; display:flex; flex-direction:column; gap:10px;
  background:#0d1610;
  min-height:200px; max-height:300px;
}
.chat-empty { color:rgba(255,255,255,.25); font-size:13px; text-align:center; margin:auto; }

/* Burbuja enviada (derecha) */
.chat-bubble {
  align-self:flex-end;
  background:linear-gradient(135deg,#1e4d38,#2d7a55);
  color:#E8EDEA;
  border-radius:14px 14px 4px 14px;
  padding:10px 14px;
  max-width:80%;
  font-size:13px;
  line-height:1.5;
  position:relative;
}
.chat-bubble .chat-meta {
  font-size:10px; color:rgba(216,237,227,.5); margin-top:4px; text-align:right;
}
.chat-bubble.notif { background:linear-gradient(135deg,#1a4a6a,#1a7aaa); }
.chat-bubble.error { background:rgba(252,80,39,.25); border:1px solid rgba(252,80,39,.4); }

/* Input area */
.chat-input-area {
  padding:12px 14px;
  background:#0a100d;
  border-top:1px solid var(--border);
  flex-shrink:0;
}
.chat-type-row { display:flex; gap:6px; margin-bottom:8px; }
.chat-type-btn {
  flex:1; padding:5px; border-radius:6px; border:1px solid var(--border);
  background:transparent; color:rgba(255,255,255,.4); font-size:12px; cursor:pointer;
  transition:all .15s;
}
.chat-type-btn.active { background:#1a3028; border-color:#8ABAA0; color:#8ABAA0; font-weight:600; }
.chat-input {
  width:100%; background:rgba(138,186,160,.07); border:1px solid var(--border);
  border-radius:7px; padding:7px 10px; font-size:13px; color:#D8EDE3; outline:none;
}
.chat-input:focus { border-color:#8ABAA0; }
.chat-row { display:flex; gap:8px; align-items:flex-end; }
.chat-textarea {
  flex:1; background:rgba(138,186,160,.07); border:1px solid var(--border);
  border-radius:8px; padding:9px 12px; font-size:13px; color:#D8EDE3; outline:none;
  resize:none; font-family:inherit;
}
.chat-textarea:focus { border-color:#8ABAA0; }
.chat-send-btn {
  width:42px; height:42px; border-radius:10px; background:#2d7a55; border:none;
  color:#fff; font-size:20px; cursor:pointer; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  transition:background .15s;
}
.chat-send-btn:hover { background:#1e5c3e; }
