@import url('https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@75..125,400..800&display=swap');

* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;

  --brand: #0c526a;
  --brand-700: #083d4f;
  --brand-600: #0a4a60;
  --brand-500: #136784;
  --brand-300: #8bb3c0;
  --brand-200: #b6d0da;
  --brand-100: #d6e5ea;
  --brand-50: #ecf3f6;
  --on-brand: #ffffff;

  --bg: #f7f9fb;
  --bg-2: #eef4f7;
  --surface: #ffffff;
  --surface-2: #fbfdfe;
  --surface-3: #f3f8fa;

  --sidebar: #fbfcfd;
  --sidebar-border: #e8eef1;
  --sidebar-text: #33505d;
  --sidebar-title: #0e1c24;
  --sidebar-muted: #93a7b1;
  --sidebar-nav: #4a6672;
  --sidebar-hover: #f1f5f7;
  --sidebar-card: #ffffff;

  --border: #d7e4ea;
  --border-2: #bfd3dc;

  --text: #12202a;
  --text-soft: #5d7280;
  --title: #0e1c24;

  --primary: var(--brand);
  --primary-2: var(--brand-700);
  --primary-soft: var(--brand-50);

  --danger: #dc4c4c;
  --danger-soft: #fff1f1;

  --success: #0f9d71;
  --success-soft: #edf9f4;

  --warning: #d68b13;
  --warning-soft: #fff7e8;

  --shadow-sm: 0 4px 16px rgba(12,82,106,.08);
  --shadow-md: 0 14px 34px rgba(12,82,106,.12);
  --shadow-lg: 0 24px 56px rgba(12,82,106,.16);

  --radius-xs: 10px;
  --radius-sm: 14px;
  --radius-md: 20px;
  --radius-lg: 28px;

  --transition: 0.18s ease;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(12,82,106,.08), transparent 24%),
    linear-gradient(180deg, #f7f9fb 0%, #f3f7f9 100%);
  color: var(--text);
}

body {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  padding: 22px 14px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 8px;
  margin-bottom: 26px;
}

.brand-shield {
  height: 34px;
  width: auto;
  flex: 0 0 auto;
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.brand-wordmark {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .16em;
  color: var(--sidebar-title);
  line-height: 1;
}

.brand-sub {
  font-size: 10.5px;
  color: var(--sidebar-muted);
  letter-spacing: .02em;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--sidebar-nav);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  transition: background-color var(--transition), color var(--transition);
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: var(--brand);
}

.nav-link.active {
  background: var(--brand);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(12,82,106,.28);
}

html[data-theme="dark"] .nav-link.active {
  box-shadow: none;
  background: var(--brand-500);
}

.nav-icon {
  flex: 0 0 auto;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--sidebar-border);
  background: transparent;
  color: var(--sidebar-nav);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background-color var(--transition), color var(--transition);
}

.theme-toggle:hover {
  background: var(--sidebar-hover);
  color: var(--brand);
}

.theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-moon { display: inline; }

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--sidebar-border);
  background: var(--sidebar-card);
}

.user-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--brand-500);
  color: #eaf4f8;
  font-size: 11.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sidebar-title);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--sidebar-muted);
  text-transform: capitalize;
}

.user-logout {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--sidebar-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition), color var(--transition);
}

.user-logout:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.sidebar-copyright {
  text-align: center;
  font-size: 10.5px;
  color: var(--sidebar-muted);
  letter-spacing: .04em;
}

.nav-icon {
  flex: 0 0 auto;
}

.main {
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 24px;
}

.topbar-left h2 {
  margin: 0;
  font-size: 34px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--title);
}

.topbar-left p {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 13px;
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.9);
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  font-weight: 700;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.dot.online {
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(15,157,113,.14);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.toolbar select,
.toolbar input,
.form-grid input,
.form-grid select,
textarea {
  width: 100%;
  min-width: 0;
  background: rgba(255,255,255,.96);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 16px;
  padding: 13px 14px;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}

.toolbar select:focus,
.toolbar input:focus,
.form-grid input:focus,
.form-grid select:focus,
textarea:focus {
  background: #ffffff;
  border-color: var(--brand-300);
  box-shadow: 0 0 0 4px rgba(12,82,106,.12);
}

.grid {
  display: grid;
  gap: 18px;
}

.cards-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cards-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.split {
  display: grid;
  grid-template-columns: minmax(320px, 1.06fr) minmax(320px, 1fr);
  gap: 18px;
}

.card {
  background: linear-gradient(180deg, rgba(255,255,255,.98) 0%, rgba(251,253,254,.98) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-md);
}

.card h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 850;
  letter-spacing: -0.01em;
  color: var(--title);
}

.sub {
  color: var(--text-soft);
  font-size: 12px;
  margin-top: 6px;
  line-height: 1.45;
}

.section-head,
.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.surface-note {
  display: inline-flex;
  align-items: center;
  padding: 8px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: var(--brand-700);
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
}

.metric {
  font-size: 30px;
  line-height: 1;
  font-weight: 900;
  color: var(--brand-700);
  margin-top: 8px;
}

.metric-label,
.mini-label {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.stats-inline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.mini-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  min-height: 96px;
  box-shadow: var(--shadow-sm);
}

.mini-stat strong {
  font-size: 28px;
  line-height: 1;
  color: var(--brand-700);
  font-weight: 900;
}

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

.full {
  grid-column: 1 / -1;
}

label.muted,
.form-label {
  display: block;
  margin-bottom: 7px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.actions,
.row-actions,
.action-icons {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 14px;
  min-height: 42px;
  padding: 11px 16px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition), background-color var(--transition), border-color var(--transition), color var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn.secondary {
  background: #ffffff;
  border-color: var(--border);
  color: var(--brand-700);
}

.btn.primary,
.btn.warning {
  background: linear-gradient(180deg, var(--brand-500) 0%, var(--brand) 100%);
  color: var(--on-brand);
  box-shadow: 0 8px 18px rgba(12,82,106,.18);
}

.btn.primary:hover:not(:disabled),
.btn.warning:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-700) 100%);
}

.btn.success {
  background: linear-gradient(180deg, #14b786 0%, var(--success) 100%);
  color: var(--on-brand);
}

.btn.danger {
  background: linear-gradient(180deg, #eb6666 0%, var(--danger) 100%);
  color: var(--on-brand);
}

.btn.xs {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.btn.xs.delete-record {
  width: auto;
  padding: 0 10px;
}

.btn:disabled,
.btn.is-off {
  opacity: .34;
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

.btn.is-active {
  box-shadow: 0 0 0 4px rgba(12,82,106,.12), var(--shadow-sm);
}

.info-inline {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 10px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.4;
}

.info-inline::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--brand);
  flex: 0 0 auto;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.95);
}

.data-table,
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

thead th {
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  padding: 15px 14px;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 16px 14px;
  border-bottom: 1px solid #edf3f6;
  font-size: 13px;
  vertical-align: middle;
}

tbody tr:hover {
  background: #f8fbfc;
}

tbody tr:last-child td {
  border-bottom: none;
}

.primary-cell strong,
.list-item-title {
  color: var(--title);
  font-size: 13px;
  font-weight: 850;
}

.cell-sub,
.list-item-sub,
.muted,
.empty {
  margin-top: 5px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.45;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
}

.status-badge.free,
.badge.online {
  background: var(--success-soft);
  color: var(--success);
}

.status-badge.free::before {
  background: var(--success);
}

.status-badge.blocked,
.badge.offline {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-badge.blocked::before {
  background: var(--danger);
}

.status-badge.temp {
  background: var(--primary-soft);
  color: var(--primary-2);
}

.status-badge.temp::before {
  background: var(--brand);
}

.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-item {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfe 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 15px;
  box-shadow: var(--shadow-sm);
}

.list-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.clickable {
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.clickable:hover {
  transform: translateY(-1px);
  border-color: var(--brand-200);
  box-shadow: var(--shadow-md);
}

.icon-btn {
  position: relative;
}

.tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  background: var(--brand-700);
  color: #ffffff;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition), visibility var(--transition);
  z-index: 15;
}

.tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: var(--brand-700) transparent transparent transparent;
}

.icon-btn:hover .tooltip,
.icon-btn:focus-within .tooltip {
  opacity: 1;
  visibility: visible;
}

.floating-panel {
  position: absolute;
  width: min(760px, calc(100vw - 32px));
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfe 100%);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 16px;
  box-shadow: var(--shadow-lg);
  z-index: 2500;
}

.floating-panel.hidden,
.hidden {
  display: none !important;
}

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

.floating-panel-head h4 {
  margin: 0;
  color: var(--title);
  font-size: 15px;
  font-weight: 900;
}

.modal-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-soft);
  border-radius: 12px;
  font-size: 18px;
  cursor: pointer;
}

.schedule-modes {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.mode-btn,
.preset-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-soft);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.mode-btn.active,
.preset-btn:hover {
  background: var(--brand-50);
  color: var(--brand-700);
  border-color: var(--brand-100);
}

.quick-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.preset-btn {
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 11px;
}

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

.pager-inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.pager-label {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.auth-page {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(12,82,106,.92), rgba(8,61,79,.88)),
    radial-gradient(circle at top left, rgba(255,255,255,.12), transparent 28%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.page-enter {
  opacity: 0;
  transform: translateY(10px);
}

.page-enter.page-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity .42s ease, transform .42s ease;
}

/* ==== Sidebar logo grande, centrado y sin texto ==== */
/* (El bloque de marca antiguo fue reemplazado por el nuevo diseño Atalaya
   definido más arriba: .brand / .brand-shield / .brand-lockup / .brand-wordmark) */

@media (max-width: 1280px) {
  .cards-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
  }

  .cards-2,
  .split {
    grid-template-columns: 1fr;
  }

  .stats-inline {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .main {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-right,
  .actions,
  .modal-actions,
  .schedule-modes {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .floating-panel {
    left: 12px !important;
    right: 12px;
    width: auto;
  }

  .pager-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .brand {
    margin-bottom: 18px;
  }
}

/* ============================================================
   MODO OSCURO — ATALAYA
   Remapea los tokens de diseño y ajusta los componentes con
   fondos claros para un tema oscuro coherente y elegante.
   ============================================================ */
html[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0b1c29;
  --bg-2: #0a1824;
  --surface: #10293a;
  --surface-2: #122b3c;
  --surface-3: #0e2433;

  --border: #1e3d4f;
  --border-2: #2a5165;

  --text: #e8f1f5;
  --text-soft: #93aab6;
  --title: #f2f8fa;

  --primary-soft: rgba(19,103,132,.20);

  --danger: #f0655f;
  --danger-soft: rgba(220,76,76,.16);
  --success: #34d39c;
  --success-soft: rgba(52,211,156,.15);
  --warning: #e8b04b;
  --warning-soft: rgba(224,161,58,.15);

  --shadow-sm: 0 4px 16px rgba(2,12,20,.40);
  --shadow-md: 0 14px 34px rgba(2,12,20,.48);
  --shadow-lg: 0 26px 64px rgba(2,12,20,.55);

  /* Sidebar oscuro */
  --sidebar: #0e2433;
  --sidebar-border: #1a3546;
  --sidebar-text: #a9c0cb;
  --sidebar-title: #e8f1f5;
  --sidebar-muted: #6f8a97;
  --sidebar-nav: #8aa4b1;
  --sidebar-hover: #12303f;
  --sidebar-card: #122b3c;
}

html[data-theme="dark"] body {
  background: var(--bg);
}

html[data-theme="dark"] .chip {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

html[data-theme="dark"] .toolbar select,
html[data-theme="dark"] .toolbar input,
html[data-theme="dark"] .form-grid input,
html[data-theme="dark"] .form-grid select,
html[data-theme="dark"] #search-box,
html[data-theme="dark"] textarea {
  background: var(--surface-3);
  border-color: var(--border);
  color: var(--text);
}

html[data-theme="dark"] .toolbar select:focus,
html[data-theme="dark"] .toolbar input:focus,
html[data-theme="dark"] .form-grid input:focus,
html[data-theme="dark"] .form-grid select:focus,
html[data-theme="dark"] textarea:focus {
  background: var(--surface-2);
}

html[data-theme="dark"] ::placeholder { color: #5f7c8a; }

html[data-theme="dark"] .card,
html[data-theme="dark"] .list-item,
html[data-theme="dark"] .floating-panel {
  background: var(--surface);
  border-color: var(--border);
}

html[data-theme="dark"] .btn.secondary,
html[data-theme="dark"] .preset-btn,
html[data-theme="dark"] .mode-btn,
html[data-theme="dark"] .icon-btn,
html[data-theme="dark"] .modal-close {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

html[data-theme="dark"] .btn.secondary:hover,
html[data-theme="dark"] .preset-btn:hover,
html[data-theme="dark"] .icon-btn:hover {
  background: var(--surface-3);
}

html[data-theme="dark"] .table-wrap {
  background: var(--surface);
  border-color: var(--border);
}

html[data-theme="dark"] .data-table th {
  color: var(--text-soft);
  border-color: var(--border);
}

html[data-theme="dark"] .data-table td {
  border-color: var(--border);
}

html[data-theme="dark"] .data-table tbody tr:hover {
  background: var(--surface-2);
}

html[data-theme="dark"] .status-badge {
  background: var(--surface-2);
}

html[data-theme="dark"] .mono,
html[data-theme="dark"] code {
  color: #9fd0dd;
}

/* ============================================================
   MONITOREO · Grilla de equipos y visor de control remoto
   ============================================================ */
.monitor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.monitor-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 16px);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.monitor-card.is-online:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-500);
}

.monitor-card.is-offline { opacity: .72; }

.monitor-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.monitor-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--title);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.monitor-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 4px 9px;
  border-radius: 999px;
}

.monitor-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.monitor-badge.on { color: var(--success); background: var(--success-soft); }
.monitor-badge.off { color: var(--text-soft); background: var(--primary-soft); }

.monitor-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-soft);
}

.monitor-preview {
  height: 92px;
  border-radius: 12px;
  background: var(--surface-2, #f1f5f7);
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
}

.monitor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.monitor-actions .btn { width: 100%; justify-content: center; }

/* ---------- Visor ---------- */
.viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(6, 16, 24, .72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.viewer-frame {
  width: min(1180px, 100%);
  height: min(760px, 100%);
  display: flex;
  flex-direction: column;
  background: #0a1824;
  border: 1px solid #17303f;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 40px 90px rgba(0,0,0,.5);
}

.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  background: #0e2333;
  border-bottom: 1px solid #17303f;
  color: #e8f1f5;
}

.viewer-id {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  min-width: 0;
}

.viewer-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #34d39c;
  box-shadow: 0 0 0 4px rgba(52,211,156,.18);
  flex: 0 0 auto;
}

.viewer-mode {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: #9fd0dd;
}

.viewer-mode.is-control { background: rgba(52,211,156,.18); color: #34d39c; }

.viewer-stats {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: #7e97a4;
  font-variant-numeric: tabular-nums;
}

.viewer-actions { display: flex; gap: 8px; }

.viewer-stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    repeating-conic-gradient(#0c1c29 0% 25%, #0a1824 0% 50%) 50% / 26px 26px;
  overflow: hidden;
}

#viewer-canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
  background: #000;
  image-rendering: auto;
}

#viewer-canvas.is-control { cursor: none; }

.viewer-status {
  position: absolute;
  padding: 12px 18px;
  border-radius: 12px;
  background: rgba(10,24,36,.9);
  border: 1px solid #17303f;
  color: #cfe0e8;
  font-size: 13px;
  max-width: 70%;
  text-align: center;
}

@media (max-width: 760px) {
  .viewer-overlay { padding: 0; }
  .viewer-frame { height: 100%; border-radius: 0; }
  .viewer-bar { flex-wrap: wrap; }
  .monitor-actions { grid-template-columns: 1fr; }
}

/* ============================================================
   GENERADOR DE INSTALADORES · Licencia y enrolamiento
   ============================================================ */
.lic-activate { display: flex; align-items: flex-end; gap: 12px; }
.lic-activate .btn { flex: 0 0 auto; }

.lic-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}
.lic-fact { display: flex; flex-direction: column; gap: 3px; }
.lic-fact span { font-size: 11px; color: var(--text-soft); text-transform: uppercase; letter-spacing: .06em; }
.lic-fact strong { font-size: 14px; color: var(--title); }
.lic-fact .ok { color: var(--success); }
.lic-fact .warn { color: var(--warning); }
.lic-exp.warn { color: var(--warning); }

.lic-status-msg { margin-top: 10px; font-size: 12.5px; color: var(--text-soft); }
.lic-status-msg.is-error { color: var(--danger); font-weight: 600; }

.seat-meter {
  background: var(--surface-2, #f6f9fa);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin: 4px 0 18px;
}
.seat-meter-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.seat-meter-head span { font-size: 12.5px; color: var(--text-soft); }
.seat-meter-head strong { font-size: 20px; color: var(--title); font-variant-numeric: tabular-nums; }
.seat-bar { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.seat-bar-fill { height: 100%; background: var(--brand-500); border-radius: 999px; transition: width .4s ease; }
.seat-bar-fill.full { background: var(--warning); }
.seat-note { margin-top: 10px; font-size: 12px; color: var(--text-soft); }

.gen-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}
.gen-action { align-self: end; }
.gen-action .btn { width: 100%; }

.enroll-out {
  margin-top: 16px;
  border: 1px solid var(--brand-500);
  border-radius: 14px;
  padding: 16px;
  background: var(--primary-soft);
}
.enroll-out-head { font-size: 13.5px; font-weight: 700; color: var(--title); margin-bottom: 12px; }
.enroll-once { font-weight: 500; color: var(--text-soft); font-size: 11.5px; }
.enroll-code { display: flex; gap: 10px; align-items: center; }
.enroll-code code {
  flex: 1;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--brand);
  word-break: break-all;
}
.enroll-steps { margin: 14px 0 0; padding-left: 20px; color: var(--text); font-size: 12.5px; line-height: 1.7; }

.btn-sm { padding: 6px 12px; font-size: 12px; }

@media (max-width: 820px) {
  .gen-grid { grid-template-columns: 1fr; }
  .lic-activate { flex-direction: column; align-items: stretch; }
}

/* El atributo hidden debe prevalecer sobre cualquier display de clase. */
[hidden] { display: none !important; }


/* ============================================================
   TEMA ATALAYA · Propuesta 1 (carta topográfica)
   Capa final: redefine tokens y aplana tarjetas anidadas.
   ============================================================ */
:root{
  --brand:#032C58;--brand-700:#021F40;--brand-600:#0B3D73;--brand-500:#028C97;--brand-300:#7CC9CE;--brand-200:#B9DFE2;--brand-100:#DCEFF1;--brand-50:#EEF6F7;--on-brand:#fff;
  --teal:#028C97;--teal-7:#016C75;
  --bg:#EEF2F5;--bg-2:#E6ECF1;--surface:#FFFFFF;--surface-2:#F7F9FB;--surface-3:#F2F5F8;
  --sidebar:#EEF2F5;--sidebar-border:transparent;--sidebar-text:#33465B;--sidebar-title:#0B1C30;--sidebar-muted:#5C6D80;--sidebar-nav:#33465B;--sidebar-hover:#E2E8EE;--sidebar-card:#FFFFFF;
  --border:#E3E9EE;--border-2:#D6DEE6;--text:#16263B;--text-soft:#56677A;--title:#0B1C30;
  --primary:#032C58;--primary-2:#021F40;--primary-soft:#EEF6F7;
  --danger:#B2372A;--danger-soft:#FBE7E3;--success:#13734D;--success-soft:#DCF1E7;--warning:#9A6212;--warning-soft:#FBEFD9;
  --shadow-sm:0 1px 2px rgba(3,44,88,.05),0 6px 18px rgba(3,44,88,.05);--shadow-md:0 1px 2px rgba(3,44,88,.05),0 6px 18px rgba(3,44,88,.05);--shadow-lg:0 2px 6px rgba(3,44,88,.06),0 24px 60px rgba(3,44,88,.14);
  --radius-xs:8px;--radius-sm:10px;--radius-md:12px;--radius-lg:12px;
  --chip-bg:#E5EBF0;--btn2:#E5EBF0;--btn2-hover:#D9E1E8;--field:#FFFFFF;--hover:#F2F5F8;--band1:rgba(2,140,151,.30);--band2:rgba(2,140,151,.17);--band3:rgba(2,140,151,.08);--band-line:#016C75;
}
html[data-theme="dark"]{
  --brand:#2FA9B3;--brand-700:#7CC9CE;--brand-600:#46B9C2;--brand-500:#2FA9B3;--brand-50:#12294A;--brand-100:#17304D;--on-brand:#03192F;
  --bg:#07172A;--bg-2:#061426;--surface:#0D2139;--surface-2:#122842;--surface-3:#0A1C31;
  --sidebar:#07172A;--sidebar-border:transparent;--sidebar-text:#B1C2D3;--sidebar-title:#F2F6FA;--sidebar-muted:#8195AB;--sidebar-nav:#B1C2D3;--sidebar-hover:#0F2238;--sidebar-card:#0D2139;
  --border:#1A3350;--border-2:#24405F;--text:#DCE6F0;--text-soft:#8FA2B7;--title:#F2F6FA;
  --primary:#2FA9B3;--primary-soft:#12294A;
  --danger:#F2866F;--danger-soft:rgba(242,134,111,.14);--success:#52CC93;--success-soft:rgba(82,204,147,.14);--warning:#E0A43A;--warning-soft:rgba(224,164,58,.14);
  --shadow-sm:none;--shadow-md:none;--shadow-lg:0 24px 60px rgba(0,0,0,.45);
  --chip-bg:#122842;--btn2:#17304D;--btn2-hover:#1E3B5D;--field:#0A1C31;--hover:#12294A;--band1:rgba(69,188,197,.34);--band2:rgba(69,188,197,.18);--band3:rgba(69,188,197,.08);--band-line:#62C9D0;
}
html,body{font-family:"Archivo",system-ui,-apple-system,"Segoe UI",sans-serif;background:var(--bg)}
html[data-theme="dark"] body{background:var(--bg)}
body{grid-template-columns:252px minmax(0,1fr);-webkit-font-smoothing:antialiased}
::selection{background:#CDEAEC;color:#0B1C30}
:focus-visible{outline:2px solid var(--teal);outline-offset:2px}
a{text-decoration:none}

/* Barra lateral */
.sidebar{background:var(--sidebar);border-right:0;padding:20px 14px 16px}
.brand{gap:11px;padding:0 6px;margin-bottom:14px}
.brand-shield{height:auto;width:34px}
.brand-wordmark{font-size:16px;font-weight:750;font-stretch:110%;letter-spacing:-.005em}
.brand-sub{font-size:12px;letter-spacing:0}
.nav{gap:1px}
.nav-group{font-size:12px;font-weight:500;color:var(--sidebar-muted);padding:14px 10px 6px}
.nav-group:first-child{padding-top:4px}
.nav-link{padding:7px 10px;border-radius:8px;font-size:13.5px;font-weight:500;color:var(--sidebar-nav)}
.nav-link:hover{background:var(--sidebar-hover);color:var(--sidebar-title)}
.nav-link.active,html[data-theme="dark"] .nav-link.active{background:var(--surface);color:var(--sidebar-title);font-weight:600;box-shadow:0 1px 2px rgba(3,44,88,.06)}
.nav-link.active .nav-icon{color:var(--teal)}
html[data-theme="dark"] .nav-link.active{background:#12294A}
html[data-theme="dark"] .nav-link.active .nav-icon{color:#62C9D0}
.sidebar-footer{gap:6px;padding-top:12px}
.theme-toggle{border:0;padding:8px 10px;border-radius:8px;font-size:13px;font-weight:500}
.user-card{border:0;border-top:1px solid var(--border);border-radius:0;background:transparent;padding:12px 6px 0}
.user-avatar{background:var(--brand);color:var(--on-brand);font-size:12px}
.user-name{font-size:13px}
.user-role{font-size:12px}
.sidebar-copyright{display:none}

/* Encabezado de página */
.main{padding:26px 32px 40px}
.topbar{align-items:flex-end;margin-bottom:20px}
.topbar-left h2{font-size:27px;line-height:1.15;font-weight:750;font-stretch:112%;letter-spacing:-.015em}
.topbar-left p{font-size:14px;margin-top:4px}
.chip,html[data-theme="dark"] .chip{min-height:34px;padding:0 12px;border:0;border-radius:999px;background:var(--chip-bg);box-shadow:none;font-size:13px;font-weight:500;color:var(--text)}

/* Campos */
.toolbar{gap:10px}
.toolbar select,.toolbar input,.form-grid input,.form-grid select,#search-box,textarea,
html[data-theme="dark"] .toolbar select,html[data-theme="dark"] .toolbar input,html[data-theme="dark"] .form-grid input,html[data-theme="dark"] .form-grid select,html[data-theme="dark"] #search-box,html[data-theme="dark"] textarea{
  border:1px solid var(--border-2);border-radius:8px;background:var(--field);box-shadow:none;font-family:inherit;color:var(--text)}
.toolbar select:focus,.toolbar input:focus,.form-grid input:focus,.form-grid select:focus,textarea:focus,
html[data-theme="dark"] .toolbar select:focus,html[data-theme="dark"] .toolbar input:focus,html[data-theme="dark"] .form-grid input:focus,html[data-theme="dark"] .form-grid select:focus,html[data-theme="dark"] textarea:focus{
  border-color:var(--teal);box-shadow:0 0 0 3px rgba(2,140,151,.18);background:var(--field)}
.form-label,.metric-label,.mini-label{text-transform:none;letter-spacing:0;font-weight:500}

/* Superficies: una sola capa, sin tarjetas dentro de tarjetas */
.card,html[data-theme="dark"] .card{background:var(--surface);border:1px solid transparent;border-radius:12px;box-shadow:var(--shadow-sm);padding:18px 20px}
html[data-theme="dark"] .card{border-color:#16304C}
.card h3{font-size:16px;font-weight:700;letter-spacing:-.005em}
.sub{font-size:13px;margin-top:2px}
.section-head,.section-header{margin-bottom:12px}
.card .card,.card .list-item,html[data-theme="dark"] .card .list-item{background:transparent;border:0;border-bottom:1px solid var(--border);border-radius:0;box-shadow:none;padding:12px 0}
.card .table-wrap,html[data-theme="dark"] .card .table-wrap{border:0;border-radius:0;background:transparent}
.cards-5{gap:0;background:var(--surface);border-radius:12px;box-shadow:var(--shadow-sm)}
html[data-theme="dark"] .cards-5{border:1px solid #16304C}
.cards-5>.card,html[data-theme="dark"] .cards-5>.card{border:0;border-left:1px solid var(--border);border-radius:0;box-shadow:none;background:transparent;padding:16px 18px}
.cards-5>.card:first-child{border-left:0}
.metric{font-size:26px;font-weight:700;font-stretch:105%;color:var(--title);letter-spacing:-.01em;font-variant-numeric:tabular-nums;margin-top:4px}
.surface-note{border:0;font-weight:600}
.page-enter{opacity:1;transform:none}

/* Botones: sólidos o tonales, sin bordes gruesos */
.btn{border:0;border-radius:8px;min-height:36px;padding:0 14px;font-size:13px;font-weight:600;box-shadow:none;font-family:inherit;display:inline-flex;align-items:center;justify-content:center;gap:8px}
.btn:hover:not(:disabled){transform:none}
.btn.secondary,html[data-theme="dark"] .btn.secondary{background:var(--btn2);color:var(--text);border:0}
.btn.secondary:hover:not(:disabled),html[data-theme="dark"] .btn.secondary:hover:not(:disabled){background:var(--btn2-hover)}
.btn.primary,.btn.warning{background:var(--brand);color:var(--on-brand);box-shadow:none}
.btn.primary:hover:not(:disabled),.btn.warning:hover:not(:disabled){background:var(--brand-600)}
.btn.success{background:var(--success);color:#fff}
.btn.danger{background:var(--danger);color:#fff}
html[data-theme="dark"] .btn.success,html[data-theme="dark"] .btn.danger{color:#03192F}
.icon-btn,.mode-btn,.preset-btn,.modal-close,html[data-theme="dark"] .icon-btn,html[data-theme="dark"] .mode-btn,html[data-theme="dark"] .preset-btn,html[data-theme="dark"] .modal-close{border:0;background:var(--btn2);color:var(--text);box-shadow:none}

/* Tablas */
.table-wrap{border-radius:10px;border:1px solid var(--border);background:var(--surface)}
thead th,html[data-theme="dark"] .data-table th{background:transparent;color:var(--text-soft);font-size:12.5px;font-weight:500;text-transform:none;letter-spacing:0;padding:10px 12px;border-bottom:1px solid var(--border)}
tbody td,html[data-theme="dark"] .data-table td{padding:11px 12px;border-bottom:1px solid var(--border);font-size:13.5px}
tbody tr:hover,html[data-theme="dark"] .data-table tbody tr:hover{background:var(--hover)}
.primary-cell strong,.list-item-title{font-weight:600}
.mono{font-family:ui-monospace,"SF Mono",Menlo,Consolas,monospace;font-size:12.5px}
html[data-theme="dark"] .mono,html[data-theme="dark"] code{color:#9fd0dd}
.status-badge{padding:4px 10px;font-weight:600}
.floating-panel{border-radius:14px;box-shadow:var(--shadow-lg);border:0}

/* Panel: perfil de actividad */
.k-seg{display:inline-flex;background:var(--chip-bg);border-radius:8px;padding:3px}
.k-seg button{border:0;background:transparent;height:28px;padding:0 10px;border-radius:6px;font:inherit;font-size:12.5px;font-weight:600;color:var(--text-soft);cursor:pointer}
.k-seg button.on{background:var(--surface);color:var(--title);box-shadow:0 1px 2px rgba(0,0,0,.08)}
.profile-chart{position:relative}
.profile-chart svg{display:block;width:100%;height:120px}
.profile-chart .b1{fill:var(--band3)}.profile-chart .b2{fill:var(--band2)}.profile-chart .b3{fill:var(--band1)}
.profile-chart .ln{fill:none;stroke:var(--band-line);stroke-width:1.6;vector-effect:non-scaling-stroke}
.profile-axis{display:flex;justify-content:space-between;font-size:12px;color:var(--text-soft);margin-top:8px}
.summary-dl{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));margin:0;border-top:1px solid var(--border)}
.summary-dl div{padding:12px 0;border-bottom:1px solid var(--border)}
.summary-dl div:nth-child(odd){padding-right:16px}
.summary-dl dt{font-size:12.5px;color:var(--text-soft)}
.summary-dl dd{margin:3px 0 0;font-weight:600;color:var(--title);font-variant-numeric:tabular-nums}
@media (max-width:1100px){.cards-5{grid-template-columns:repeat(3,minmax(0,1fr))}.cards-5>.card:nth-child(4){border-left:0}}
@media (max-width:900px){body{grid-template-columns:1fr}.sidebar{position:relative;height:auto}.cards-5{grid-template-columns:repeat(2,minmax(0,1fr))}.cards-5>.card{border-left:0;border-top:1px solid var(--border)}}
.mini-stat,html[data-theme="dark"] .mini-stat{background:transparent;border:0;border-left:1px solid var(--border);border-radius:0;box-shadow:none;padding:4px 14px}
.mini-stat:first-child{border-left:0;padding-left:0}
.badge{font-weight:600;border-radius:999px}
