html[data-device="mobile"] .topbar,
html[data-device="mobile"] .dock,
html[data-device="mobile"] #taskbar,
html[data-device="mobile"] .mission,
html[data-device="mobile"] .spotlight,
html[data-device="mobile"] .context {
  display: none !important;
}

html[data-device="mobile"] #wm {
  position: fixed !important;
  inset: 0 !important;
  z-index: 22000 !important;
  pointer-events: none !important;
}

html[data-device="mobile"] #wm .window {
  pointer-events: auto !important;
}

html[data-device="mobile"] .window {
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
}

html[data-device="mobile"] .window.hidden,
html[data-device="mobile"] .window:not(.active) {
  display: none !important;
}

html[data-device="mobile"] .window.active {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 23000 !important;
}

html[data-device="mobile"] .window .titlebar {
  display: none !important;
}

html[data-device="mobile"] .window .content {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain;
}

html[data-device="mobile"] .window .content > * {
  min-height: 0;
}

body.cx-mobile-app-open html,
body.cx-mobile-app-open {
  overflow: hidden;
}

.cx-mobile-launcher {
  position: fixed;
  inset: 0;
  z-index: 21000;
  display: grid;
  grid-template-rows: auto 1fr;
  background: transparent;
}

.cx-mobile-launcher.hidden {
  display: none;
}

.cx-mobile-top {
  padding: max(12px, env(safe-area-inset-top)) 12px 12px 12px;
  display: grid;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 20, 34, 0.52);
  backdrop-filter: blur(14px);
}

.cx-mobile-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cx-mobile-title-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cx-mobile-avatar-btn {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  padding: 0;
  display: grid;
  place-items: center;
}

.cx-mobile-avatar-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cx-mobile-title {
  color: #eef3ff;
  font-size: 17px;
  font-weight: 800;
  white-space: nowrap;
}

.cx-mobile-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cx-mobile-search {
  width: min(42vw, 220px);
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #eef3ff;
  outline: none;
  padding: 0 10px;
  font-size: 14px;
}

.cx-mobile-search::placeholder {
  color: rgba(238, 243, 255, 0.5);
}

.cx-mobile-install-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #eef3ff;
  display: grid;
  place-items: center;
  padding: 0;
}

.cx-mobile-install-btn svg {
  width: 18px;
  height: 18px;
}

.cx-mobile-grid {
  padding: 14px 10px calc(16px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 10px;
  align-content: start;
  overflow: auto;
}

.cx-mobile-app-item {
  border: 0;
  background: transparent;
  color: #eef3ff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 0;
}

.cx-mobile-app-item:active {
  transform: scale(0.95);
}

.cx-mobile-app-icon-wrap {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.cx-mobile-app-icon-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cx-mobile-app-label {
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  max-width: 76px;
}

.cx-mobile-empty {
  grid-column: 1 / -1;
  color: rgba(238, 243, 255, 0.68);
  text-align: center;
  padding: 24px;
}

.cx-mobile-app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(56px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 10px 0 10px;
  z-index: 25000;
  display: none;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(10, 14, 24, 0.88);
  backdrop-filter: blur(14px);
}

.cx-mobile-app-header.visible {
  display: flex;
}

.cx-mobile-user-menu {
  position: fixed;
  top: calc(max(12px, env(safe-area-inset-top)) + 48px);
  left: 12px;
  z-index: 26000;
  min-width: 188px;
  background: rgba(16, 22, 34, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.4);
  padding: 6px;
  display: none;
  backdrop-filter: blur(14px);
}

.cx-mobile-user-menu.visible {
  display: block;
}

.cx-mobile-user-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: #eef3ff;
  text-align: left;
  border-radius: 8px;
  padding: 10px 10px;
  font-size: 13px;
  font-weight: 700;
}

.cx-mobile-user-item:active {
  background: rgba(255, 255, 255, 0.1);
}

.cx-mobile-user-item.danger {
  color: #ffb4c1;
}

.cx-mobile-back,
.cx-mobile-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #eef3ff;
  display: grid;
  place-items: center;
}

.cx-mobile-back svg,
.cx-mobile-close svg {
  width: 18px;
  height: 18px;
}

.cx-mobile-app-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cx-mobile-app-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  object-fit: cover;
}

.cx-mobile-app-name {
  color: #eef3ff;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 44vw;
}

html[data-device="mobile"] body.cx-mobile-app-open .window.active.mobile-fullscreen {
  top: calc(56px + env(safe-area-inset-top)) !important;
  height: calc(100vh - 56px - env(safe-area-inset-top)) !important;
}

html[data-device="mobile"] #win-aplicaciones .content,
html[data-device="mobile"] #win-config .content,
html[data-device="mobile"] #win-agenda .content,
html[data-device="mobile"] #win-notas .content,
html[data-device="mobile"] #win-flujos .content,
html[data-device="mobile"] #win-chat-ai .content,
html[data-device="mobile"] #win-mensajes .content {
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 420px) {
  .cx-mobile-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px 8px;
    padding-inline: 8px;
  }
  .cx-mobile-app-icon-wrap {
    width: 56px;
    height: 56px;
    border-radius: 14px;
  }
  .cx-mobile-app-label {
    font-size: 11px;
    max-width: 68px;
  }
}
