* { margin: 0; padding: 0; box-sizing: border-box; }
a, button, input, select, textarea, .btn, .stat-clickable, .sidebar-item, .mobile-nav-item { touch-action: manipulation; }

:root, [data-theme="dark"] {
  --bg: #0A0E1A;
  --bg-card: #111827;
  --bg-input: #1a2236;
  --accent: #273569;
  --accent-hover: #3a4f8a;
  --accent-light: rgba(39, 53, 105, 0.15);
  --yellow: #ffffff;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --danger: #f85149;
  --warning: #d29922;
  --success: #3fb950;
  --info: #58a6ff;
  --header-bg: #0d1322;
  --header-fg: #ffffff;
  --border: #1e2d45;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
}

[data-theme="light"] {
  --bg: #f0f2f5;
  --bg-card: #ffffff;
  --bg-input: #f0f2f5;
  --accent-light: rgba(39, 53, 105, 0.06);
  --text: #1a1a2e;
  --text-dim: #5f6672;
  --danger: #d32f2f;
  --warning: #e68a00;
  --success: #2e7d32;
  --info: #1565c0;
  --header-bg: #273569;
  --header-fg: #ffffff;
  --border: #d8dee4;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
}

[data-theme="light"] .game-card-account { border-color: #d8dee4; background: #f5f7fa; }
[data-theme="light"] .login-wrapper { background: linear-gradient(135deg, #e8ecf4 0%, #f0f2f5 50%, #ffffff 100%); }
[data-theme="light"] .login-card h2 { color: #1a1a2e; }
[data-theme="light"] .header h1 span { color: #ffffff; }
[data-theme="light"] .sidebar { background: #ffffff; border-color: #d8dee4; }
[data-theme="light"] .sidebar-item { color: #444; }
[data-theme="light"] .sidebar-item:hover { background: #f0f2f5; color: #1a1a2e; }
[data-theme="light"] .sidebar-item.active { background: var(--accent); color: #fff; }
[data-theme="light"] .sidebar-link { color: #555; }
[data-theme="light"] .sidebar-link:hover { background: #f0f2f5; color: var(--accent); }
[data-theme="light"] .sidebar-logo h2 { color: #1a1a2e; }
[data-theme="light"] .stock-card { background: #fff; border-color: #d8dee4; }
[data-theme="light"] .mobile-nav { background: #fff; border-color: #d8dee4; }
[data-theme="light"] .mobile-nav-item { background: #f5f7fa; color: #333; }
[data-theme="light"] .mobile-nav-item:hover { background: #e8ecf4; }
[data-theme="light"] .modal { background: #fff; border-color: #d8dee4; }
[data-theme="light"] .modal-header { border-color: #d8dee4; color: #1a1a2e; }
[data-theme="light"] .modal-footer { border-color: #d8dee4; }
[data-theme="light"] .form-control { background: #fff; border-color: #d0d5dd; color: #1a1a2e; }
[data-theme="light"] .form-control:focus { border-color: var(--accent); }
[data-theme="light"] .form-label { color: #555; }
[data-theme="light"] .page-title { color: #1a1a2e; }
[data-theme="light"] .card-header { color: #1a1a2e; border-color: #d8dee4; }
[data-theme="light"] .stat-number { color: inherit; }
[data-theme="light"] .badge-delivered { background: rgba(46,125,50,0.1); color: #2e7d32; }
[data-theme="light"] .badge-pending { background: rgba(230,138,0,0.1); color: #e68a00; }
[data-theme="light"] .badge-primary { background: rgba(21,101,192,0.1); color: #1565c0; }
[data-theme="light"] .badge-code { background: rgba(230,138,0,0.1); color: #b37400; }
[data-theme="light"] .btn-secondary { background: #f5f7fa; color: #333; border-color: #d0d5dd; }
[data-theme="light"] .btn-ghost { background: transparent; color: #fff; }
[data-theme="light"] .autocomplete-dropdown { background: #fff; border-color: #d8dee4; box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
[data-theme="light"] .autocomplete-item:hover { background: #f0f2f5; }
[data-theme="light"] .autocomplete-item .ac-name { color: #1a1a2e; }
[data-theme="light"] #global-results { background: #fff; border-color: #d8dee4; box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
[data-theme="light"] .toast { background: var(--accent); }
[data-theme="light"] table th { background: #f5f7fa; color: #555; border-color: #d8dee4; }
[data-theme="light"] table td { border-color: #e8ecf4; color: #333; }
[data-theme="light"] tr:hover td { background: #f5f7fa; }
[data-theme="light"] .support-bar { background: #fff; border-color: #d8dee4; }
[data-theme="light"] .catalog-footer { background: #fff; border-color: #d8dee4; }
[data-theme="light"] .video-item { background: #fff; border-color: #d8dee4; }
[data-theme="light"] .video-item-label { background: #f5f7fa; border-color: #d8dee4; color: var(--accent); }
[data-theme="light"] #chat-window { background: #fff; border-color: #d8dee4; box-shadow: 0 8px 32px rgba(0,0,0,0.15); }
[data-theme="light"] #chat-messages div[style*="background:var(--bg-input)"] { background: #f0f2f5 !important; color: #333 !important; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  transition: background-color 0.3s, color 0.3s;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeSpeed;
}

/* Smooth transitions - solo los elementos interactivos */
.btn, .sidebar-item, .stat-clickable, .game-card, .cat-card {
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}
.card, .stock-card, .modal { transition: border-color 0.2s; }

/* Reducir animaciones si el usuario prefiere */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Page fade in */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.admin-content > div[style*="display: block"],
.admin-content > div[style*="display:block"],
#page-stock,
#hero-section,
#results-section[style*="display: block"],
#results-section[style*="display:block"] {
  animation: fadeIn 0.25s ease-out;
}

/* Skeleton loading */
@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 0px, var(--border) 40px, var(--bg-input) 80px);
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
.skeleton-text { height: 14px; margin-bottom: 8px; width: 80%; }
.skeleton-title { height: 20px; margin-bottom: 10px; width: 60%; }
.skeleton-img { height: 150px; width: 100%; }
.skeleton-card { padding: 16px; }

/* Modal animation */
.modal-overlay.active .modal {
  animation: modalIn 0.2s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Game card hover - GPU accelerated */
.game-card { transform: translateZ(0); }
.game-card:hover { transform: translateY(-2px); }

/* Button press */
.btn:active { transform: scale(0.96); }

/* Stock card tap */
.stock-card { transition: border-color 0.2s, box-shadow 0.2s; }
.stock-card:active { border-color: var(--info); }

/* Header */
.header {
  background: var(--header-bg);
  color: var(--header-fg);
  padding: 0 24px;
  height: 56px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

.header h1 { font-size: 18px; font-weight: 700; }
.header h1 span { color: #ffffff; }
.header-actions { display: flex; gap: 8px; align-items: center; }

/* Buttons */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary { background: var(--bg-input); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent-hover); color: var(--info); }

.btn-danger { background: rgba(248,81,73,0.1); color: var(--danger); border: 1px solid rgba(248,81,73,0.3); }
.btn-danger:hover { background: rgba(248,81,73,0.2); }

.btn-success { background: rgba(63,185,80,0.1); color: var(--success); border: 1px solid rgba(63,185,80,0.3); }
.btn-success:hover { background: rgba(63,185,80,0.2); }

.btn-info { background: rgba(88,166,255,0.1); color: var(--info); border: 1px solid rgba(88,166,255,0.3); }
.btn-info:hover { background: rgba(88,166,255,0.2); }

.btn-ghost { background: transparent; color: var(--header-fg); border: 1px solid rgba(255,255,255,0.15); }
.btn-ghost:hover { background: rgba(255,255,255,0.08); }

.btn-sm, .btn-small { padding: 6px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

.btn-whatsapp { background: #25D366; color: #fff; }
.btn-whatsapp:hover { background: #1fba59; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

.page-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-body { padding: 20px; }
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Forms */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--info);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* Login */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(135deg, #0A0E1A 0%, #111827 50%, #1a2236 100%);
}
.login-card { width: 100%; max-width: 380px; }
.login-card .card-body { padding: 32px; }
.login-card h2 { text-align: center; margin-bottom: 4px; font-size: 22px; color: #fff; }
.login-card h2 span { color: var(--info); }
.login-card .subtitle { text-align: center; color: var(--text-dim); margin-bottom: 24px; font-size: 13px; }
.login-error {
  background: rgba(248,81,73,0.1);
  border: 1px solid rgba(248,81,73,0.3);
  color: var(--danger);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.stat-number { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 11px; color: var(--text-dim); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-clickable { transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s; }
.stat-clickable:hover { border-color: var(--info); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.stat-clickable:active { transform: scale(0.97); }

/* Filters bar */
.filters-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.filters-bar .form-control { width: auto; min-width: 180px; padding: 7px 12px; font-size: 13px; }
.filter-chip {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-dim);
  transition: all 0.15s;
}
.filter-chip:hover { border-color: var(--accent); color: var(--info); }
.filter-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Table */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
td {
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:hover td { background: var(--accent-light); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.badge-pending { background: rgba(210,153,34,0.15); color: var(--warning); }
.badge-delivered { background: rgba(63,185,80,0.15); color: var(--success); }
.badge-primary { background: rgba(88,166,255,0.15); color: var(--info); }
.badge-secondary { background: rgba(139,148,158,0.15); color: var(--text-dim); }
.badge-info { background: rgba(88,166,255,0.15); color: var(--info); }
.badge-code { background: rgba(210,153,34,0.15); color: var(--warning); }
.badge-ps3 { background: rgba(139,148,158,0.15); color: var(--text-dim); }

/* Actions cell */
.actions-cell { display: flex; gap: 4px; flex-wrap: wrap; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: flex-start;
  padding: 60px 20px;
  z-index: 200;
  overflow-y: auto;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 20px; color: var(--text-dim); padding: 4px;
}
.modal-close:hover { color: var(--text); }

/* Client Portal */
.client-hero {
  text-align: center;
  padding: 60px 24px 40px;
}
.client-hero h2 { font-size: 28px; margin-bottom: 10px; }
.client-hero h2 span { color: var(--info); }
.client-hero p { color: var(--text-dim); margin-bottom: 28px; font-size: 15px; }
.email-form { display: flex; gap: 10px; max-width: 460px; margin: 0 auto; }
.email-form .form-control { flex: 1; padding: 12px 16px; font-size: 15px; }

/* Game Cards */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  padding: 0 24px 32px;
  max-width: 1100px;
  margin: 0 auto;
}
.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}
.game-card:hover { box-shadow: var(--shadow-md); border-color: var(--info); }
.game-card-image { width: 100%; height: 170px; object-fit: cover; background: var(--bg-input); }
.game-card-body { padding: 16px; }
.game-card-title { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.game-card-meta { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.game-card-account {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 10px;
}
.game-card-account .label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.game-card-account .value { font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; word-break: break-all; }
.password-toggle, .copy-btn { background: none; border: none; color: var(--info); cursor: pointer; font-size: 12px; font-weight: 600; padding: 2px 6px; }
.copy-btn:hover { color: var(--success); }
.copy-btn.copied { color: var(--success); }
.game-card-date { font-size: 11px; color: var(--text-dim); margin-top: 10px; }

/* Video section */
.video-section { max-width: 900px; margin: 0 auto 32px; padding: 0 24px; }
.video-section h3 { text-align: center; margin-bottom: 16px; font-size: 18px; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.video-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.video-item-label { padding: 8px 12px; font-size: 12px; font-weight: 700; color: var(--info); background: var(--bg-input); border-bottom: 1px solid var(--border); }
.video-wrapper { position: relative; padding-bottom: 56.25%; overflow: hidden; }
.video-wrapper iframe { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Support */
.support-bar { text-align: center; padding: 28px 24px; background: var(--bg-card); border-top: 1px solid var(--border); }
.support-bar p { color: var(--text-dim); margin-bottom: 14px; font-size: 13px; }

/* No results */
.no-results { text-align: center; padding: 48px 24px; color: var(--text-dim); }
.no-results .icon { font-size: 40px; margin-bottom: 12px; }
.no-results h3 { font-size: 16px; color: var(--text); margin-bottom: 6px; }

/* Toast */
.toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--accent); color: #fff;
  padding: 12px 20px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  z-index: 999;
  transform: translateY(80px); opacity: 0;
  transition: all 0.3s;
  box-shadow: var(--shadow-md);
}
.toast.show { transform: translateY(0); opacity: 1; }

/* Info cards for instructions */
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.info-card h4 { font-size: 14px; color: var(--info); margin-bottom: 10px; }
.info-card ol { font-size: 13px; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }

/* ─── ADMIN SIDEBAR LAYOUT ─── */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
}

.sidebar-logo {
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-logo h2 { font-size: 16px; font-weight: 700; color: #fff; margin: 0; }
.sidebar-logo h2 span { color: var(--info); }

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.12s;
}
.sidebar-item:hover { background: var(--accent-light); color: var(--text); }
.sidebar-item.active { background: var(--accent); color: #fff; font-weight: 600; }

.sidebar-links {
  padding: 0 10px 8px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-link {
  display: block;
  padding: 9px 14px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  border-radius: 8px;
  transition: all 0.12s;
}
.sidebar-link:hover { background: var(--accent-light); color: var(--info); }

.sidebar-footer {
  padding: 8px 10px 14px;
}

.admin-content {
  flex: 1;
  margin-left: 220px;
  padding: 24px;
  min-height: 100vh;
}

/* Hide mobile header on desktop */
.mobile-only { display: none; }

/* Stock mobile cards */
.stock-cards-mobile { display: none; }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .admin-content { margin-left: 0; padding: 12px; }
  .mobile-only { display: flex; }
  .stock-table-desktop { display: none; }
  .stock-cards-mobile { display: block; padding: 8px; }
}

.stock-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 8px;
}
.stock-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.stock-card-title { font-size: 15px; font-weight: 700; color: var(--text); }
.stock-card-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.stock-card-client { font-size: 12px; color: var(--text-dim); margin-bottom: 10px; }
.stock-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.stock-card-actions .btn { flex: 1; min-width: 0; justify-content: center; padding: 10px; font-size: 13px; }

/* Mobile menu */
.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  font-size: 22px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
}
.mobile-menu-btn:hover { background: rgba(255,255,255,0.08); }

.mobile-nav {
  display: none;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 8px;
  gap: 4px;
  flex-direction: column;
}
.mobile-nav.open { display: flex; }

.mobile-nav-item {
  display: block;
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: none;
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-item:hover, .mobile-nav-item:active { background: var(--accent-light); color: var(--info); }

@media (max-width: 768px) {
  .header-desktop { display: none !important; }
  .mobile-menu-btn { display: block; }
}

@media (min-width: 769px) {
  .mobile-nav { display: none !important; }
}

/* Autocomplete dropdown */
.autocomplete-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 4px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 300;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.autocomplete-dropdown.show { display: block; }
.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.autocomplete-item:hover, .autocomplete-item:focus { background: var(--accent-light); }
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item img {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-input);
}
.autocomplete-item .ac-name { font-size: 13px; font-weight: 600; color: var(--text); }
.autocomplete-item .ac-source { font-size: 10px; color: var(--text-dim); }
.autocomplete-loading { padding: 14px; text-align: center; font-size: 12px; color: var(--text-dim); }

/* Notification badge */
.msg-badge {
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  line-height: 1.3;
}

/* Catalog promo banner */
.catalog-promo {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 24px;
}

@media (max-width: 768px) {
  .catalog-promo { padding: 0 16px 20px; }
  .catalog-promo .promo-title { font-size: 16px !important; }
  .catalog-promo .promo-sub { font-size: 13px !important; margin-bottom: 12px !important; }
  .catalog-promo .promo-btn { font-size: 14px !important; padding: 11px 28px !important; }
}

/* ─── RESPONSIVE ─── */

/* Tablet */
@media (max-width: 768px) {
  /* Header */
  .header { padding: 0 14px; height: 50px; }
  .header h1 { font-size: 15px; }
  .header-actions { gap: 4px; }
  .header-actions .btn { padding: 5px 8px; font-size: 11px; }

  /* Admin layout */
  .container { padding: 12px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  #page-dashboard > div:nth-child(2) { grid-template-columns: 1fr !important; }
  #page-dashboard > div:nth-child(3) { grid-template-columns: 1fr !important; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .filters-bar { flex-direction: column; align-items: stretch; gap: 6px; }
  .filters-bar .form-control { width: 100%; min-width: 0; font-size: 16px; padding: 12px 14px; }
  .page-title { font-size: 18px; }

  /* Admin navigation mobile - horizontal scroll */
  .header-actions { gap: 3px; overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .header-actions .btn { flex-shrink: 0; }

  /* Admin tables mobile - card layout */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 600px; }
  td, th { padding: 8px 10px; font-size: 12px; white-space: nowrap; }
  .actions-cell { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .actions-cell .btn { padding: 8px 12px; font-size: 12px; min-height: 36px; }

  /* Admin buttons bigger for touch */
  #new-stock-btn, #bulk-stock-btn { padding: 12px 16px; font-size: 14px; }
  #export-csv-btn { padding: 10px 14px; }

  /* Stock page layout */
  #page-stock > div:first-child { flex-direction: column; gap: 10px; }
  #page-stock > div:first-child > div:last-child { width: 100%; display: flex; gap: 8px; }
  #page-stock > div:first-child > div:last-child .btn { flex: 1; justify-content: center; }

  /* Login mobile */
  .login-card { max-width: 100%; }
  .login-card .card-body { padding: 24px; }
  .login-card h2 { font-size: 20px; }
  .login-card .btn-lg { padding: 14px; font-size: 16px; }

  /* Settings card full width */
  #page-settings .card { max-width: 100%; }

  /* Reportes: 3 cols -> 1 col en mobile */
  #page-reportes > div:first-of-type { grid-template-columns: 1fr !important; }

  /* Ayuda: full width */
  #page-ayuda > div { max-width: 100% !important; }

  /* Portal hero */
  .client-hero { padding: 36px 20px 28px; }
  .client-hero h2 { font-size: 24px; line-height: 1.3; margin-bottom: 12px; }
  .client-hero p { font-size: 14px; margin-bottom: 24px; line-height: 1.5; }
  .email-form { flex-direction: column; gap: 10px; max-width: 100%; }
  .email-form .form-control { font-size: 16px; padding: 14px 16px; border-radius: 8px; }
  .email-form .btn { padding: 14px; font-size: 16px; justify-content: center; border-radius: 8px; }

  /* Game cards */
  .games-grid { grid-template-columns: 1fr; padding: 0 16px 24px; gap: 14px; }
  .game-card { border-radius: 12px; }
  .game-card-image { height: 160px; }
  .game-card-body { padding: 16px; }
  .game-card-title { font-size: 17px; margin-bottom: 10px; }
  .game-card-meta { margin-bottom: 14px; }
  .game-card-account { padding: 12px; margin-bottom: 10px; border-radius: 8px; }
  .game-card-account .label { font-size: 11px; margin-bottom: 4px; }
  .game-card-account .value { font-size: 14px; flex-wrap: wrap; gap: 8px; }
  .password-toggle, .copy-btn {
    font-size: 12px;
    padding: 6px 12px;
    background: var(--accent-light);
    border-radius: 6px;
    -webkit-tap-highlight-color: transparent;
  }
  .game-card-date { font-size: 12px; margin-top: 12px; }

  /* Results header */
  #results-section h2 { font-size: 17px; }
  #results-section #back-btn { font-size: 12px; }

  /* Videos */
  .video-grid { grid-template-columns: 1fr; }
  .video-section { padding: 0 16px; margin-bottom: 24px; }
  .video-section h3 { font-size: 16px; }

  /* Support */
  .support-bar { padding: 24px 16px; }
  .support-bar p { font-size: 14px; margin-bottom: 16px; }
  .support-bar .btn { padding: 12px 20px; font-size: 14px; }

  /* Modal - casi fullscreen en mobile */
  .modal-overlay { padding: 8px; align-items: flex-start; }
  .modal { max-width: 100%; border-radius: 12px; margin-top: 10px; }
  .modal-header { padding: 16px 18px; font-size: 17px; font-weight: 800; }
  .modal-close { font-size: 28px; padding: 8px; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
  .modal-body { padding: 18px; }
  .modal-body .form-group { margin-bottom: 16px; }
  .modal-body .form-label { font-size: 13px; margin-bottom: 6px; }
  .modal-body .form-control { font-size: 16px; padding: 14px 14px; border-radius: 8px; }
  .modal-body select.form-control { font-size: 16px; padding: 14px 14px; height: auto; }
  .modal-body textarea.form-control { font-size: 16px; padding: 14px; }
  .modal-footer { padding: 16px 18px; gap: 10px; }
  .modal-footer .btn { padding: 14px 24px; font-size: 15px; flex: 1; justify-content: center; min-height: 48px; border-radius: 8px; }
  .modal-footer .btn-primary { font-weight: 700; }

  /* Instructivo details */
  .game-card details summary { font-size: 14px; padding: 4px 0; }
  .game-card details ol { font-size: 13px; }
}

/* Phone */
@media (max-width: 480px) {
  .header { padding: 0 10px; height: 48px; }
  .header h1 { font-size: 14px; }
  .header-actions .btn { padding: 4px 7px; font-size: 10px; }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 10px; border-radius: 8px; }
  .stat-number { font-size: 20px; }
  .stat-label { font-size: 10px; }

  .client-hero { padding: 28px 16px 24px; }
  .client-hero h2 { font-size: 20px; }
  .client-hero p { font-size: 13px; }

  .games-grid { padding: 0 12px 20px; gap: 12px; }
  .game-card-image { height: 140px; }
  .game-card-body { padding: 14px; }
  .game-card-title { font-size: 16px; }
  .game-card-meta { gap: 4px; }
  .badge { font-size: 10px; padding: 3px 7px; }
  .game-card-account .value { font-size: 13px; }

  /* Tap targets min 44px */
  .password-toggle, .copy-btn { min-height: 36px; display: inline-flex; align-items: center; }
  .btn { min-height: 40px; }

  /* Admin mobile */
  .container { padding: 10px; }
  .page-title { font-size: 16px; margin-bottom: 12px; }
  .card-header { padding: 12px 14px; font-size: 13px; }
  .card-body { padding: 14px; }
  #stock-count { font-size: 11px; }

  /* Modal fullscreen en phone */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { border-radius: 16px 16px 0 0; margin-top: 0; max-height: 95vh; overflow-y: auto; }
  .modal-header { position: sticky; top: 0; background: var(--bg-card); z-index: 1; border-radius: 16px 16px 0 0; }
  .modal-footer { position: sticky; bottom: 0; background: var(--bg-card); z-index: 1; }
  .btn-sm, .btn-small { min-height: 32px; }
}

/* Extra small */
@media (max-width: 360px) {
  .header h1 { font-size: 13px; }
  .header-actions .btn { padding: 4px 6px; font-size: 10px; }
  .client-hero h2 { font-size: 18px; }
  .game-card-image { height: 120px; }
}
