:root {
  --bg: #0a1428;
  --surface: rgba(255, 255, 255, 0.08);
  --surface-soft: rgba(255, 255, 255, 0.06);
  --text: #f0f4f8;
  --text-muted: rgba(255, 255, 255, 0.7);
  --line: rgba(255, 255, 255, 0.12);
  --primary: #4da6ff;
  --primary-strong: #3388dd;
  --accent: rgba(77, 166, 255, 0.15);
  --ok: #4dff88;
  --warn: #ffbb33;
  --danger: #ff5555;
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 40px rgba(77, 166, 255, 0.25);
  --radius-xl: 32px;
  --radius-lg: 28px;
  --radius-md: 22px;
  --radius-sm: 18px;
  --mode-accent: #4da6ff;
  --mode-accent-strong: #3388dd;
  --mode-glow: rgba(77, 166, 255, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Bahnschrift", "Aptos", "Segoe UI Variable", sans-serif;
  background:
    radial-gradient(circle at 15% 20%, rgba(30, 80, 120, 0.3), transparent 40%),
    radial-gradient(circle at 85% 15%, rgba(40, 100, 140, 0.25), transparent 45%),
    radial-gradient(circle at 70% 85%, rgba(20, 60, 100, 0.2), transparent 50%),
    linear-gradient(135deg, #0a1428 0%, #1a2332 30%, #0d1624 60%, #16263d 100%);
  background-attachment: fixed;
  color: #f0f4f8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

body.mode-personal {
  --mode-accent: #4da6ff;
  --mode-accent-strong: #3388dd;
  --mode-glow: rgba(77, 166, 255, 0.2);
}

body.mode-business {
  --mode-accent: #59adff;
  --mode-accent-strong: #2f73d8;
  --mode-glow: rgba(89, 173, 255, 0.22);
  background:
    radial-gradient(circle at 15% 20%, rgba(36, 96, 165, 0.24), transparent 40%),
    radial-gradient(circle at 85% 15%, rgba(55, 120, 195, 0.18), transparent 45%),
    radial-gradient(circle at 70% 85%, rgba(20, 68, 132, 0.2), transparent 50%),
    linear-gradient(135deg, #09162a 0%, #10233d 35%, #0a1b33 62%, #163154 100%);
}

.bg-shape {
  display: none;
}

.bg-shape-a {
  width: 360px;
  height: 360px;
  left: -120px;
  top: -110px;
  background: #53ad9b;
}

.bg-shape-b {
  width: 420px;
  height: 420px;
  right: -120px;
  bottom: -130px;
  background: #8ea6bd;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1080px, 94vw);
  margin: 20px auto 28px;
}

.card {
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28), inset 1px 1px 2px rgba(255, 255, 255, 0.12), 0 0 48px var(--mode-glow);
  backdrop-filter: blur(45px);
  -webkit-backdrop-filter: blur(45px);
  transition: all 0.5s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.15), transparent 70%);
  pointer-events: none;
  border-radius: var(--radius-lg);
}

.card:hover {
  border-color: color-mix(in srgb, var(--mode-accent) 48%, white 8%);
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.36), inset 1px 1px 3px rgba(255, 255, 255, 0.18), 0 0 72px var(--mode-glow);
  transform: translateY(-2px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 16px;
  margin-bottom: 12px;
  border-radius: var(--radius-xl);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), inset 1px 1px 2px rgba(255, 255, 255, 0.18), 0 0 80px rgba(77, 166, 255, 0.1);
  backdrop-filter: blur(50px);
  -webkit-backdrop-filter: blur(50px);
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  position: relative;
  overflow: hidden;
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--mode-accent) 65%, white 10%) 20%, color-mix(in srgb, var(--mode-accent-strong) 65%, white 8%) 50%, color-mix(in srgb, var(--mode-accent) 65%, white 10%) 80%, transparent);
  opacity: 0.5;
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.2), transparent 70%);
  pointer-events: none;
  border-radius: var(--radius-xl);
}

.brand-block {
  max-width: 720px;
}

.eyebrow {
  margin: 0;
  color: color-mix(in srgb, var(--mode-accent) 84%, white 12%);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.7rem;
}

.topbar h1 {
  margin: 4px 0 0;
  font-size: clamp(1.45rem, 1.1rem + 1vw, 2rem);
  letter-spacing: 0.2px;
  font-weight: 700;
  color: #ffffff;
}

.tagline {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.75);
  max-width: 520px;
  line-height: 1.35;
  font-size: 0.9rem;
}

.experience-switch {
  margin-top: 12px;
  display: inline-flex;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px;
  border-radius: 999px;
  position: relative;
}

.experience-switch .btn {
  flex: 1;
  min-width: 130px;
  border-radius: 999px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 600;
  padding: 8px 16px;
  position: relative;
  z-index: 2;
  transition: color 0.3s ease;
}

.experience-switch .btn.btn-primary {
  color: #fff;
}

/* Base animada del switch */
.experience-switch::before {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: calc(50% - 4px);
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 1;
}

/* Desplazamiento condicional. Por defecto (personal) left=0, trans=0. Empresarial trans=100% */
body.mode-business .experience-switch::before {
  transform: translateX(100%);
}

.warning-text {
  color: #ffbb33;
  font-weight: 700;
}

.status-group {
  margin-top: 4px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.76rem;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
}

.status::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  animation: statusPulse 1.6s ease-in-out infinite;
}

.status-online {
  background: color-mix(in srgb, var(--mode-accent) 24%, transparent);
  color: color-mix(in srgb, var(--mode-accent) 80%, white 12%);
  border-color: color-mix(in srgb, var(--mode-accent) 42%, white 8%);
}

.status-online::before {
  background: var(--mode-accent);
}

.status-offline {
  background: rgba(255, 85, 85, 0.2);
  color: #ff5555;
  border-color: rgba(255, 85, 85, 0.35);
}

.status-offline::before {
  background: #ff5555;
}

.layout {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

body.mode-business .peers-card {
  display: none;
}

body.mode-business .send-card {
  display: none;
}

body.mode-business .me-card {
  grid-column: span 12;
}

body.mode-business .transfers-card {
  grid-column: span 12;
}

.layout > section {
  animation: fadeUp 0.35s ease both;
}

.layout > section:nth-child(2) { animation-delay: 0.03s; }
.layout > section:nth-child(3) { animation-delay: 0.06s; }
.layout > section:nth-child(4) { animation-delay: 0.09s; }
.layout > section:nth-child(5) { animation-delay: 0.12s; }

.me-card {
  grid-column: span 6;
  padding: 12px;
}

.business-download-settings {
  margin-top: 8px;
  border: 1px solid color-mix(in srgb, var(--mode-accent) 18%, transparent);
  background: color-mix(in srgb, var(--mode-accent) 5%, transparent);
  border-radius: 12px;
  padding: 8px 10px;
}

.business-folder-hint {
  margin: 0;
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  opacity: 0.82;
}

.business-folder-label {
  margin: 3px 0 0;
  font-size: 0.84rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--mode-accent) 72%, white 14%);
  word-break: break-word;
}

.business-folder-actions {
  margin-top: 6px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.business-folder-actions .btn {
  min-height: 30px;
  padding: 4px 9px;
  font-size: 0.78rem;
}

.peers-card {
  grid-column: span 6;
  padding: 12px;
}

.send-card,
.transfers-card {
  grid-column: span 12;
  padding: 12px;
}

/* Incoming Card Flotante (Dinámico) */
.incoming-card {
  display: none;
}

.incoming-card.has-requests {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px color-mix(in srgb, var(--mode-accent) 60%, transparent);
  animation: slideDownToast 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  padding: 16px !important;
  background: var(--card-bg, rgba(20, 32, 52, 0.95));
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
}

@keyframes slideDownToast {
  0% { top: -100px; opacity: 0; }
  100% { top: 80px; opacity: 1; }
}

h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  letter-spacing: 0.1px;
  font-weight: 700;
  color: #ffffff;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.section-title-row h2 {
  margin: 0;
}

.transfer-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.transfer-filters .btn {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 0.8rem;
}

h3 {
  margin: 10px 0 6px;
  font-size: 0.86rem;
  color: rgba(255, 255, 255, 0.85);
}

.muted {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.86rem;
}

.muted:empty {
  display: none;
}

.inline-field {
  display: flex;
  gap: 7px;
  align-items: center;
}

input[type="text"],
.file-field span,
.drop-zone,
.peer-item,
.request-item,
.transfer-item {
  border-radius: 12px;
}

input[type="text"] {
  flex: 1;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: #f0f4f8;
  padding: 9px 11px;
  font-size: 0.92rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-radius: 14px;
}

input[type="text"]::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

input[type="text"]:focus {
  outline: none;
  border-color: rgba(77, 166, 255, 0.5);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 2px rgba(77, 166, 255, 0.15), inset 0 1px 2px rgba(255, 255, 255, 0.1), 0 0 30px rgba(77, 166, 255, 0.15);
}

.join-links {
  display: grid;
  gap: 6px;
}

.qr-pairing-box {
  margin-top: 6px;
  display: grid;
  gap: 6px;
}

.qr-pairing-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pair-qr-wrap {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  min-height: 170px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
  padding: 8px;
}

.pair-qr-image {
  width: 220px;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.25);
}

.hidden {
  display: none !important;
}

.join-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 9px;
  border-radius: 12px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: all 0.3s ease;
  color: rgba(255, 255, 255, 0.85);
}

.join-link-row:hover {
  border-color: rgba(77, 166, 255, 0.25);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 20px rgba(77, 166, 255, 0.1);
}

.join-link-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
}

.btn {
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 700;
  padding: 8px 12px;
  min-height: 38px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.22s ease, border-color 0.22s ease, background-color 0.22s ease, opacity 0.22s ease;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
}

.btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--mode-accent) 60%, white 6%);
  outline-offset: 2px;
}

.btn.is-selected {
  background: linear-gradient(135deg, color-mix(in srgb, var(--mode-accent) 42%, transparent), color-mix(in srgb, var(--mode-accent-strong) 34%, transparent));
  color: #ffffff;
  border-color: color-mix(in srgb, var(--mode-accent) 62%, white 8%);
  box-shadow: 0 0 28px var(--mode-glow), inset 1px 1px 0 rgba(255, 255, 255, 0.22);
}

.btn.is-selected:hover:not(:disabled) {
  border-color: rgba(77, 166, 255, 0.75);
  box-shadow: 0 0 40px rgba(77, 166, 255, 0.3), inset 1px 1px 0 rgba(255, 255, 255, 0.28);
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, color-mix(in srgb, var(--mode-accent) 35%, transparent), color-mix(in srgb, var(--mode-accent-strong) 25%, transparent));
  color: #ffffff;
  box-shadow: 0 0 36px var(--mode-glow), inset 1px 1px 0 rgba(255, 255, 255, 0.15);
  border: 1.5px solid color-mix(in srgb, var(--mode-accent) 44%, white 8%);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 0 48px var(--mode-glow), inset 1px 1px 0 rgba(255, 255, 255, 0.25);
  border-color: color-mix(in srgb, var(--mode-accent) 60%, white 8%);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
  background: rgba(255, 85, 85, 0.2);
  color: #ffffff;
  border: 1.5px solid rgba(255, 85, 85, 0.3);
}

.btn-danger:hover:not(:disabled) {
  border-color: rgba(255, 85, 85, 0.5);
  background: rgba(255, 85, 85, 0.28);
}

/* ── Ocultar input nativo ─────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ── send-card layout ─────────────────────────────────── */
.send-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px !important;
}

/* ── Destinatario pill ────────────────────────────────── */
.send-peer-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.6);
  font-weight: 500;
}

.send-peer-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  flex-shrink: 0;
  transition: background 0.3s ease;
}

.send-peer-label.has-peer .send-peer-dot {
  background: var(--mode-accent);
  box-shadow: 0 0 8px var(--mode-glow);
}

.send-peer-label.has-peer {
  color: rgba(255,255,255,0.85);
}

/* ── Área de tap (sin archivo seleccionado) ───────────── */
.upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px 20px;
  border-radius: 20px;
  border: 1.5px dashed color-mix(in srgb, var(--mode-accent) 35%, transparent);
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}

.upload-area:hover,
.upload-area:focus-within {
  border-color: color-mix(in srgb, var(--mode-accent) 60%, white 8%);
  background: rgba(255,255,255,0.07);
  box-shadow: 0 0 28px var(--mode-glow);
}

.upload-area:active {
  transform: scale(0.98);
}

.upload-area.drag-over {
  border-color: color-mix(in srgb, var(--mode-accent) 80%, white 10%);
  background: color-mix(in srgb, var(--mode-accent) 12%, transparent);
  box-shadow: 0 0 40px var(--mode-glow);
}

.upload-icon {
  color: color-mix(in srgb, var(--mode-accent) 70%, white 10%);
  opacity: 0.8;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.upload-area:hover .upload-icon {
  transform: translateY(-3px);
  opacity: 1;
}

.upload-label-main {
  font-size: 0.96rem;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
}

.upload-label-sub {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.45);
  font-weight: 400;
}

/* ── Drop zone invisible (solo funcional) ─────────────── */
.drop-zone-ghost {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.drop-zone-ghost.over ~ .upload-area,
.upload-area.drag-over {
  border-color: color-mix(in srgb, var(--mode-accent) 80%, white 10%);
}

/* ── File preview row ─────────────────────────────────── */
.file-preview {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid color-mix(in srgb, var(--mode-accent) 30%, transparent);
  animation: fadeUp 0.3s ease both;
}

.file-preview.active {
  display: flex;
}

.file-preview-icon {
  color: color-mix(in srgb, var(--mode-accent) 80%, white 10%);
  flex-shrink: 0;
}

.file-preview-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-preview-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(255,255,255,0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.file-preview-size {
  font-size: 0.76rem;
  color: rgba(255,255,255,0.5);
}

.btn-clear-file {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  padding: 6px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.btn-clear-file:hover,
.btn-clear-file:active {
  background: rgba(255,85,85,0.18);
  color: #ff5555;
}

/* ── Botón Enviar (pill full-width) ───────────────────── */
.send-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 15px 20px;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.28s cubic-bezier(0.25, 0.8, 0.25, 1);
  -webkit-tap-highlight-color: transparent;
  /* Estado deshabilitado (por defecto) */
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.3);
  border: 1.5px solid rgba(255,255,255,0.1);
}

.send-btn:not(:disabled) {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--mode-accent) 55%, transparent),
    color-mix(in srgb, var(--mode-accent-strong) 45%, transparent));
  color: #ffffff;
  border-color: color-mix(in srgb, var(--mode-accent) 55%, white 8%);
  box-shadow: 0 4px 24px var(--mode-glow), inset 1px 1px 0 rgba(255,255,255,0.18);
}

.send-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 36px var(--mode-glow), inset 1px 1px 0 rgba(255,255,255,0.25);
}

.send-btn:not(:disabled):active {
  transform: translateY(0px) scale(0.99);
}

.send-btn:disabled {
  cursor: not-allowed;
}

/* ── Hint de estado ───────────────────────────────────── */
.send-hint-text {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.4);
  font-weight: 400;
  min-height: 1em;
}

.send-hint-text:empty {
  display: none;
}

/* ── Light mode overrides ─────────────────────────────── */
body.light-mode .upload-area {
  background: rgba(255,255,255,0.5);
  border-color: rgba(37,99,235,0.25);
}

body.light-mode .upload-area:hover {
  background: rgba(255,255,255,0.8);
  border-color: rgba(37,99,235,0.45);
}

body.light-mode .upload-label-main {
  color: #0f2744;
}

body.light-mode .upload-label-sub {
  color: rgba(15,39,68,0.5);
}

body.light-mode .upload-icon {
  color: #2563eb;
}

body.light-mode .file-preview {
  background: rgba(255,255,255,0.7);
  border-color: rgba(37,99,235,0.2);
}

body.light-mode .file-preview-name {
  color: #0f2744;
}

body.light-mode .file-preview-size {
  color: rgba(15,39,68,0.55);
}

body.light-mode .file-preview-icon {
  color: #2563eb;
}

body.light-mode .send-peer-label {
  color: rgba(15,39,68,0.6);
}

body.light-mode .send-peer-label.has-peer {
  color: #0f2744;
}

body.light-mode .send-btn:not(:disabled) {
  background: linear-gradient(135deg, #2f7ceb, #1e63d5);
  border-color: rgba(30,99,213,0.75);
  box-shadow: 0 8px 24px rgba(30,99,213,0.28);
  color: #ffffff;
}

body.light-mode .send-btn:disabled {
  background: rgba(30,50,80,0.07);
  color: rgba(15,39,68,0.3);
  border-color: rgba(30,50,80,0.1);
}

body.light-mode .send-hint-text {
  color: rgba(15,39,68,0.45);
}

body.light-mode .btn-clear-file {
  color: rgba(15,39,68,0.4);
}

.incoming-list,
.transfers-list {
  display: grid;
  gap: 8px;
}

/* ─────────────────────────────────────────────────────────
   Dispositivos detectados (Peers AirDrop Style)
───────────────────────────────────────────────────────── */
.peers-list {
  display: flex;
  overflow-x: auto;
  gap: 12px;
  padding: 8px 4px 16px 4px;
  margin: -4px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

/* Ocultar scrollbar horizontal feo */
.peers-list::-webkit-scrollbar {
  height: 6px;
  display: none;
}
.peers-list:hover::-webkit-scrollbar {
  display: block;
}
.peers-list::-webkit-scrollbar-thumb {
  background-color: rgba(255,255,255,0.15);
  border-radius: 999px;
}

.request-item,
.transfer-item {
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  padding: 8px;
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-radius: 16px;
  transition: all 0.3s ease;
  color: #f0f4f8;
}

.peer-item {
  flex: 0 0 auto;
  width: 140px;
  scroll-snap-align: start;
  text-align: center;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  padding: 16px 10px;
  border-radius: 18px;
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  color: #f0f4f8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .peer-item:hover:not(.selected) {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    border-color: rgba(77, 166, 255, 0.2);
  }
}

.peer-item:active {
  transform: scale(0.96) translateY(0);
}

.peer-item.selected {
  background: color-mix(in srgb, var(--mode-accent) 15%, transparent);
  border-color: color-mix(in srgb, var(--mode-accent) 60%, transparent);
  box-shadow: 0 4px 16px var(--mode-glow);
  transform: translateY(-2px);
}

.peer-main {
  width: 100%;
}

.row-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.row-main strong {
  font-size: 0.95rem;
  font-weight: 600;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  line-height: 1.3;
}

.request-copy {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.93rem;
}

.state-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.state-pill-info {
  background: rgba(77, 166, 255, 0.2);
  color: #ffffff;
  border-color: rgba(77, 166, 255, 0.3);
}

.state-pill-success {
  background: rgba(77, 255, 136, 0.2);
  color: #ffffff;
  border-color: rgba(77, 255, 136, 0.3);
}

.state-pill-warn {
  background: rgba(255, 187, 51, 0.2);
  color: #ffffff;
  border-color: rgba(255, 187, 51, 0.3);
}

.state-pill-danger {
  background: rgba(255, 85, 85, 0.2);
  color: #ffffff;
  border-color: rgba(255, 85, 85, 0.3);
}

.peer-meta {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.84rem;
}

.request-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.transfer-item {
  display: grid;
  gap: 6px;
  position: relative;
  padding-left: 12px;
}

.transfer-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--mode-accent), var(--mode-accent-strong));
  opacity: 0.7;
  box-shadow: 0 0 12px var(--mode-glow);
}

.transfer-item:hover {
  box-shadow: 0 0 24px rgba(77, 166, 255, 0.12);
  border-color: rgba(77, 166, 255, 0.25);
}

.transfer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.9);
}

.transfer-head strong {
  min-width: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.transfer-meta-row {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.84rem;
}

.transfer-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
}

.btn-compact {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 0.78rem;
}

.progress-track {
  height: 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--mode-accent) 24%, transparent);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(135deg, color-mix(in srgb, var(--mode-accent) 70%, transparent), color-mix(in srgb, var(--mode-accent-strong) 70%, transparent));
  width: 0;
  transition: width 0.24s ease-out;
  position: relative;
  box-shadow: 0 0 12px var(--mode-glow);
}

.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: progressSheen 1.8s ease-in-out infinite;
}

.empty {
  color: rgba(255, 255, 255, 0.6);
  border: 1px dashed color-mix(in srgb, var(--mode-accent) 25%, transparent);
  padding: 12px;
  text-align: center;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.empty::before {
  content: "Sin actividad";
  display: block;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
  color: color-mix(in srgb, var(--mode-accent) 70%, white 10%);
}

.toast-stack {
  position: fixed;
  right: 16px;
  top: 16px;
  display: grid;
  gap: 8px;
  z-index: 20;
}

.toast {
  background: rgba(0, 0, 0, 0.4);
  color: #e0e8f0;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-width: 230px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), inset 1px 1px 0 rgba(255, 255, 255, 0.1);
  font-size: 0.9rem;
  border: 1px solid color-mix(in srgb, var(--mode-accent) 26%, transparent);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes progressSheen {
  0% {
    transform: translateX(-100%);
  }
  50% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 12px rgba(15, 115, 109, 0.1);
  }
  50% {
    box-shadow: 0 0 20px rgba(15, 115, 109, 0.2);
  }
}

@keyframes statusPulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--mode-accent) 32%, transparent);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--mode-accent) 0%, transparent);
  }
}

@media (max-width: 880px) {
  .app-shell {
    width: min(1080px, 96vw);
    margin: 14px auto 22px;
  }

  .me-card,
  .peers-card,
  .send-card,
  .incoming-card,
  .transfers-card {
    grid-column: span 12;
    padding: 10px;
  }

  body.mode-business .send-card,
  body.mode-business .transfers-card {
    grid-column: span 12;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .section-title-row {
    flex-wrap: wrap;
  }

  .section-title-row .btn {
    width: 100%;
  }

  .transfer-filters {
    gap: 8px;
  }

  .transfer-filters .btn {
    flex: 1 1 calc(50% - 4px);
  }

  .btn {
    min-height: 40px;
    padding: 9px 12px;
  }
}

/* ─────────────────────────────────────────────────────────
   FAB "Ver historial" — solo móvil (≤ 640px)
───────────────────────────────────────────────────────── */
.history-fab {
  display: none; /* oculto por defecto en desktop */
}

@media (max-width: 640px) {
  /* Ocultar la tarjeta inline de transferencias */
  #transfersCard {
    display: none !important;
  }

  /* FAB flotante */
  .history-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: fixed;
    bottom: 24px;
    right: 20px;
    z-index: 90;
    padding: 13px 20px;
    border-radius: 999px;
    border: 1.5px solid color-mix(in srgb, var(--mode-accent) 50%, white 8%);
    background: linear-gradient(135deg,
      color-mix(in srgb, var(--mode-accent) 55%, transparent),
      color-mix(in srgb, var(--mode-accent-strong) 45%, transparent));
    color: #ffffff;
    font-size: 0.92rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 8px 30px var(--mode-glow), 0 4px 12px rgba(0,0,0,0.4);
    transition: all 0.28s cubic-bezier(0.25, 0.8, 0.25, 1);
    -webkit-tap-highlight-color: transparent;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }

  .history-fab:hover,
  .history-fab:active {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 40px var(--mode-glow), 0 6px 16px rgba(0,0,0,0.45);
  }

  /* Badge de contador en el FAB */
  .history-fab-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ff5555;
    color: #ffffff;
    font-size: 0.68rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(10, 20, 40, 0.8);
    animation: fabBounce 0.4s cubic-bezier(0.34,1.56,0.64,1);
  }

  .history-fab-badge.hidden {
    display: none !important;
  }

  /* Espacio extra al final del scroll para que el FAB no tape contenido */
  .app-shell {
    padding-bottom: 90px;
  }
}

/* ─────────────────────────────────────────────────────────
   Modal historial (bottom sheet)
───────────────────────────────────────────────────────── */
.history-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: flex-end;
}

.history-modal.open {
  display: flex;
}

.history-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: backdropIn 0.25s ease;
}

.history-modal-sheet {
  position: relative;
  width: 100%;
  max-height: 88vh;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.07));
  border: 1.5px solid rgba(255,255,255,0.18);
  border-bottom: none;
  backdrop-filter: blur(50px);
  -webkit-backdrop-filter: blur(50px);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.5), inset 1px 1px 0 rgba(255,255,255,0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: sheetUp 0.32s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.history-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

/* Pill drag handle */
.history-modal-header::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.25);
}

.history-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
}

.history-modal-close {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.history-modal-close:hover,
.history-modal-close:active {
  background: rgba(255,85,85,0.2);
  color: #ff5555;
  border-color: rgba(255,85,85,0.3);
}

.history-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.history-modal-actions .transfer-filters {
  flex: 1;
  margin: 0;
}

.history-modal-list {
  overflow-y: auto;
  flex: 1;
  padding: 12px 14px 24px;
  -webkit-overflow-scrolling: touch;
}

/* Animaciones */
@keyframes sheetUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@keyframes backdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fabBounce {
  from { transform: scale(0.5); }
  to   { transform: scale(1); }
}

/* ── Light mode overrides modal + FAB ─────────────────── */
body.light-mode .history-modal-sheet {
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(245,247,250,0.92));
  border-color: rgba(30,50,80,0.15);
  box-shadow: 0 -8px 40px rgba(30,50,80,0.15), inset 1px 1px 0 rgba(255,255,255,0.8);
}

body.light-mode .history-modal-header {
  border-bottom-color: rgba(30,50,80,0.1);
}

body.light-mode .history-modal-header::before {
  background: rgba(30,50,80,0.2);
}

body.light-mode .history-modal-title {
  color: #0f2744;
}

body.light-mode .history-modal-close {
  background: rgba(30,50,80,0.06);
  border-color: rgba(30,50,80,0.12);
  color: rgba(15,39,68,0.7);
}

body.light-mode .history-modal-actions {
  border-bottom-color: rgba(30,50,80,0.08);
}

body.light-mode .history-fab {
  background: linear-gradient(135deg, #2f7ceb, #1e63d5);
  border-color: rgba(30,99,213,0.7);
  box-shadow: 0 8px 30px rgba(30,99,213,0.35), 0 4px 12px rgba(0,0,0,0.12);
}

.header-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.theme-toggle {
  min-width: 40px;
  min-height: 40px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 1.2rem;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Light Mode */
body.light-mode {
  --bg: #f5f7fa;
  --surface: rgba(30, 50, 80, 0.08);
  --surface-soft: rgba(30, 50, 80, 0.05);
  --text: #0a1428;
  --text-muted: rgba(10, 20, 40, 0.65);
  --line: rgba(30, 50, 80, 0.15);
  --primary: #2563eb;
  --primary-strong: #1e40af;
  --shadow-lg: 0 20px 50px rgba(30, 50, 80, 0.15);
  --shadow-md: 0 8px 24px rgba(30, 50, 80, 0.08);
  --shadow-soft: 0 4px 12px rgba(30, 50, 80, 0.05);
  --shadow-glow: 0 0 40px rgba(37, 99, 235, 0.12);

  background:
    radial-gradient(circle at 15% 20%, rgba(37, 99, 235, 0.08), transparent 40%),
    radial-gradient(circle at 85% 15%, rgba(59, 130, 246, 0.06), transparent 45%),
    radial-gradient(circle at 70% 85%, rgba(147, 197, 253, 0.05), transparent 50%),
    linear-gradient(135deg, #f9fafb 0%, #f3f4f6 30%, #f0f4f8 60%, #eff6ff 100%);
}

body.light-mode .card {
  background: rgba(30, 50, 80, 0.04);
  border: 1.5px solid rgba(30, 50, 80, 0.1);
  box-shadow: 0 8px 32px rgba(30, 50, 80, 0.08), inset 1px 1px 2px rgba(255, 255, 255, 0.5), 0 0 60px rgba(37, 99, 235, 0.05);
}

body.light-mode .card:hover {
  border-color: rgba(37, 99, 235, 0.25);
  box-shadow: 0 12px 48px rgba(30, 50, 80, 0.12), inset 1px 1px 3px rgba(255, 255, 255, 0.6), 0 0 80px rgba(37, 99, 235, 0.1);
}

body.light-mode .topbar {
  background: rgba(30, 50, 80, 0.04);
  border: 1.5px solid rgba(30, 50, 80, 0.1);
  box-shadow: 0 10px 40px rgba(30, 50, 80, 0.08), inset 1px 1px 2px rgba(255, 255, 255, 0.5), 0 0 80px rgba(37, 99, 235, 0.05);
}

body.light-mode .topbar::after {
  background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.5) 20%, rgba(59, 130, 246, 0.4) 50%, rgba(37, 99, 235, 0.5) 80%, transparent);
  opacity: 0.4;
}

body.light-mode input[type="text"] {
  border: 1.5px solid rgba(30, 50, 80, 0.1);
  background: rgba(30, 50, 80, 0.03);
  color: #0a1428;
}

body.light-mode input[type="text"]::placeholder {
  color: rgba(10, 20, 40, 0.4);
}

body.light-mode input[type="text"]:focus {
  border-color: rgba(37, 99, 235, 0.4);
  background: rgba(30, 50, 80, 0.05);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1), inset 0 1px 2px rgba(255, 255, 255, 0.4), 0 0 30px rgba(37, 99, 235, 0.1);
}

body.light-mode .status {
  background: rgba(30, 50, 80, 0.05);
  border: 1px solid rgba(30, 50, 80, 0.12);
  color: #0a1428;
}

body.light-mode .peer-item,
body.light-mode .request-item,
body.light-mode .transfer-item {
  border: 1.5px solid rgba(30, 50, 80, 0.1);
  background: rgba(30, 50, 80, 0.03);
  color: #0a1428;
}

body.light-mode .theme-toggle {
  color: #0a1428;
}

body.light-mode {
  color: #12223a;
}

body.light-mode .topbar h1,
body.light-mode h2,
body.light-mode h3 {
  color: #0f2744;
}

body.light-mode .tagline,
body.light-mode .muted,
body.light-mode .peer-meta,
body.light-mode .transfer-meta-row,
body.light-mode .request-copy {
  color: rgba(14, 34, 58, 0.76);
}

body.light-mode .experience-switch .btn-secondary {
  background: rgba(255, 255, 255, 0.9);
}

body.light-mode .join-link-row,
body.light-mode .empty,
body.light-mode .drop-zone,
body.light-mode .file-field input[type="file"],
body.light-mode .pair-qr-wrap {
  color: #163151;
  background: rgba(255, 255, 255, 0.66);
  border-color: rgba(26, 64, 106, 0.2);
}

body.light-mode .join-link-row:hover,
body.light-mode .drop-zone:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(37, 99, 235, 0.32);
}

body.light-mode .btn-primary {
  color: #ffffff;
  background: linear-gradient(135deg, #2f7ceb, #1e63d5);
  border-color: rgba(30, 99, 213, 0.75);
  box-shadow: 0 8px 24px rgba(30, 99, 213, 0.28);
}

body.light-mode .btn-secondary {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(20, 52, 88, 0.2);
  color: #12345a;
}

body.light-mode .btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(30, 99, 213, 0.42);
}

body.light-mode .btn.is-selected,
body.light-mode .peer-item.selected {
  color: #ffffff;
  background: linear-gradient(135deg, #2f7ceb, #1e63d5);
  border-color: rgba(30, 99, 213, 0.85);
  box-shadow: 0 10px 26px rgba(30, 99, 213, 0.3);
}

/* Light mode overrides para el switch iOS y incoming toast */
body.light-mode .experience-switch {
  background: rgba(0, 0, 0, 0.06);
}

body.light-mode .experience-switch .btn {
  color: rgba(0, 0, 0, 0.5);
}

body.light-mode .experience-switch .btn.btn-primary {
  color: #000;
}

body.light-mode .experience-switch::before {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

body.light-mode .incoming-card.has-requests {
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 16px 48px rgba(30, 50, 80, 0.2), 0 0 0 1px rgba(37, 99, 235, 0.3);
}

body.light-mode .status-online {
  color: #0c8b4b;
  background: rgba(19, 164, 86, 0.14);
  border-color: rgba(19, 164, 86, 0.35);
}

body.light-mode .status-offline {
  color: #c02838;
  background: rgba(220, 58, 77, 0.14);
  border-color: rgba(220, 58, 77, 0.35);
}

body.light-mode .state-pill-info,
body.light-mode .state-pill-success,
body.light-mode .state-pill-warn,
body.light-mode .state-pill-danger {
  color: #102946;
}

body.light-mode .progress-track {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.24);
}

body.light-mode .progress-fill {
  background: linear-gradient(135deg, #2f7ceb, #1e63d5);
  box-shadow: 0 0 10px rgba(30, 99, 213, 0.28);
}

body.light-mode .toast {
  background: rgba(255, 255, 255, 0.92);
  color: #0f2744;
  border-color: rgba(30, 99, 213, 0.24);
  box-shadow: 0 10px 24px rgba(16, 39, 68, 0.16);
}
