/* Enviar · PWA. Mobile-first: base para 360–390 px y se escala con min-width. */
@font-face { font-family: "Inter"; src: url("../fonts/inter-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/inter-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Bricolage Grotesque"; src: url("../fonts/bricolage-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Bricolage Grotesque"; src: url("../fonts/bricolage-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --mandarina: #FF6A3D;
  --tinta: #16130F;
  --papel: #F6F3EE;
  --tarjeta: #FFFFFF;
  --borde: #E7E2DA;
  --oxido: #B93C12;
  --sec: #57534E;
  --sel: #FFF1EB;
  --lan-fg: #115E59; --lan-bg: #CCFBF1;
  --net-fg: #5B21B6; --net-bg: #EDE9FE;
  --off-fg: #44403C; --off-bg: #F1ECE4;
  --radio: 0.875rem;
  --kb: 0px;
  --dock-h: 9.5rem;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--papel);
  color: var(--tinta);
  font: 400 1rem/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}
img, video, canvas, svg { max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.copy-buffer { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; font-size: 16px; }

.app { min-height: 100dvh; display: flex; flex-direction: column; width: 100%; max-width: 100%; }

/* Encabezado */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: calc(0.75rem + var(--safe-t)) 1rem 0.75rem;
  background: var(--papel);
  border-bottom: 1px solid var(--borde);
}
.brand { display: flex; align-items: center; gap: 0.625rem; min-width: 0; }
.logo {
  width: 2.25rem; height: 2.25rem; flex: none;
  display: grid; place-items: center;
  background: var(--mandarina); color: var(--tinta); border-radius: 0.625rem;
}
.logo svg { width: 1.5rem; height: 1.5rem; }
.brand-name { font: 700 1.375rem/1.2 "Bricolage Grotesque", "Inter", sans-serif; letter-spacing: -0.01em; }

/* Estados */
.pill {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.25rem 0.625rem; border-radius: 999px;
  font-size: 0.875rem; font-weight: 500; line-height: 1.4; white-space: nowrap;
}
.pill.lan { color: var(--lan-fg); background: var(--lan-bg); }
.pill.net { color: var(--net-fg); background: var(--net-bg); }
.pill.off { color: var(--off-fg); background: var(--off-bg); }

/* Contenido */
main {
  flex: 1; width: 100%; max-width: 100%;
  padding: 1rem 1rem calc(var(--dock-h) + var(--safe-b) + 1rem);
}
.view > * + * { margin-top: 1rem; }
h1, h2, h3 { font-family: "Bricolage Grotesque", "Inter", sans-serif; font-weight: 700; line-height: 1.25; margin: 0; }
h2.title { font-size: 1.5rem; }
.label { display: block; font: 600 0.9375rem/1.4 "Inter", sans-serif; color: var(--sec); margin: 0 0 0.5rem; }
p { margin: 0; }
.muted { color: var(--sec); }
.note {
  background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 0.75rem 1rem; color: var(--sec);
}
.warn { color: var(--oxido); }
a { color: var(--oxido); }

.card {
  background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 1rem;
}
.stack > * + * { margin-top: 0.75rem; }

/* Destinos */
.targets { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
.target {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  width: 100%; min-height: 4rem; padding: 0.75rem 1rem;
  background: var(--tarjeta); border: 2px solid var(--borde); border-radius: var(--radio);
  text-align: left; cursor: pointer;
}
.target[aria-pressed="true"] { border-color: var(--tinta); background: var(--sel); }
.target .name { font-weight: 600; font-size: 1.0625rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.target .kind { display: block; font-size: 0.875rem; color: var(--sec); font-weight: 400; }
.target .who { min-width: 0; }

/* Formularios */
textarea, input[type="text"], input[type="tel"], input[type="url"], input[type="email"], input[type="number"] {
  display: block; width: 100%; min-height: 3rem;
  padding: 0.75rem 0.875rem;
  font-size: 1rem; line-height: 1.5;
  background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio);
  outline: none;
}
textarea { resize: vertical; min-height: 6rem; }
textarea:focus, input:focus { border-color: var(--tinta); box-shadow: 0 0 0 2px var(--sel); }
.code-input { font-size: 1.5rem !important; letter-spacing: 0.3em; text-align: center; font-variant-numeric: tabular-nums; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 3rem; min-width: 3rem; padding: 0.625rem 1.125rem;
  border-radius: var(--radio); border: 2px solid var(--borde);
  background: var(--tarjeta); color: var(--tinta);
  font-weight: 600; font-size: 1rem; line-height: 1.25;
  cursor: pointer; text-decoration: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 1.25rem; height: 1.25rem; flex: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: default; }
/* Regla de identidad: el botón mandarina lleva texto en tinta, nunca en blanco. */
.btn.primary { background: var(--mandarina); border-color: var(--mandarina); color: var(--tinta); }
.btn.big { width: 100%; min-height: 3.5rem; font-size: 1.0625rem; }
.btn.danger { color: var(--oxido); }
.btn.link { border-color: transparent; background: transparent; color: var(--oxido); padding-inline: 0.5rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.row > .btn { flex: 1 1 8rem; }

/* Adjuntos */
.attach { display: grid; gap: 0.5rem; }
.chip {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  padding: 0.5rem 0.5rem 0.5rem 0.875rem; background: var(--tarjeta);
  border: 1px solid var(--borde); border-radius: var(--radio); min-width: 0;
}
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: 0.5rem; }
.preview img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 0.625rem; border: 1px solid var(--borde); }

/* Recibidos */
.inbox { display: grid; gap: 0.75rem; }
.item { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem; min-width: 0; }
.item-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.type { font-weight: 600; }
.meta { color: var(--sec); font-size: 0.9375rem; }
.body { margin: 0.5rem 0 0.75rem; overflow-wrap: anywhere; word-break: break-word; }
.body img { display: block; width: 100%; max-height: 50vh; object-fit: contain; border-radius: 0.625rem; background: var(--papel); }
.body a, .link-text { overflow-wrap: anywhere; }
.link-text { color: var(--oxido); }
.badge-e2e { font-size: 0.8125rem; color: var(--oxido); }
.empty { text-align: center; padding: 2rem 1rem; color: var(--sec); }

/* Dispositivos */
.dev { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.dev .who { min-width: 0; flex: 1 1 10rem; }
.dev .name { font-weight: 600; overflow-wrap: anywhere; }
.fp { font-variant-numeric: tabular-nums; color: var(--sec); font-size: 0.875rem; }
.bigcode { font: 700 2.25rem/1.2 "Bricolage Grotesque", sans-serif; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }
video.scan { width: 100%; border-radius: var(--radio); background: #000; aspect-ratio: 1; object-fit: cover; }

/* Barra inferior (al alcance del pulgar) */
.dock {
  position: fixed; left: 0; right: 0; bottom: var(--kb); z-index: 10;
  background: var(--papel); border-top: 1px solid var(--borde);
  padding: 0.75rem 1rem calc(0.5rem + var(--safe-b));
}
.dock .btn.primary { margin-bottom: 0.625rem; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.tab {
  position: relative; min-height: 3.25rem; padding: 0.375rem 0.25rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.125rem;
  border: 0; border-radius: 0.75rem; background: transparent; color: var(--sec);
  font-size: 0.875rem; font-weight: 500; cursor: pointer;
}
.tab svg { width: 1.375rem; height: 1.375rem; }
.tab[aria-current="page"] { color: var(--tinta); background: var(--sel); font-weight: 600; }
.badge {
  position: absolute; top: 0.25rem; left: calc(50% + 0.5rem);
  min-width: 1.25rem; height: 1.25rem; padding: 0 0.3rem; border-radius: 999px;
  background: var(--mandarina); color: var(--tinta); font-size: 0.75rem; font-weight: 700; line-height: 1.25rem; text-align: center;
}
.dock.no-primary .btn.primary { display: none; }

/* Aviso flotante */
.toast {
  position: fixed; left: 1rem; right: 1rem; z-index: 20;
  bottom: calc(var(--kb) + var(--dock-h) + var(--safe-b) + 0.5rem);
  padding: 0.875rem 1rem; border-radius: var(--radio);
  background: var(--tinta); color: var(--papel); font-weight: 500;
}

/* Pantallas más anchas */
@media (min-width: 30rem) {
  .targets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 48rem) {
  main, .dock > * { max-width: 46rem; margin-inline: auto; }
  .top { padding-inline: max(1rem, calc((100% - 46rem) / 2)); }
  .targets { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* Horizontal en el celular: poca altura, la barra se compacta. */
@media (orientation: landscape) and (max-height: 32rem) {
  :root { --dock-h: 7.25rem; }
  .tab { flex-direction: row; min-height: 3rem; gap: 0.375rem; }
  .dock .btn.primary { margin-bottom: 0.5rem; min-height: 3rem; }
  .top { position: static; }
}

/* Página del Atajo */
.atajo { padding: 1rem 1rem calc(2rem + var(--safe-b)); }
.atajo .brand { text-decoration: none; color: inherit; }
.steps { margin: 0; padding-left: 1.25rem; }
.steps li + li { margin-top: 0.5rem; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--papel); padding: 0.1rem 0.3rem; border-radius: 0.3rem; overflow-wrap: anywhere; }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
