/* ══════════════════════════════════════════════════════════════════════════
   Mobile — Centro de acciones
   Se activa solo cuando js/mobile.js detecta viewport de celular (ver
   MobileApp.isMobile() en mobile.js). Reutiliza los tokens de color de
   css/styles.css (--bg, --card, --border, --text, --muted, --accent,
   --green, --amber, --red, --radius) y agrega los que faltan para las
   variantes "soft" y los niveles de superficie usados acá.
   ══════════════════════════════════════════════════════════════════════════ */

:root {
  --card2: #1A2235;
  --card3: #202B42;
  --accent-soft: #3B82F626;
  --green-soft:  #10B98120;
  --amber-soft:  #F59E0B20;
  --red-soft:    #EF444420;

  --alert-media:   #3B82F6;
  --alert-offline: #6B7FA8;
  --alert-ram:     #F59E0B;
  --alert-storage: #FB923C;
  --alert-battery: #EF4444;
}

#mobile-shell {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}
#mobile-shell:not(.hidden) { display: flex; }

/* ── App bar ──────────────────────────────────────────────────────────── */
.mob-appbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 12px;
  border-bottom: 1px solid var(--border);
}
.mob-appbar-left { min-width: 30px; }
.mob-back-btn {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--card2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
}
.mob-appbar-title { flex: 1 1 auto; min-width: 0; }
.mob-title { font-size: 15px; font-weight: 700; letter-spacing: -0.1px; }
.mob-subtitle { font-size: 10.5px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mob-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--card3);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--muted);
  flex: 0 0 auto;
  cursor: pointer;
}
.mob-avatar.active { border-color: var(--accent); color: var(--accent); }

/* ── Body ─────────────────────────────────────────────────────────────── */
.mob-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.mob-loading, .mob-error, .mob-empty {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 40px 16px;
}
.mob-error { color: var(--red); }

/* ── Pending strip ────────────────────────────────────────────────────── */
.pending-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
}
.pending-chip {
  flex: 0 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  min-width: 92px;
}
.pending-chip .n { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.pending-chip .l { font-size: 10.5px; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.pending-chip.urgent .n { color: var(--red); }
.pending-chip.warn .n { color: var(--amber); }
.pending-chip.ok .n { color: var(--green); }

.section-label {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin: 4px 0 -6px;
}

/* ── Action cards (Inicio) ────────────────────────────────────────────── */
.action-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.action-icon { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.action-icon svg { width: 19px; height: 19px; }
.action-icon.blue  { background: var(--accent-soft); color: var(--accent); }
.action-icon.amber { background: var(--amber-soft);  color: var(--amber); }
.action-icon.green { background: var(--green-soft);  color: var(--green); }
.action-icon.red   { background: var(--red-soft);    color: var(--red); }
.action-icon.slate { background: var(--card3);       color: var(--muted); }

.action-body { flex: 1 1 auto; min-width: 0; }
.action-body .t { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.action-body .d { font-size: 11.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.count-pill { font-size: 10.5px; font-weight: 800; font-variant-numeric: tabular-nums; padding: 1px 7px; border-radius: 20px; line-height: 1.5; }
.count-pill.red   { background: var(--red-soft);   color: var(--red); }
.count-pill.amber { background: var(--amber-soft); color: var(--amber); }
.count-pill.green { background: var(--green-soft); color: var(--green); }
.count-pill.muted { background: var(--card3);      color: var(--muted); }

.chevron { color: var(--muted); flex: 0 0 auto; }
.chevron svg { width: 16px; height: 16px; }

/* ── Filter pills ─────────────────────────────────────────────────────── */
.filter-row { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; }
.filter-pill { flex: 0 0 auto; font-size: 11.5px; font-weight: 600; padding: 6px 13px; border-radius: 20px; border: 1px solid var(--border); color: var(--muted); background: var(--card2); cursor: pointer; }
.filter-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Prospectos ───────────────────────────────────────────────────────── */
.prospect-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.prospect-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.prospect-name { font-size: 13.5px; font-weight: 700; }
.prospect-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.prospect-time { font-size: 10.5px; color: var(--muted); white-space: nowrap; flex: 0 0 auto; }
.prospect-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; color: var(--amber); background: var(--amber-soft); padding: 2px 8px; border-radius: 20px; width: fit-content; }
.prospect-actions { display: flex; gap: 8px; }
.pbtn { flex: 1; border: none; border-radius: 9px; padding: 9px 0; font-size: 12.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 5px; cursor: pointer; }
.pbtn.approve { background: var(--green); color: #06281c; }
.pbtn.reject  { background: var(--card2); color: var(--red); border: 1px solid #EF444440; }
.pbtn:disabled { opacity: 0.5; }

/* ── Gráficos / donut ─────────────────────────────────────────────────── */
.chart-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.chart-card .ct { font-size: 12.5px; font-weight: 700; margin-bottom: 2px; }
.chart-card .cs { font-size: 10.5px; color: var(--muted); margin-bottom: 14px; }

.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut { flex: 0 0 auto; width: 116px; height: 116px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.donut-hole { width: 72px; height: 72px; border-radius: 50%; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-hole .n { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.donut-hole .l { font-size: 8.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 3px; }

.legend { flex: 1 1 auto; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.legend-row { display: flex; align-items: center; gap: 7px; font-size: 11.5px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.legend-label { flex: 1 1 auto; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-n { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }

.bar-list { display: flex; flex-direction: column; gap: 12px; }
.bar-row .brt { display: flex; justify-content: space-between; font-size: 11.5px; margin-bottom: 5px; }
.bar-row .brt .acc { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70%; }
.bar-row .brt .cnt { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.bar-track { height: 7px; border-radius: 4px; background: var(--card3); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--alert-media), #60A5FA); }

.seg-tabs { display: flex; gap: 6px; background: var(--card2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg-tab { flex: 1; text-align: center; font-size: 11px; font-weight: 700; padding: 6px 0; border-radius: 8px; color: var(--muted); cursor: pointer; }
.seg-tab.active { background: var(--accent); color: #fff; }

/* ── Search / select fields ───────────────────────────────────────────── */
.search-field {
  display: flex; align-items: center; gap: 9px;
  background: var(--card2); border: 1px solid var(--border); border-radius: 11px;
  padding: 10px 13px; color: var(--muted); font-size: 12.5px;
}
.search-field svg { width: 15px; height: 15px; flex: 0 0 auto; }
.search-field input { flex: 1 1 auto; background: none; border: none; outline: none; color: var(--text); font-size: 12.5px; }
.search-field input::placeholder { color: var(--muted); }

.select-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; margin-bottom: 6px; }
.mob-select {
  width: 100%;
  background: var(--card2); border: 1px solid var(--border); border-radius: 11px;
  padding: 11px 13px; font-size: 12.5px; font-weight: 600; color: var(--text);
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7FA8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 15px;
}

/* ── Info banner ──────────────────────────────────────────────────────── */
.info-banner { display: flex; align-items: flex-start; gap: 9px; background: var(--accent-soft); border: 1px solid #3B82F640; border-radius: 11px; padding: 10px 12px; font-size: 11px; color: var(--text); line-height: 1.5; }
.info-banner svg { width: 15px; height: 15px; flex: 0 0 auto; color: var(--accent); margin-top: 1px; }
.info-banner b { color: var(--accent); }

/* ── Account chip ─────────────────────────────────────────────────────── */
.account-chip { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 11px 13px; }
.account-chip .ac-avatar { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), #6366F1); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: #fff; flex: 0 0 auto; }
.account-chip .ac-body { flex: 1 1 auto; min-width: 0; }
.account-chip .ac-name { font-size: 13px; font-weight: 700; }
.account-chip .ac-meta { font-size: 10.5px; color: var(--muted); margin-top: 1px; }

/* ── Toggle switch ────────────────────────────────────────────────────── */
.switch { position: relative; width: 40px; height: 23px; flex: 0 0 auto; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--card3); border: 1px solid var(--border); border-radius: 20px; transition: background 0.15s ease; cursor: pointer; }
.switch .slider::before { content: ""; position: absolute; width: 17px; height: 17px; left: 2px; top: 2px; background: var(--muted); border-radius: 50%; transition: transform 0.15s ease, background 0.15s ease; }
.switch input:checked + .slider { background: var(--green-soft); border-color: #10B98150; }
.switch input:checked + .slider::before { transform: translateX(17px); background: var(--green); }
.switch input:disabled + .slider { opacity: 0.5; }

/* ── Row cards (cuentas) ──────────────────────────────────────────────── */
.row-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 14px; }
.row-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row-name { font-size: 13px; font-weight: 700; }
.row-meta { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.status-pill { font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 20px; }
.status-pill.on  { background: var(--green-soft); color: var(--green); }
.status-pill.off { background: var(--red-soft); color: var(--red); }
.status-pill.wait{ background: var(--amber-soft); color: var(--amber); }

/* ── Flat list (Bot Activity / Salud) ─────────────────────────────────── */
.flat-list { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.flat-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; }
.flat-row + .flat-row { border-top: 1px solid var(--border); }
.flat-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.flat-dot.ok  { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.flat-dot.off { background: var(--red);   box-shadow: 0 0 0 3px var(--red-soft); }
.flat-body { flex: 1 1 auto; min-width: 0; }
.flat-title { font-size: 12px; font-weight: 700; }
.flat-meta { font-size: 10.5px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flat-time { font-size: 10px; color: var(--muted); flex: 0 0 auto; white-space: nowrap; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.mob-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border-radius: 10px; font-size: 13px; font-weight: 700;
  border: none; cursor: pointer; width: 100%;
}
.mob-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.mob-btn-primary   { background: var(--accent); color: #fff; }
.mob-btn-secondary { background: var(--card2); color: var(--text); border: 1px solid var(--border); }
.mob-btn-danger    { background: var(--red-soft); color: var(--red); border: 1px solid #EF444440; }
.btn-row { display: flex; gap: 8px; }
.btn-row .mob-btn { width: auto; flex: 1; }

/* ── Account menu overlay ─────────────────────────────────────────────── */
.mob-menu-overlay {
  position: absolute; inset: 0;
  background: #05070fcc;
  display: flex; align-items: flex-start; justify-content: flex-end;
  padding: calc(env(safe-area-inset-top, 0px) + 60px) 14px 0 0;
  z-index: 10;
}
.mob-menu-overlay.hidden { display: none; }
.account-menu { width: 220px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 6px; box-shadow: 0 20px 50px #000000a0; }
.am-head { display: flex; align-items: center; gap: 10px; padding: 12px 10px; }
.am-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #6366F1); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 13px; flex: 0 0 auto; }
.am-name { font-size: 12.5px; font-weight: 700; }
.am-email { font-size: 10.5px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.am-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.am-item { display: flex; align-items: center; gap: 10px; padding: 10px 10px; border-radius: 9px; font-size: 12.5px; font-weight: 600; color: var(--text); cursor: pointer; background: none; border: none; width: 100%; text-align: left; }
.am-item:hover { background: var(--card2); }
.am-item svg { width: 15px; height: 15px; color: var(--muted); flex: 0 0 auto; }
.am-item.danger { color: var(--red); }
.am-item.danger svg { color: var(--red); }

/* ── Form group (cambiar contraseña) ──────────────────────────────────── */
.mob-form-group { display: flex; flex-direction: column; gap: 6px; }
.mob-form-group label { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.mob-form-group input {
  background: var(--card2); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 13px; color: var(--text); font-size: 14px; outline: none;
}
.mob-form-group input:focus { border-color: var(--accent); }

/* Hide the mobile shell entirely on non-touch/wide viewports as a defensive
   fallback — the primary gate is the isMobile() check in mobile.js. */
@media (min-width: 821px) {
  #mobile-shell:not(.hidden) { display: none; }
}
