/* ═══ Layout: barra superior y menú lateral (layouts/AppLayout.vue) ═══ */

.count {
  flex: none;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: count-pop 0.25s ease-out;
}
@keyframes count-pop {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
}
@media (min-width: 901px) {
  /* menú contraído: solo íconos */
  .sidebar.toggled .count {
    display: none;
  }
}
.shell {
  min-height: 100vh;
  background: var(--bg);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding-right: 14px;
  background: var(--topbar);
  border-bottom: 1px solid var(--border);
}
.brand {
  flex: 0 0 var(--sidebar-w);
  height: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-right: 1px solid var(--border);
}
.logo {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo.img {
  width: auto;
  min-width: 36px;
  max-width: 120px;
  background: transparent;
  overflow: hidden;
}
.logo.img img {
  height: 36px;
  max-width: 120px;
  object-fit: contain;
  border-radius: 8px;
}
.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.brand-text strong {
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 600;
}
.brand-text span {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.spacer {
  flex: 1 1 auto;
  min-width: 0;
}
.square {
  position: relative;
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}
.square:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.square:active {
  filter: brightness(1.15);
}
.search-btn {
  width: auto !important;
  min-width: 40px;
  gap: 8px;
  padding: 0 10px;
  color: var(--muted) !important;
}
.search-btn:hover {
  color: var(--accent) !important;
}
.search-btn span {
  min-width: 150px;
  text-align: left;
  font-size: 13px;
}
.search-btn kbd {
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font: 600 10px/1.4 var(--font);
}
.badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--bad);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  box-shadow: 0 0 0 2px var(--topbar);
}
.badge-enter-active {
  animation: count-pop 0.3s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.theme-box {
  position: relative;
}
/* PC: las opciones van en la barra como siempre */
.extras {
  display: contents;
}
.more-btn {
  display: none !important;
}
.more-btn svg {
  transform: rotate(180deg);
  transition: transform 0.3s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.more-btn.open svg {
  transform: rotate(0deg);
}
.more-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bad);
  box-shadow: 0 0 0 2px var(--topbar);
  animation: count-pop 0.3s ease-out;
}
@media (max-width: 640px) {
  .more-btn {
    display: flex !important;
  }
  .top-actions {
    position: static;
  }
  /* se deslizan desde la derecha y tapan el buscador y los créditos */
  /* sin «transform» en la caja: así el panel de notificaciones (fijo) se ubica bien */
  .extras {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 94px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 6px 0 16px;
    background: linear-gradient(90deg, transparent, var(--topbar) 16px);
    opacity: 0;
    visibility: hidden;
    transition:
      opacity 0.2s ease,
      visibility 0s linear 0.2s;
  }
  .extras.open {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease;
  }
  .extras > * {
    transform: translateX(16px);
    transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.25, 1.15);
  }
  .extras.open > * {
    transform: none;
  }
  .extras.open > :nth-child(2) {
    transition-delay: 0.03s;
  }
  .extras.open > :nth-child(3) {
    transition-delay: 0.06s;
  }
  .extras.open > :nth-child(n + 4) {
    transition-delay: 0.09s;
  }
}
.brand {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.brand:hover .logo {
  filter: brightness(1.08);
}
/* capa oscura detrás de las notificaciones (solo celular) */
.alerts-bd {
  display: none;
}
@media (max-width: 640px) {
  .alerts-bd {
    display: block;
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    z-index: 44;
    background: var(--overlay);
    backdrop-filter: blur(2px);
  }
}
.fade-bd-enter-active,
.fade-bd-leave-active {
  transition: opacity 0.2s ease;
}
.fade-bd-enter-from,
.fade-bd-leave-to {
  opacity: 0;
}
/* hay alertas sin leer: la campana se mueve un poco */
.square.ring svg {
  animation: ring 2.4s ease-in-out infinite;
  transform-origin: 50% 4px;
}
@keyframes ring {
  0%,
  70%,
  100% {
    transform: rotate(0);
  }
  74% {
    transform: rotate(14deg);
  }
  80% {
    transform: rotate(-12deg);
  }
  86% {
    transform: rotate(8deg);
  }
  92% {
    transform: rotate(-4deg);
  }
}
.pal {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--surface);
}
.theme-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 40;
  width: 330px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 20px 50px -14px rgb(0 0 0 / 0.55);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform-origin: top right;
}
.theme-pop > strong {
  font-size: 13px;
}
.pop-enter-active,
.pop-leave-active {
  transition:
    opacity 0.18s ease,
    transform 0.2s cubic-bezier(0.2, 0.9, 0.25, 1.1);
}
.pop-enter-from,
.pop-leave-to {
  opacity: 0;
  transform: translateY(-6px) scale(0.96);
}
@media (max-width: 1200px) {
  .hide-md {
    display: none;
  }
  .search-btn {
    width: 40px !important;
    padding: 0;
  }
}
@media (max-width: 520px) {
  .hide-xs {
    display: none;
  }
}
.credits {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}
.credits span {
  color: var(--muted);
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.square {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.burger {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.layout-body {
  display: flex;
  align-items: flex-start;
}
.sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--side);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition:
    width 0.2s ease,
    flex-basis 0.2s ease;
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 0 8px;
  border: 0;
  border-radius: 10px;
  background: var(--nav-idle);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.nav-btn .ico {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--icon-idle);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-btn.on {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
.nav-btn.on .ico {
  background: var(--icon-on);
}
.nav-btn.has {
  color: var(--accent);
  font-weight: 600;
}
.nav-btn.has .ico {
  background: var(--accent-soft);
}
.grow {
  flex: 1 1 auto;
}
.chev {
  flex: none;
  margin-right: 6px;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.group {
  display: flex;
  flex-direction: column;
}
.subwrap {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition:
    grid-template-rows 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.2s ease;
}
.subwrap.open {
  grid-template-rows: 1fr;
  opacity: 1;
}
.sub {
  min-height: 0;
  overflow: hidden;
}
.sub-inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 6px 0 6px 22px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}
@media (prefers-reduced-motion: reduce) {
  .subwrap {
    transition: none;
  }
}
.sub-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.sub-btn:hover {
  color: var(--text);
}
.sub-btn .dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
}
.sub-btn.on {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.sub-btn.on .dot {
  background: var(--accent);
}
.tag-new {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--bad);
  color: var(--on-pill);
}
.tag-soon {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.version {
  padding: 10px 12px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.logout {
  margin-top: auto;
  justify-content: center;
}
.backdrop {
  display: none;
}
.main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 24px 24px 60px;
  max-width: 1480px;
}
@media (min-width: 901px) {
  .sidebar.toggled {
    flex-basis: 76px;
    width: 76px;
  }
  .sidebar.toggled .lbl,
  .sidebar.toggled .subwrap,
  .sidebar.toggled .chev,
  .sidebar.toggled .version {
    display: none;
  }
  .sidebar.toggled .nav-btn {
    justify-content: center;
  }
}
@keyframes backdrop-in {
  from {
    opacity: 0;
  }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: var(--topbar-h);
    bottom: 0;
    height: auto;
    width: 284px;
    z-index: 25;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .sidebar.toggled {
    transform: none;
  }
  .backdrop.toggled {
    display: block;
    animation: backdrop-in 0.2s ease-out;
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    z-index: 20;
    border: 0;
    background: var(--overlay);
  }
  .brand {
    flex: 0 0 auto;
    border-right: 0;
    padding: 0 12px;
  }
  .brand-text,
  .hide-sm {
    display: none;
  }
  .topbar {
    gap: 6px;
    padding-right: 8px;
  }
  .top-actions {
    gap: 5px;
  }
  .square {
    width: 38px;
    height: 38px;
  }
  .search-btn {
    width: 38px !important;
  }
  .credits {
    height: 38px;
    padding: 0 10px;
  }
  .burger {
    width: 38px;
  }
  .main {
    padding: 18px 14px 60px;
  }
}

/* ═══ Tablas (components/DataTable.vue) ═══ */

.xt {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.xt {
  scroll-margin-top: 76px;
}
.xt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
/* PC: el panel no existe como caja, sus partes van en la barra */
.xt-panel,
.xt-panel-in,
.xt-panel-box {
  display: contents;
}
.xt-fbtn,
.xt-fbtn-head,
.xt-tl {
  display: none;
}
.xt-left {
  order: 0;
  margin-right: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.xt-tools {
  order: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.xt-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.xt-ctrl {
  min-height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
}
.xt-search {
  position: relative;
  display: flex;
  align-items: center;
  color: var(--muted);
}
.xt-search svg {
  position: absolute;
  left: 11px;
}
.xt-search input {
  min-height: 38px;
  width: 260px;
  max-width: 100%;
  padding: 0 12px 0 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
}
.xt-bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
}
.xt-bulk strong {
  color: var(--accent);
  margin-right: 6px;
  font-size: 13px;
}
.xt-clear {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.xt-msg {
  margin: 12px 16px 0;
}
.xt-scroll {
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
}
th,
td {
  text-align: left;
  padding: 12px 14px;
  font-size: 14px;
  white-space: nowrap;
  vertical-align: middle;
}
/* todos los encabezados van centrados; en acciones, también los botones */
th {
  text-align: center;
}
th .xt-sort {
  justify-content: center;
}
td.xt-acts {
  text-align: center;
}
td.xt-acts .xt-actions {
  justify-content: center;
}
thead tr {
  background: var(--thead);
  color: var(--muted);
}
th {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
tbody tr {
  border-top: 1px solid var(--border);
}
tbody tr:hover {
  background: rgba(127, 127, 127, 0.07);
}
tbody tr.sel {
  background: var(--accent-soft);
}
tbody.loading {
  opacity: 0.6;
  transition: opacity 0.2s ease;
}
.xt-right {
  order: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.xt-tool {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    color 0.15s ease;
}
.xt-tool:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
.xt-cols {
  position: relative;
}
.xt-cols-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  min-width: 200px;
  max-height: 320px;
  overflow-y: auto;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 12px 30px rgb(0 0 0 / 0.25);
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: pop-in 0.15s ease-out;
}
.xt-cols-pop strong {
  font-size: 12px;
  color: var(--muted);
  padding: 0 4px 4px;
}
.xt-col {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.xt-col:hover {
  background: var(--surface-2);
}
.spin {
  animation: xt-spin 0.8s linear infinite;
}
@keyframes xt-spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}
.xt-v {
  /* envoltorio del valor: no cambia nada salvo en las tarjetas tipo lista */
  display: contents;
}
.xt-selall,
.xt-tool.xt-view {
  display: none;
}
/* celular, modo tarjetas: cada registro es una tarjeta con «etiqueta: valor» */
@media (max-width: 640px) {
  .xt-tools .xt-tool.xt-view {
    display: flex;
  }
  .xt.cards .xt-scroll {
    overflow: visible;
  }
  .xt.cards table,
  .xt.cards tbody,
  .xt.cards tr,
  .xt.cards td {
    box-sizing: border-box;
  }
  .xt.cards table,
  .xt.cards tbody {
    display: block;
    width: 100%;
  }
  .xt.cards thead {
    display: none;
  }
  .xt.cards tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px 12px;
  }
  /* tarjeta compacta: los datos en dos columnas (etiqueta chica arriba, valor abajo) */
  .xt.cards tbody tr {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 6px 16px -14px rgb(0 0 0 / 0.6);
  }
  .xt.cards tbody tr:hover {
    background: var(--surface);
  }
  .xt.cards tbody tr.sel {
    border-color: var(--accent);
    background: var(--accent-soft);
  }
  .xt.cards td {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 2px;
    min-width: 0;
    padding: 0;
    border: 0;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 13px;
    line-height: 1.3;
  }
  .xt.cards td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  /* lo de adentro no puede ensanchar la tarjeta (textos largos, datos técnicos) */
  .xt.cards td > *,
  .xt.cards td * {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .xt.cards td .pill,
  .xt.cards td .badge {
    padding-top: 2px;
    padding-bottom: 2px;
    font-size: 11px;
  }
  /* el primer dato (usuario, nombre…) ocupa todo el ancho, como título */
  .xt.cards td.xt-check + td,
  .xt.cards tr > td:first-child:not(.xt-check) {
    grid-column: 1 / -1;
    padding-right: 34px;
    font-size: 15px;
    font-weight: 600;
  }
  /* casilla arriba a la derecha */
  .xt.cards td.xt-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: auto;
    padding: 4px;
  }
  .xt.cards td.xt-check::before,
  .xt.cards td.xt-acts::before {
    display: none;
  }
  .xt.cards td.xt-check input {
    width: 20px;
    height: 20px;
  }
  .xt.cards td.xt-acts {
    grid-column: 1 / -1;
    align-items: flex-end;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
  }
  .xt.cards td.xt-acts .xt-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  /* ── variante «lista» (líneas y usuarios): ETIQUETA a la izquierda, valor a la derecha ── */
  .xt.cards.list tbody tr {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 4px 12px 6px;
    border-radius: 12px;
  }
  .xt.cards.list td,
  .xt.cards.list td.xt-check + td,
  .xt.cards.list tr > td:first-child:not(.xt-check) {
    grid-column: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 26px;
    padding: 3px 0;
    padding-right: 0;
    line-height: 1.25;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
    text-align: right;
    font-size: 13px;
    font-weight: 600;
  }
  .xt.cards.list td::before {
    flex-shrink: 0;
    max-width: 48%;
    text-align: left;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    opacity: 0.85;
  }
  .xt.cards.list td > *,
  .xt.cards.list td * {
    text-align: right;
  }
  .xt.cards.list .xt-v {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 2px 8px;
    min-width: 0;
  }
  .xt.cards.list td .pill,
  .xt.cards.list td .badge {
    padding-top: 1px;
    padding-bottom: 1px;
    line-height: 1.3;
  }
  .xt.cards.list td .mono,
  .xt.cards.list td.mono {
    font-weight: 700;
  }
  .xt.cards.list td.muted {
    font-weight: 500;
  }
  /* la casilla como una fila más (arriba) */
  .xt.cards.list td.xt-check {
    position: static;
    width: auto;
    padding: 3px 0;
  }
  .xt.cards.list td.xt-check::before {
    display: block;
  }
  .xt.cards.list td.xt-check input {
    width: 16px;
    height: 16px;
  }
  .xt.cards.list td.xt-acts {
    justify-content: flex-end;
    padding-top: 6px;
    border-bottom: 0;
    border-top: 0;
  }
  .xt.cards.list td.xt-acts::before {
    display: none;
  }
  .xt.cards.list td:last-child,
  .xt.cards.list td:has(+ td.xt-acts) {
    border-bottom: 0;
  }
  /* estado, prueba…: abajo, a la izquierda de las acciones (una sola fila) */
  .xt.cards.list tbody tr {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .xt.cards.list td {
    width: 100%;
  }
  .xt.cards.list td.xt-foot {
    order: 90;
    width: auto;
    min-height: 0;
    padding: 8px 14px 0 0;
    border-bottom: 0;
    /* etiqueta arriba y el valor debajo */
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 3px;
    text-align: left;
  }
  .xt.cards.list td.xt-foot .xt-v {
    justify-content: flex-start;
  }
  .xt.cards.list td.xt-foot::before {
    max-width: none;
    font-size: 9.5px;
  }
  .xt.cards.list td.xt-check {
    width: 100%;
  }
  .xt.cards.list td.xt-acts {
    order: 99;
    width: auto;
    flex: 1 1 auto;
    padding-top: 8px;
  }
  /* con pie (estado, prueba…), la última fila de datos sí lleva su línea para separarlo */
  .xt.cards.list tr:has(td.xt-foot) td:has(+ td.xt-acts):not(.xt-foot) {
    border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  }
  .xt.cards .xt-selall {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px 0;
    font-size: 13px;
    color: var(--muted);
  }
  .xt.cards .xt-selall input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
  }
}
/* celular: el pie (registros y páginas) centrado */
@media (max-width: 640px) {
  .xt-footer {
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }
  .xt-pages {
    justify-content: center;
  }
  /* barra: solo el buscador; filtros, actualizar, exportar y columnas en el menú del filtro */
  .xt-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 12px;
  }
  .xt-right {
    order: -1;
    flex-wrap: nowrap;
  }
  .xt-search {
    flex: 1 1 auto;
    min-width: 0;
  }
  .xt-search input {
    width: 100%;
    min-height: 42px;
    border-radius: 12px;
    font-size: 15px;
  }
  .xt-fbtn {
    display: inline-grid;
    position: relative;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }
  /* el menú se despliega (alto de 0 a su contenido) con un leve rebote */
  .xt-panel {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition:
      grid-template-rows 0.38s cubic-bezier(0.2, 0.9, 0.25, 1),
      opacity 0.25s ease;
  }
  .xt-panel-in {
    display: block;
    min-height: 0;
    overflow: hidden;
  }
  .xt-panel-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    transform: translateY(-10px) scale(0.98);
    transform-origin: top center;
    transition: transform 0.38s cubic-bezier(0.2, 0.9, 0.25, 1);
  }
  .xt-toolbar.open .xt-panel {
    grid-template-rows: 1fr;
    opacity: 1;
  }
  .xt-toolbar.open .xt-panel-box {
    transform: none;
  }
  /* cada opción entra un poquito después de la anterior */
  .xt-panel-box .xt-inline,
  .xt-panel-box .xt-tools {
    opacity: 0;
    transform: translateY(-6px);
    transition:
      opacity 0.25s ease,
      transform 0.3s ease;
  }
  .xt-toolbar.open .xt-panel-box .xt-inline,
  .xt-toolbar.open .xt-panel-box .xt-tools {
    opacity: 1;
    transform: none;
  }
  .xt-toolbar.open .xt-inline:nth-child(2) {
    transition-delay: 0.05s;
  }
  .xt-toolbar.open .xt-inline:nth-child(3) {
    transition-delay: 0.1s;
  }
  .xt-toolbar.open .xt-inline:nth-child(n + 4) {
    transition-delay: 0.14s;
  }
  .xt-toolbar.open .xt-tools {
    transition-delay: 0.16s;
  }
  .xt-left {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .xt-inline {
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    font-size: 12px;
  }
  .xt-inline > span:first-child {
    padding-left: 2px;
  }
  .xt-suffix {
    display: none;
  }
  /* si quedan en número impar, el último ocupa todo el ancho */
  .xt-left > .xt-inline:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  .xt-panel .xt-ctrl,
  .xt-left :slotted(select),
  .xt-left :slotted(input) {
    width: 100%;
    min-height: 38px;
    border-radius: 10px;
    font-size: 14px;
    background: var(--surface);
  }
  .xt-tools {
    display: grid;
    /* actualizar, exportar, ver tarjetas/tabla y columnas: solo íconos, en una fila */
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
  .xt-tools .xt-tool {
    width: 100%;
    height: 38px;
    padding: 0 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 10px;
    background: var(--surface);
  }
  .xt-tl {
    display: none;
  }
  .xt-cols {
    position: static;
  }
  .xt-cols-pop {
    position: static;
    margin-top: 6px;
    max-height: 240px;
    box-shadow: none;
  }
  .xt-cols:has(.xt-cols-pop) {
    grid-column: 1 / -1;
  }
  /* botón de filtro en el encabezado (banner), junto a «agregar» */
  .xt-fbtn-head {
    display: inline-grid;
    place-items: center;
    position: relative;
    flex: 0 0 auto;
    width: 52px;
    min-height: 46px;
    border-radius: 12px;
    border: 0;
    background: var(--surface);
    color: var(--accent);
    box-shadow: 0 6px 16px -8px rgb(0 0 0 / 0.45);
    cursor: pointer;
    transition:
      transform 0.15s ease,
      background 0.15s ease;
  }
  .xt-fbtn-head:active {
    filter: brightness(1.15);
  }
  .xt-fbtn-head svg,
  .xt-fbtn svg {
    transition: transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
  }
  .xt-fbtn-head.on svg,
  .xt-fbtn.on svg {
    transform: rotate(-12deg) scale(1.12);
  }
  .xt-fbtn-head.on,
  .xt-fbtn.on {
    background: var(--accent);
    color: var(--on-accent);
    border-color: var(--accent);
    box-shadow: inset 0 0 0 2px rgb(255 255 255 / 0.35);
  }
}
.xt-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--bad);
  box-shadow: 0 0 0 2px var(--surface);
}
@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}
.xt-check {
  width: 44px;
}
.xt-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.xt-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.xt-sort.on {
  color: var(--accent);
}
.xt-actions {
  display: flex;
  gap: 6px;
}
.xt-empty {
  margin: 0;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
}
.xt-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.xt-pages {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.xt-page {
  min-width: 36px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.xt-page.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.xt-page:disabled {
  color: var(--muted);
  cursor: not-allowed;
}
.xt-dots {
  color: var(--muted);
  padding: 0 4px;
}

/* ═══ Ventanas (components/AppModal.vue) ═══ */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--overlay);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px;
  overflow-y: auto;
  overscroll-behavior: contain; /* el scroll del modal no pasa a la página */
  animation: overlay-in 0.2s ease-out;
}
.modal {
  animation: modal-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.1);
  transform-origin: 50% 30%;
}
.overlay.leaving {
  pointer-events: none;
  animation: overlay-out 0.18s ease-in forwards;
}
.overlay.leaving .modal {
  animation: modal-out 0.18s ease-in forwards;
}
@keyframes overlay-in {
  from {
    opacity: 0;
  }
}
@keyframes overlay-out {
  to {
    opacity: 0;
  }
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
}
@keyframes modal-out {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}
@media (prefers-reduced-motion: reduce) {
  .overlay,
  .modal {
    animation: none;
  }
}
.modal {
  width: 100%;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
}
.modal > header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal > header h2 {
  font-size: 18px;
}
.modal > header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.modal-x {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.modal > .mbody {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.modal > .mbody > * {
  min-width: 0;
  max-width: 100%;
}
@media (max-width: 560px) {
  .overlay {
    padding: 16px 10px;
  }
  .modal > header,
  .modal > .mbody,
  .modal > footer {
    padding-left: 16px;
    padding-right: 16px;
  }
  .modal > footer {
    flex-wrap: wrap;
  }
}
.modal > footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
}

/* ═══ Dashboard (views/DashboardView.vue) ═══ */

.warn-link {
  display: block;
  text-decoration: none;
}
.warn-link:hover {
  filter: brightness(1.12);
}
.row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.row-head h2 {
  margin: 0;
}
.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.list-row:first-of-type {
  margin-top: 10px;
}
.small {
  font-size: 12px;
}
.warn-text {
  color: var(--warn);
  font-weight: 600;
  font-size: 13px;
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin-right: 8px;
  background: var(--muted);
}
.dot.online {
  background: var(--good);
}
.dot.offline {
  background: var(--bad);
}
/* ───── Servidor principal ───── */
.main-srv {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.srv-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.srv-ico {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}
.srv-name {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.srv-name h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.srv-name .mono {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.meter {
  --c: var(--info);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.meter.good {
  --c: var(--good);
}
.meter.warn {
  --c: var(--warn);
}
.meter.bad {
  --c: var(--bad);
}
.m-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
}
.m-top strong {
  color: var(--c);
  font-size: 16px;
}
.track {
  height: 7px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}
.fill {
  height: 100%;
  border-radius: inherit;
  background: var(--c);
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.srv-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.srv-facts div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.srv-facts strong {
  font-size: 18px;
  font-family: var(--font-head);
}
@media (max-width: 900px) {
  .meters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* celular: una sola columna y solo lo principal */
@media (max-width: 640px) {
  .kpis {
    grid-template-columns: minmax(0, 1fr);
  }
  .kpi.extra,
  .card.extra {
    display: none;
  }
  .meters,
  .srv-facts {
    grid-template-columns: minmax(0, 1fr);
  }
  .srv-head .btn {
    display: none;
  }
}
/* cada tarjeta lleva a su pantalla */
.kpi.link {
  color: inherit;
  text-decoration: none;
  transition:
    border-color 0.15s ease,
    transform 0.15s ease;
}
.kpi.link:hover {
  border-color: var(--accent);
}

/* ═══ Avisos (components/ToastHost.vue) ═══ */

/* colores fijos (como el diseño pedido): tarjeta gris oscuro en el modo oscuro y blanca en el claro */
.sn {
  --t-bg: #2a2a2a;
  --t-border: #3b3b3b;
  --t-title: #ffffff;
  --t-text: #a3a3a3;
  --t-x: #a3a3a3;
  --t-x-hover: #ffffff;
  --t-track: rgba(255, 255, 255, 0.08);
  --c-good: #4caf50;
  --c-bad: #f0524f;
  --c-warn: #f5a524;
  --c-info: #3b8cff;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  width: 380px;
  max-width: calc(100vw - 32px);
  /* la caja de los avisos es invisible: solo los avisos mismos reciben toques. Antes la caja
     (84 px de alto, casi todo el ancho en el celular) tapaba los botones de abajo aunque no hubiera
     avisos, y había que tocar dos veces */
  pointer-events: none;
}
[data-theme='light'] .sn {
  --t-bg: #ffffff;
  --t-border: #e6e6e6;
  --t-title: #171717;
  --t-text: #5c5c5c;
  --t-x: #8a8a8a;
  --t-x-hover: #171717;
  --t-track: rgba(0, 0, 0, 0.07);
  --c-good: #2e9b45;
  --c-bad: #d93a37;
  --c-warn: #c27c06;
  --c-info: #1f6fe0;
}
.sn-list {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
  transition: height 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.sn-toast {
  --c: var(--c-good);
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 74px;
  padding: 14px 14px 14px 18px;
  border-radius: 14px;
  background: var(--t-bg);
  border: 1px solid var(--t-border);
  box-shadow:
    0 14px 34px -14px rgb(0 0 0 / 0.55),
    0 4px 10px -6px rgb(0 0 0 / 0.3);
  transform-origin: bottom center;
  transition:
    transform 0.4s cubic-bezier(0.21, 1.02, 0.73, 1),
    opacity 0.3s ease;
  touch-action: pan-y;
  user-select: none;
  cursor: grab;
}
.sn-toast.bad {
  --c: var(--c-bad);
}
.sn-toast.warn {
  --c: var(--c-warn);
}
.sn-toast.info {
  --c: var(--c-info);
}
/* círculo de color que se vacía con el tiempo */
.sn .ring {
  position: relative;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--c);
}
.sn .ring svg.arc {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
/* el ícono, centrado dentro del aro */
.sn .ring > :not(.arc) {
  position: relative;
  display: block;
}
.sn .ring circle {
  fill: none;
  stroke-width: 3.5;
}
.sn .ring .track {
  stroke: var(--t-track);
}
.sn .ring .bar {
  stroke: var(--c);
  stroke-linecap: round;
}
.sn .txt {
  flex: 1;
  min-width: 0;
}
.sn .txt strong {
  display: block;
  color: var(--t-title);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}
.sn .txt p {
  margin: 2px 0 0;
  color: var(--t-text);
  font-size: 13.5px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.sn .x {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--t-x);
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease;
}
.sn .x:hover {
  color: var(--t-x-hover);
  background: var(--t-track);
}
/* entra desde abajo; los que salen se desvanecen */
.sn-enter-from {
  opacity: 0 !important;
  transform: translateY(100%) scale(0.96) !important;
}
@media (max-width: 640px) {
  .sn {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-width: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sn-toast,
  .sn-list {
    transition: opacity 0.2s ease;
  }
}
