/* ===== RESET ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Inter, system-ui, Arial, sans-serif;
  background: linear-gradient(135deg, #f6f7fb, #eef1f7);
  min-height: 100vh;
}

/* ===== AUTH LAYOUT ===== */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 980px;
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  box-shadow: 0 30px 80px rgba(0,0,0,.12);
}

.auth-visual {
  background-size: cover;
  background-position: center;
  min-height: 520px;
  border-radius: 24px 0 0 24px;
}

.auth-content {
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-logo {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 18px;
}

.auth-title {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
  color: #111827;
}

.auth-subtitle {
  color: #6b7280;
  margin-bottom: 28px;
  line-height: 1.5;
}

.divider {
  text-align: center;
  margin: 20px 0;
  color: #9ca3af;
  font-size: 14px;
}

.auth-footer {
  margin-top: 18px;
  text-align: center;
  font-size: 14px;
}

.auth-footer a {
  color: #01245d;
  text-decoration: none;
  font-weight: 600;
}

@media (max-width: 900px) {
  .auth-card { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-content { padding: 32px; }
}

/* ===== BUTTONS ===== */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 20px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: .2s;
}

.btn:hover { background: #f9fafb; }

.btn-primary {
  background: #0b2a5b;
  border: none;
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover { background: #081f45; }

.btn-google {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

.btn-icon {
  width: auto;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
  transition: .2s;
}
.btn-icon:hover { background: #f9fafb; }

/* ===== INPUTS ===== */
.input-group { margin: 14px 0; }

.input {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  font-size: 14px;
}

.input:focus {
  outline: none;
  border-color: #0b2a5b;
  box-shadow: 0 0 0 3px rgba(11,42,91,.08);
}

/* Password helpers */
.pw-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.pw-row .input { flex: 1; }

.pw-hints {
  margin-top: 10px;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
}
.pw-hints ul { margin: 8px 0 0 18px; }
.pw-hints li.ok  { color: #16a34a; }
.pw-hints li.bad { color: #dc2626; }

.pw-meter {
  height: 8px;
  border-radius: 999px;
  background: #e5e7eb;
  margin-top: 10px;
  overflow: hidden;
}
.pw-meter > div {
  height: 100%;
  width: 0%;
  transition: width .2s;
}

/* ===== VERIFY CODE ===== */
.code-inputs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 20px 0 10px;
}

.code-box {
  width: 56px;
  height: 64px;
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  outline: none;
  transition: .15s;
}
.code-box:focus {
  border-color: #0b2a5b;
  box-shadow: 0 0 0 3px rgba(11,42,91,.08);
}

/* ===== ALERTS ===== */
.alert-error {
  background: #fee2e2;
  color: #991b1b;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 14px;
  text-align: center;
  border: 1px solid #fecaca;
}

/* ===== GLOBAL LOADER ===== */
.global-loader {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: .35s ease;
}
.loader-hide { opacity: 0; pointer-events: none; }
.loader-card { text-align: center; }
.loader-logo { font-weight: 800; font-size: 20px; color: #0b2a5b; margin-bottom: 18px; }
.loader-spinner {
  width: 46px;
  height: 46px;
  border: 4px solid #e5e7eb;
  border-top: 4px solid #0b2a5b;
  border-radius: 50%;
  animation: spinFG .8s linear infinite;
  margin: 0 auto 14px;
}
.loader-text { font-size: 13px; color: #6b7280; }
@keyframes spinFG { to { transform: rotate(360deg); } }

/* ===== LOGIN GATE ===== */
.gate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11,42,91,.55);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: .35s ease;
}
.gate-show { opacity: 1; pointer-events: auto; }
.gate-card {
  background: #fff;
  padding: 36px 34px;
  border-radius: 18px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
}
.gate-logo    { font-weight: 800; color: #0b2a5b; margin-bottom: 12px; }
.gate-title   { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.gate-subtitle{ font-size: 14px; color: #6b7280; margin-bottom: 22px; }
.gate-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ═══════════════════════════════════
   SHELL & LAYOUT PRINCIPAL
═══════════════════════════════════ */
:root {
  --navy:      #01245d;
  --navy-dark: #011840;
  --navy-mid:  #0b3a7a;
  --accent:    #2563eb;
  --accent-lt: #dbeafe;
  --surface:   #ffffff;
  --bg:        #f0f4fb;
  --border:    #e2e8f0;
  --text:      #0f172a;
  --muted:     #64748b;
  --sidebar-w: 220px;
  --header-h:  64px;
  --radius:    14px;
  --shadow-sm: 0 2px 8px rgba(1,36,93,.07);
  --shadow-md: 0 8px 28px rgba(1,36,93,.11);
}

html, body {
  height: 100%;
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  grid-template-areas: "sidebar header" "sidebar main";
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  grid-area: sidebar;
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-brand {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -.3px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}

.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.sidebar-section { padding: 20px 12px 8px; }

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
  padding: 0 8px;
  margin-bottom: 6px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(255,255,255,.72);
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.15); color: #fff; font-weight: 600; }
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,.08);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.user-avatar-img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: rgba(255,255,255,.5); }

/* ===== TOPBAR ===== */
.topbar {
  grid-area: header;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-search {
  flex: 1;
  max-width: 380px;
  position: relative;
}

.topbar-search input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.topbar-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.topbar-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.topbar-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color .15s;
}
.topbar-search-clear:hover { color: var(--text); }

.topbar-spacer { flex: 1; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-btn {
  padding: 8px 16px;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: .2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.topbar-btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.topbar-btn-ghost:hover { background: var(--bg); }
.topbar-btn-primary { background: var(--navy); color: #fff; }
.topbar-btn-primary:hover { background: var(--navy-dark); }
.topbar-btn-admin {
  background: #1a2a3a;
  color: #60a5fa;
  border: 1px solid #2563eb;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 8px;
  text-decoration: none;
  transition: .15s;
}
.topbar-btn-admin:hover { background: #2563eb; color: #fff; }

/* Pro activo chip */
.topbar-pro-active {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #01245d, #1d4ed8);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.2);
  white-space: nowrap;
}
.pro-days {
  background: rgba(255,255,255,.2);
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

/* Pro CTA */
.topbar-pro-cta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px 7px 12px;
  border-radius: 20px;
  background: linear-gradient(135deg, #1a1200 0%, #2a1d00 50%, #1a1200 100%);
  border: 1px solid rgba(212,160,23,.35);
  color: #f4c842;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  overflow: hidden;
  transition: border-color .2s, transform .15s, box-shadow .2s;
  margin-right: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.topbar-pro-cta:hover {
  border-color: rgba(212,160,23,.7);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(212,160,23,.18);
}
.topbar-pro-icon {
  display: flex;
  align-items: center;
  animation: proBtnStar 2.4s ease-in-out infinite;
}
@keyframes proBtnStar {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
  50% { transform: scale(1.2) rotate(12deg); opacity: .85; }
}
.topbar-pro-label { position: relative; z-index: 1; }
.topbar-pro-shine {
  position: absolute;
  top: 0; left: -75%;
  width: 50%; height: 100%;
  background: linear-gradient(120deg, transparent 0%, rgba(255,220,80,.18) 50%, transparent 100%);
  transform: skewX(-20deg);
  animation: proBtnShine 3s ease-in-out infinite;
}
@keyframes proBtnShine {
  0%   { left: -75%; opacity: 0; }
  20%  { opacity: 1; }
  50%  { left: 140%; opacity: 0; }
  100% { left: 140%; opacity: 0; }
}

/* ===== MAIN ===== */
.main { grid-area: main; padding: 28px 32px 48px; overflow-y: auto; }

/* ===== HERO BANNER ===== */
.hero-banner {
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-mid) 60%, #1d4ed8 100%);
  border-radius: 20px;
  padding: 32px 36px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
  position: relative;
  overflow: hidden;
}
.hero-banner::before {
  content: '';
  position: absolute;
  right: -60px; top: -60px;
  width: 260px; height: 260px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
}
.hero-banner::after {
  content: '';
  position: absolute;
  right: 60px; bottom: -80px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
}
.hero-text h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.hero-text p  { font-size: 14px; color: rgba(255,255,255,.72); max-width: 340px; line-height: 1.6; }
.hero-cta {
  padding: 10px 22px;
  background: #fff;
  color: var(--navy);
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: .2s;
  z-index: 1;
}
.hero-cta:hover { background: #e8f0ff; }

/* ===== SECTIONS ===== */
.tools-section { margin-bottom: 40px; }
.section-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.section-title  { font-size: 17px; font-weight: 800; color: var(--text); letter-spacing: -.2px; }
.section-badge  { font-size: 11px; background: #f3f4f6; color: #6b7280; padding: 3px 10px; border-radius: 20px; font-weight: 600; }
.apps-count     { font-size: 13px; color: var(--muted); font-weight: 500; }
.section-link   { font-size: 13px; color: var(--accent); text-decoration: none; font-weight: 600; }
.section-link:hover { text-decoration: underline; }
.empty-state {
  color: var(--muted);
  font-size: 14px;
  padding: 32px 0;
  text-align: center;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

/* ===== GRIDS ===== */
.apps-grid-3    { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.apps-grid-4    { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.apps-grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }

/* ═══════════════════════════════════
   APP CARD V2
═══════════════════════════════════ */
.app-card {
  background: #fff;
  border-radius: 14px;
  padding: 20px 18px 16px;
  border: 1px solid #e8edf5;
  border-top: 4px solid #2563eb;
  box-shadow: 0 2px 12px rgba(1,36,93,.07);
  cursor: pointer;
  transition: transform .18s, box-shadow .18s, border-color .15s;
  display: flex;
  flex-direction: column;
}
.app-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 36px rgba(1,36,93,.13);
}
.app-card[data-free="1"] { border-top-color: #2563eb; }
.app-card[data-free="0"] { border-top-color: #e07b00; }

.app-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.app-icon {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: #dbeafe;
  overflow: hidden;
  flex-shrink: 0;
}
.app-card[data-free="0"] .app-icon { background: #fef3c7; }

.app-icon-img   { width: 100%; height: 100%; object-fit: cover; border-radius: 11px; }
.app-icon-emoji { font-size: 24px; line-height: 1; }

.app-rating {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 3px;
}

.app-name {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
  line-height: 1.3;
}

.app-desc {
  font-size: 12.5px;
  color: #64748b;
  line-height: 1.55;
  flex: 1;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-footer { margin-top: auto; }

.app-price {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  letter-spacing: .01em;
  transition: filter .15s, transform .1s;
}
.app-price:hover  { filter: brightness(1.08); }
.app-price:active { transform: scale(.97); }
.app-price.free  { background: #01245d; color: #fff; }
.app-price.owned { background: #15803d; color: #fff; }
.app-price.paid  { background: #e07b00; color: #fff; }

.app-devices { display: none; }

/* ===== BADGES ===== */
.badge-pro {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  padding: 2px 7px;
  border-radius: 20px;
  vertical-align: middle;
  margin-left: 4px;
  letter-spacing: .03em;
}

/* ===== CAT SECTIONS ===== */
.cat-section { display: none; }
.cat-section.visible { display: block; }
#sectionAll { display: block; }

.cat-section-header { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid #f3f4f6; }
.cat-section-icon   { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.cat-section-name   { font-size: 19px; font-weight: 800; color: #111827; }
.cat-section-count  { font-size: 12px; color: #9ca3af; margin-left: auto; }

/* ===== PILLS STICKY ===== */
.cat-hero-bar-wrap {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #f8f9fb;
  padding: 10px 28px 0;
  margin: -24px -28px 32px;
  box-shadow: 0 1px 0 #e5e7eb;
}
.cat-hero-bar { display: flex; overflow-x: auto; gap: 8px; padding: 0 0 10px; scrollbar-width: none; -ms-overflow-style: none; }
.cat-hero-bar::-webkit-scrollbar { display: none; }
.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid #e5e7eb;
  background: #fff;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: 'DM Sans', sans-serif;
  transition: all .15s;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.cat-pill:hover { border-color: #1d4ed8; color: #1d4ed8; background: #eff6ff; }
.cat-pill.active { border-color: #1d4ed8; background: #1d4ed8; color: #fff; box-shadow: 0 2px 8px rgba(29,78,216,.25); }
.cat-pill .pill-count { background: rgba(0,0,0,.1); border-radius: 20px; padding: 1px 6px; font-size: 10px; font-weight: 700; }
.cat-pill.active .pill-count { background: rgba(255,255,255,.25); }

/* ===== SIDEBAR CATS ===== */
.sidebar-cats-wrap {
  max-height: 200px;
  overflow: hidden;
  transition: max-height .3s ease;
}
.sidebar-cats {
  padding: 0 10px 4px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.sidebar-cats::-webkit-scrollbar { display: none; }
.sidebar-cat-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.55);
  cursor: pointer;
  transition: all .15s;
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  text-align: left;
  width: 100%;
}
.sidebar-cat-btn:hover  { background: rgba(255,255,255,.08); color: rgba(255,255,255,.9); }
.sidebar-cat-btn.active { background: rgba(59,130,246,.2); color: #93c5fd; }
.sidebar-cat-icon  { font-size: 14px; flex-shrink: 0; width: 18px; text-align: center; }
.sidebar-cat-count { margin-left: auto; font-size: 10px; font-weight: 700; background: rgba(255,255,255,.1); border-radius: 20px; padding: 1px 6px; color: rgba(255,255,255,.4); }
.sidebar-cat-btn.active .sidebar-cat-count { background: rgba(59,130,246,.3); color: #93c5fd; }

.sidebar-cats-toggle { display: flex; align-items: center; justify-content: space-between; padding: 0 12px 8px; cursor: pointer; user-select: none; }
.sidebar-cats-toggle-label { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.35); }
.sidebar-cats-toggle-arrow { font-size: 10px; color: rgba(255,255,255,.3); transition: transform .25s; }
.sidebar-cats-toggle-arrow.collapsed { transform: rotate(-90deg); }

/* ===== MAIN WITH CATS ===== */
.main-with-cats { padding: 24px 28px 48px; min-height: 0; grid-area: main; overflow-x: hidden; }
.main-content   { display: flex; flex-direction: column; }

/* ===== SCROLL TOP BTN ===== */
.scroll-top-btn {
  position: fixed;
  bottom: 80px; right: 20px;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: #1d4ed8;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(29,78,216,.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 200;
  transform: translateY(8px);
}
.scroll-top-btn.visible { opacity: 1; pointer-events: all; transform: translateY(0); }
.scroll-top-btn:hover   { background: #1d40af; }
@media (min-width: 768px) { .scroll-top-btn { bottom: 28px; right: 28px; } }

/* ===== BANNERS ===== */
.banners-row {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.banner-card {
  min-width: 280px;
  height: 130px;
  border-radius: 14px;
  overflow: hidden;
  display: block;
  background: linear-gradient(135deg, var(--navy) 0%, var(--accent) 100%);
  flex-shrink: 0;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform .2s;
}
.banner-card:hover { transform: scale(1.02); }

/* ===== DESKTOP RESPONSIVE ===== */
@media (max-width: 1100px) { .apps-grid-4 { grid-template-columns: repeat(2, 1fr); } }

@media (min-width: 769px) {
  .bottom-nav          { display: none !important; }
  .mobile-search-bar   { display: none !important; }
  .mobile-menu-btn     { display: none !important; }
  .mobile-drawer       { display: none !important; }
  .mobile-drawer-overlay { display: none !important; }
  .topbar-user-info    { display: none !important; }
}

/* ═══════════════════════════════════
   MOBILE RESPONSIVE
═══════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar { display: none !important; }

  .shell {
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto 1fr !important;
    grid-template-areas: "header" "main" !important;
    min-height: 100vh;
  }

  .topbar {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    gap: 10px;
    height: auto;
    min-height: 60px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 8px rgba(0,0,0,.06);
    grid-column: 1 / -1 !important;
    width: 100% !important;
  }

  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border-radius: 10px;
    background: #f5f7fa;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s;
  }
  .mobile-menu-btn:active { background: #e8ecf2; }
  .mobile-menu-btn svg { display: block; }

  .topbar-search { display: none; }
  .topbar-spacer { flex: 1; }
  .topbar-actions { display: flex !important; align-items: center; gap: 6px; }
  .topbar-btn-ghost { display: none; }
  .topbar-btn-admin { display: none; }
  .topbar-btn-primary { font-size: 12px; padding: 6px 12px; border-radius: 20px; }
  .topbar-pro-cta { padding: 5px 10px 5px 8px; font-size: 11px; margin-right: 0; border-radius: 16px; }
  .topbar-pro-label { font-size: 11px; }
  /* Pro activo compacto en móvil */
  .topbar-pro-active {
    font-size: 11px !important;
    padding: 4px 10px !important;
    gap: 4px !important;
    border-radius: 16px !important;
    white-space: nowrap;
  }
  .topbar-pro-active .pro-days {
    font-size: 10px !important;
    padding: 1px 5px !important;
  }

  /* Ocultar user-info duplicado en móvil — ya se ve en topbar-actions */
  .topbar-user-info { display: none !important; }
  .topbar-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: #01245d;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
  }
  .topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }
  .topbar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a2e;
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #f8f9fc;
    border-bottom: 1px solid #eef0f5;
    position: sticky;
    top: 60px;
    z-index: 99;
  }
  .mobile-search-bar .topbar-search {
    display: flex;
    flex: 1;
    background: #fff;
    border: 1.5px solid #e5e8f0;
    border-radius: 12px;
    padding: 0 14px;
    align-items: center;
    gap: 8px;
    height: 42px;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
  }
  .mobile-search-bar .topbar-search input {
    flex: 1; border: none; background: transparent;
    font-size: 14px; color: #1a1a2e; outline: none;
  }
  .mobile-search-bar .topbar-search input::placeholder { color: #adb5c9; }

  .main { padding: 0 0 90px 0; overflow-x: hidden; }

  .hero-banner { margin: 16px 16px 0; border-radius: 16px; padding: 20px 18px; }
  .hero-banner h2 { font-size: 18px; line-height: 1.3; }
  .hero-banner p  { font-size: 13px; margin-top: 6px; }
  .hero-cta { margin-top: 14px; font-size: 13px; padding: 8px 16px; }

  .tools-section { padding: 20px 16px 0; }
  .section-title { font-size: 16px; }

  .apps-grid-3, .apps-grid-4, .apps-grid-auto {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .app-card  { padding: 12px; border-radius: 14px; height: 100%; display: flex; flex-direction: column; }
  .app-icon  { width: 40px; height: 40px; font-size: 18px; border-radius: 10px; }
  .app-name  { font-size: 12px; margin-bottom: 4px; }
  .app-desc  { font-size: 11px; -webkit-line-clamp: 2; margin-bottom: 10px; }
  .app-price { font-size: 11px; padding: 8px 10px; }
  .app-rating { font-size: 10px; }
  .app-card-header { margin-bottom: 8px; }
  /* Grids uniforme */
  .apps-grid-3, .apps-grid-4, .apps-grid-auto {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
    align-items: stretch !important;
  }

  .main-with-cats { padding: 16px 16px 48px; }
  .hero-banner { flex-direction: column; align-items: flex-start; }
  .hero-cta { width: 100%; text-align: center; }

  /* Bottom Nav */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 200;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid #eef0f5;
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0,0,0,.06);
  }
  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #9aa3b8;
    font-size: 10px;
    font-weight: 500;
    padding: 4px 0;
    border: none;
    background: none;
    cursor: pointer;
    transition: color .15s, transform .15s;
    position: relative;
  }
  .bottom-nav-item.active { color: #01245d; }
  .bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: -8px; left: 50%;
    transform: translateX(-50%);
    width: 28px; height: 3px;
    background: #01245d;
    border-radius: 0 0 3px 3px;
  }
  .bottom-nav-item svg { width: 22px; height: 22px; transition: transform .15s; }
  .bottom-nav-item.active svg { transform: scale(1.1); }
  .bottom-nav-item:active { transform: scale(.93); }

  /* Drawer */
  .mobile-drawer-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 300;
    opacity: 0;
    transition: opacity .25s;
  }
  .mobile-drawer-overlay.open { display: block; opacity: 1; }

  .mobile-drawer {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 280px;
    background: #01245d;
    z-index: 301;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }
  .mobile-drawer.open { transform: translateX(0); }

  .mobile-drawer .drawer-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 24px 20px 20px;
    font-size: 18px; font-weight: 800; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.1);
  }
  .mobile-drawer .drawer-section-label {
    font-size: 10px; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase;
    color: rgba(255,255,255,.4);
    padding: 16px 20px 6px;
  }
  .mobile-drawer .drawer-nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 20px;
    color: rgba(255,255,255,.75);
    font-size: 14px; font-weight: 500;
    text-decoration: none;
    transition: background .15s, color .15s;
  }
  .mobile-drawer .drawer-nav-item:hover,
  .mobile-drawer .drawer-nav-item:active {
    background: rgba(255,255,255,.08); color: #fff;
  }
  .mobile-drawer .drawer-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.1);
  }
}

/* ═══════════════════════════════════
   MAIN-WITH-CATS RESPONSIVE FIX
═══════════════════════════════════ */
.main-with-cats {
  padding: 24px 28px 48px;
  min-height: 0;
  grid-area: main;
  overflow-x: hidden;
  width: 100%;
}

@media (max-width: 768px) {
  .main-with-cats {
    padding: 0 0 80px 0;
    grid-area: main;
    grid-column: 1 / -1 !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden;
  }

  /* Pills en móvil */
  .cat-hero-bar-wrap {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #f8f9fb;
    padding: 8px 12px 0;
    margin: 0 0 16px 0;
    box-shadow: 0 1px 0 #e5e7eb;
  }

  /* Hero banner en móvil dentro de main-with-cats */
  .main-with-cats .hero-banner {
    margin: 16px 12px 0;
    border-radius: 14px;
    padding: 18px 16px;
    flex-direction: column;
    align-items: flex-start;
  }
  .main-with-cats .hero-banner h2 { font-size: 16px; }
  .main-with-cats .hero-banner p  { font-size: 12px; }
  .main-with-cats .hero-cta { width: 100%; text-align: center; margin-top: 12px; font-size: 13px; }

  /* Secciones dentro de main-with-cats */
  .main-with-cats .tools-section {
    padding: 16px 12px 0;
    margin-bottom: 24px;
  }

  /* Grids en móvil */
  .main-with-cats .apps-grid-3,
  .main-with-cats .apps-grid-4,
  .main-with-cats .apps-grid-auto {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 0 12px;
  }

  /* Sección header */
  .main-with-cats .section-header {
    padding: 0 12px;
  }

  /* Cat section header */
  .main-with-cats .cat-section-header {
    padding: 0 12px 14px;
    margin: 16px 0 12px;
  }
  .main-with-cats .active-summary,
  .main-with-cats [style*="margin-bottom:28px"] {
    padding: 0 12px;
  }
}