/* ===== Ping v0.1 · estilos ===== */
:root {
  /* Tema Apple (por defecto) */
  --wall: linear-gradient(160deg, #dfe7f1 0%, #eadfe8 55%, #f3e6d8 100%);
  --bg: rgba(250, 250, 252, .9);
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --border: rgba(0, 0, 0, .09);
  --soft: rgba(0, 0, 0, .05);
  --accent: #0a6cff;
  --accent-ink: #ffffff;
  --me-bg: #0a6cff;
  --me-fg: #ffffff;
  --ok: #2a7a45;
  --ok-bg: rgba(48, 180, 90, .12);
  --buzz: #b25e00;
  --buzz-bg: rgba(255, 159, 10, .15);
  --danger: #d1302b;
  --warn: #c4471d;
  --av-r: 50%;
  --panel-r: 22px;
  --font-ui: -apple-system, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  --font-head: var(--font-ui);
  --font-detail: var(--font-ui);
  --shadow: 0 24px 60px rgba(30, 30, 60, .22);
}
html[data-skin="labs"] {
  --wall: #07090d radial-gradient(rgba(61, 245, 201, .07) 1px, transparent 1px) 0 0 / 22px 22px;
  --bg: #0e1219;
  --surface: #151b25;
  --text: #e6edf3;
  --muted: #8b97a3;
  --border: rgba(61, 245, 201, .18);
  --soft: rgba(255, 255, 255, .06);
  --accent: #3df5c9;
  --accent-ink: #03140f;
  --me-bg: rgba(61, 245, 201, .14);
  --me-fg: #d6fff3;
  --ok: #3df5c9;
  --ok-bg: rgba(61, 245, 201, .08);
  --buzz: #ff8ae3;
  --buzz-bg: rgba(255, 79, 216, .12);
  --danger: #ff6b6b;
  --warn: #ffb020;
  --av-r: 14px;
  --panel-r: 18px;
  --font-ui: Inter, "Segoe UI", Roboto, system-ui, sans-serif;
  --font-head: "Space Grotesk", Inter, sans-serif;
  --font-detail: "JetBrains Mono", ui-monospace, monospace;
  --shadow: 0 30px 70px rgba(0, 0, 0, .6), 0 0 40px rgba(61, 245, 201, .08);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--wall); color: var(--text); font-family: var(--font-ui); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.error { color: var(--danger); }

.shell { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.panel { position: relative; width: 100%; max-width: 440px; height: min(780px, calc(100dvh - 32px)); background: var(--bg); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); border: 1px solid var(--border); border-radius: var(--panel-r); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
@media (max-width: 520px) {
  .shell { padding: 0; }
  .panel { max-width: none; height: 100dvh; border-radius: 0; border: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
}
.view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.center { margin: auto; width: 100%; max-width: 320px; padding: 24px 20px; display: flex; flex-direction: column; gap: 10px; text-align: center; }
.center h1 { margin: 0; font-family: var(--font-head); font-size: 26px; letter-spacing: -.4px; }
.center p { margin: 0; }
.logo { width: 64px; height: 64px; margin: 0 auto 6px; border-radius: 18px; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; }
.stack { display: flex; flex-direction: column; gap: 8px; text-align: left; }
label, legend { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.hint { font-size: 11.5px; color: var(--muted); margin-top: -4px; }
input[type="text"], input[type="email"], input:not([type]) { height: 44px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); padding: 0 14px; outline: none; font-size: 15px; }
html[data-skin="labs"] input { background: #070a0e; font-family: var(--font-detail); font-size: 13.5px; border-radius: 10px; }
.btn { min-height: 44px; border-radius: 12px; border: 0; background: var(--soft); font-weight: 600; font-size: 14.5px; padding: 0 16px; }
.btn.pri { background: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .55; cursor: default; }
.btns { display: flex; gap: 8px; }
.btns .btn { flex: 1; }

/* Encabezado */
.ph { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.ph .t { font-family: var(--font-head); font-size: 18px; font-weight: 700; letter-spacing: -.3px; display: flex; align-items: baseline; gap: 8px; }
.ph small { font-family: var(--font-detail); font-size: 11.5px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.hbtns { display: flex; gap: 6px; }
.iconbtn { position: relative; width: 36px; height: 36px; border: 0; border-radius: 10px; background: var(--soft); display: flex; align-items: center; justify-content: center; }
.badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #ff3b30; color: #fff; font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid var(--bg); }
html[data-skin="labs"] .badge { background: #ff4fd8; color: #1a0016; border-radius: 5px; }

/* Contactos */
.contacts { display: flex; gap: 12px; padding: 6px 16px 12px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.ct { border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--muted); font-size: 11.5px; font-weight: 500; min-width: 54px; max-width: 64px; }
.ct span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 64px; }
.av { position: relative; width: 50px; height: 50px; border-radius: var(--av-r); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 18px; flex-shrink: 0; }
html[data-skin="labs"] .av { background: #1a1f2a !important; border: 1px solid rgba(255, 255, 255, .1); font-family: var(--font-head); font-weight: 700; }
.ct.sel { color: var(--text); font-weight: 600; }
.ct.sel .av { box-shadow: 0 0 0 2.5px var(--bg), 0 0 0 5px var(--accent); }
html[data-skin="labs"] .ct.sel .av { border-color: var(--accent); box-shadow: 0 0 16px rgba(61, 245, 201, .45); }
.dot { position: absolute; right: -1px; bottom: -1px; width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid var(--bg); background: #aeaeb2; }
.dot.on { background: #30b45a; }
html[data-skin="labs"] .dot { border-radius: 4px; }
html[data-skin="labs"] .dot.on { background: #3df5c9; }
.ct .badge { top: -4px; right: -4px; }
.ct.add .av { background: transparent !important; border: 1.5px dashed var(--muted); color: var(--muted); }

.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 16px; font-size: 13px; color: var(--muted); }
.bar b { color: var(--text); }
.lock { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ok); background: var(--ok-bg); padding: 4px 9px; border-radius: 20px; font-family: var(--font-detail); white-space: nowrap; }

/* Feed */
.feed { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 16px 12px; display: flex; flex-direction: column; gap: 9px; }
.empty { margin: auto; text-align: center; color: var(--muted); font-size: 13.5px; max-width: 260px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.msg { max-width: 80%; padding: 9px 13px; font-size: 14px; line-height: 1.4; border-radius: 18px; overflow-wrap: anywhere; white-space: pre-wrap; }
.msg.them { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.msg.me { align-self: flex-end; background: var(--me-bg); color: var(--me-fg); border-bottom-right-radius: 6px; }
html[data-skin="labs"] .msg.me { border: 1px solid rgba(61, 245, 201, .35); }
.time { font-size: 10.5px; color: var(--muted); font-family: var(--font-detail); }
.time.me { align-self: flex-end; margin-top: -5px; }
.time.them { align-self: flex-start; margin-top: -5px; }
.sys { align-self: center; font-size: 11.5px; color: var(--muted); font-family: var(--font-detail); text-align: center; }
.pill { display: flex; align-items: center; gap: 7px; background: var(--buzz-bg); color: var(--buzz); padding: 7px 12px; border-radius: 14px; font-size: 12.5px; font-weight: 600; }
.pill.me { align-self: flex-end; } .pill.them { align-self: flex-start; }
.file { width: 270px; max-width: 88%; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 9px; }
.file.me { align-self: flex-end; } .file.them { align-self: flex-start; }
.frow { display: flex; gap: 10px; align-items: center; }
.ext { width: 38px; height: 46px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); font: 700 9.5px var(--font-detail); display: flex; align-items: flex-end; justify-content: center; padding-bottom: 5px; flex-shrink: 0; text-transform: uppercase; }
.fmeta { flex: 1; min-width: 0; }
.fname { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fsub { font-size: 11.5px; color: var(--muted); margin-top: 2px; font-family: var(--font-detail); }
.warn { font-size: 11.5px; color: var(--warn); font-weight: 500; }
.ring { flex-shrink: 0; }
.dl { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 13.5px; text-decoration: none; }

/* Composer */
.composer { padding: 9px 12px 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 7px; }
.tools { display: flex; gap: 2px; align-items: center; }
.tool { width: 38px; height: 38px; border: 0; border-radius: 9px; background: transparent; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.tool:hover { background: var(--soft); }
.zbtn { margin-left: auto; height: 38px; border: 0; border-radius: 9px; background: var(--buzz-bg); color: var(--buzz); font-weight: 600; font-size: 12.5px; padding: 0 12px; display: flex; align-items: center; gap: 6px; }
html[data-skin="labs"] .zbtn { font-family: var(--font-detail); border: 1px solid rgba(255, 79, 216, .45); }
.inrow { display: flex; gap: 8px; align-items: center; }
.inrow input { flex: 1; min-width: 0; border-radius: 22px; }
.send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
html[data-skin="labs"] .send { border-radius: 10px; box-shadow: 0 0 16px rgba(61, 245, 201, .45); }
.composer.disabled { opacity: .5; pointer-events: none; }

/* Arrastrar y zumbido */
.panel.dragging::after { content: "Suelta para enviar"; position: absolute; inset: 8px; border: 2px dashed var(--accent); border-radius: 16px; background: color-mix(in srgb, var(--bg) 85%, transparent); display: flex; align-items: center; justify-content: center; font-weight: 600; color: var(--accent); z-index: 5; pointer-events: none; }
.panel.shake { animation: shake .6s ease-in-out; }
@keyframes shake { 0%,100% { transform: translateX(0); } 15%,55% { transform: translateX(-7px) rotate(-.7deg); } 35%,75% { transform: translateX(7px) rotate(.7deg); } }
@media (prefers-reduced-motion: reduce) { .panel.shake { animation: none; outline: 3px solid var(--buzz); } }

/* Diálogos */
dialog { border: 1px solid var(--border); border-radius: 18px; background: var(--bg); color: var(--text); padding: 20px; width: min(380px, calc(100vw - 32px)); box-shadow: var(--shadow); }
html[data-skin="apple"] dialog, html:not([data-skin]) dialog { background: #fafafc; }
dialog::backdrop { background: rgba(0, 0, 0, .35); backdrop-filter: blur(3px); }
dialog h2 { margin: 0 0 4px; font-family: var(--font-head); font-size: 19px; }
.req { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.req .av { width: 40px; height: 40px; font-size: 15px; }
.req .info { flex: 1; min-width: 0; font-size: 13.5px; }
.req .info small { display: block; color: var(--muted); font-family: var(--font-detail); font-size: 11.5px; }
.req .btn { min-height: 36px; padding: 0 12px; font-size: 13px; }
.seg-field { border: 0; padding: 0; margin: 0; }
.seg { display: flex; gap: 4px; background: var(--soft); border-radius: 12px; padding: 4px; margin-top: 6px; }
.seg button { flex: 1; min-height: 38px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

.toast { position: fixed; left: 50%; top: max(16px, env(safe-area-inset-top)); transform: translateX(-50%); background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(0, 0, 0, .2); padding: 10px 16px; border-radius: 12px; font-size: 13.5px; font-weight: 500; z-index: 100; max-width: calc(100vw - 32px); }

/* v0.1.1 */
.req { flex-wrap: wrap; }
.req .info { flex: 1 1 150px; }
.req .actions { display: flex; gap: 8px; margin-left: auto; }
@media (max-width: 420px) { .req .actions { flex: 1 1 100%; } .req .actions .btn { flex: 1; } }
.confirm-box { margin: 0; padding: 12px; border-radius: 12px; background: var(--soft); text-align: center; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.code-input { text-align: center; font-size: 24px !important; letter-spacing: 8px; font-family: var(--font-detail); }
.linkbtn { border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 13.5px; padding: 6px; }

/* v0.1.2 */
.who { border: 0; background: none; padding: 4px 6px; margin-left: -6px; border-radius: 8px; font-size: 13px; color: var(--muted); text-align: left; min-height: 32px; }
.who:hover { background: var(--soft); }
.who .chev { font-size: 15px; margin-left: 2px; }
.newtag { position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%); background: #ff9f0a; color: #3d2200; font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 6px; border: 2px solid var(--bg); letter-spacing: .2px; }
html[data-skin="labs"] .newtag { background: #ffb020; border-radius: 4px; }
.newwarn { align-self: stretch; background: var(--buzz-bg); color: var(--text); border-radius: 12px; padding: 10px 12px; font-size: 12.5px; line-height: 1.45; }
.newwarn b { color: var(--buzz); }
.thumb { display: block; width: 100%; max-height: 220px; object-fit: cover; border-radius: 10px; background: var(--soft); }
.btn.slim { min-height: 34px; font-size: 13px; padding: 0 12px; }
.file .btn.slim { align-self: flex-start; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--soft); cursor: pointer; }
.switch span { display: flex; flex-direction: column; gap: 2px; color: var(--text); font-size: 14px; font-weight: 600; }
.switch small { font-weight: 400; color: var(--muted); font-size: 12px; }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); flex-shrink: 0; }
.snd-rows { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.snd-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.snd-row label { color: var(--text); font-size: 13.5px; }
.snd-row select { height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); padding: 0 8px; font-size: 14px; min-width: 0; }
.snd-name { grid-column: 2 / -1; font-size: 11.5px; color: var(--muted); margin-top: -4px; overflow-wrap: anywhere; }
.snd-name .linkbtn { padding: 0 4px; font-size: 11.5px; }
.vol-label { display: block; margin-top: 4px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
dialog { max-height: calc(100dvh - 32px); overflow-y: auto; }
.contact-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.contact-head h2 { margin: 0; }
.contact-head p { margin: 2px 0 0; }
.av.big { width: 56px; height: 56px; font-size: 22px; }
.newtxt { color: var(--buzz); }

/* v0.1.3 · sonidos propios */
.snd-custom { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0 4px; border-bottom: 1px solid var(--border); }
.snd-custom .snd-name { grid-column: auto; margin: 0; flex: 1; min-width: 0; }
.btn.pulse { box-shadow: 0 0 0 3px var(--accent); }
label.lbtn { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text); -webkit-user-select: none; user-select: none; }
