/* ── netmind person web · hyper-modern dark ─────────────────────────── */

:root {
  --bg: #07070c;
  --bg-2: #0c0c14;
  --panel: rgba(255, 255, 255, .045);
  --panel-2: rgba(255, 255, 255, .07);
  --stroke: rgba(255, 255, 255, .09);
  --stroke-2: rgba(255, 255, 255, .16);
  --text: #f2f2f8;
  --text-2: #a2a3b5;
  --text-3: #6d6e82;
  --acc: #8b5cf6;      /* violet */
  --acc-2: #22d3ee;    /* cyan */
  --acc-3: #f472b6;    /* pink */
  --grad: linear-gradient(135deg, var(--acc), var(--acc-2));
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 11px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .5);
  --font: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: var(--text); }
img { display: block; }

#app { display: flex; height: 100dvh; }

/* ══ Sidebar ══ */
#sidebar {
  width: 300px;
  min-width: 300px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border-right: 1px solid var(--stroke);
  z-index: 40;
}
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 18px 12px;
}
.brand {
  font-weight: 800; font-size: 17px; letter-spacing: .4px;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  display: flex; align-items: center; gap: 8px;
}
.brand-glyph { -webkit-text-fill-color: initial; color: var(--acc-2); font-size: 15px; }

.new-persona {
  margin: 4px 14px 10px;
  padding: 13px 16px;
  display: flex; align-items: center; gap: 10px;
  background: var(--grad);
  border-radius: var(--r-md);
  font-weight: 650; font-size: 14.5px; color: #fff;
  box-shadow: 0 8px 24px rgba(139, 92, 246, .35);
  transition: transform .15s ease, box-shadow .2s ease;
}
.new-persona:hover { transform: translateY(-1px); box-shadow: 0 10px 30px rgba(139, 92, 246, .5); }
.new-persona:active { transform: translateY(0); }
.np-plus { font-size: 17px; font-weight: 700; }

.home-item {
  margin: 0 14px 4px;
  padding: 11px 14px;
  display: flex; align-items: center; gap: 10px;
  border-radius: var(--r-md);
  background: var(--panel);
  border: 1px solid var(--stroke);
  font-weight: 650; font-size: 14px; color: var(--text);
  transition: background .15s, border-color .15s;
}
.home-item:hover { background: var(--panel-2); border-color: var(--stroke-2); }
.side-sep {
  padding: 10px 22px 6px;
  font-size: 10.5px; letter-spacing: 1.4px; font-weight: 700;
  color: var(--text-3); text-transform: uppercase;
}

.persona-list { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.persona-list::-webkit-scrollbar { width: 4px; }
.persona-list::-webkit-scrollbar-thumb { background: var(--stroke-2); border-radius: 4px; }

.p-item {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  transition: background .15s ease;
  text-align: left;
  overflow: hidden;
}
.p-item:hover { background: var(--panel); }
.p-item.active { background: var(--panel-2); outline: 1px solid var(--stroke-2); }
.p-avatar {
  width: 44px; height: 44px; border-radius: 14px;
  object-fit: cover; background: linear-gradient(135deg, #2a2a3a, #1a1a28);
  outline: 1px solid var(--stroke);
  flex-shrink: 0;
}
.p-meta {
  min-width: 0; flex: 1;
  display: flex; flex-direction: column; gap: 1px;
}
.p-name {
  display: block; min-width: 0;
  font-weight: 650; font-size: 14.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.p-tag {
  display: block; min-width: 0;
  font-size: 12px; line-height: 1.35; color: var(--text-3);
  word-break: break-word; overflow-wrap: anywhere;
}

.side-foot {
  padding: 12px 18px;
  font-size: 11.5px; color: var(--text-3);
  border-top: 1px solid var(--stroke);
  display: flex; align-items: center; gap: 7px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 8px #34d399; }

/* ══ Main panes ══ */
#main { flex: 1; position: relative; min-width: 0; }
.pane { position: absolute; inset: 0; display: none; flex-direction: column; }
.pane.active { display: flex; }

/* ── Home ── */
#home { overflow-y: auto; }
.home-aurora {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(60% 50% at 15% 0%, rgba(139, 92, 246, .16), transparent 60%),
    radial-gradient(50% 40% at 90% 10%, rgba(34, 211, 238, .1), transparent 60%),
    radial-gradient(40% 40% at 60% 100%, rgba(244, 114, 182, .08), transparent 60%);
}
.home-inner { position: relative; z-index: 1; max-width: 860px; margin: 0 auto; padding: 48px 24px 60px; }
.home-title { font-size: clamp(30px, 5vw, 44px); font-weight: 750; letter-spacing: -.5px; }
.home-title em {
  font-style: normal; background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.home-sub { margin-top: 10px; color: var(--text-2); font-size: 15px; max-width: 480px; line-height: 1.5; }

.home-grid {
  margin-top: 34px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.h-card {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-2);
  outline: 1px solid var(--stroke);
  cursor: pointer;
  transition: transform .2s ease, outline-color .2s ease, box-shadow .25s ease;
  text-align: left;
}
.h-card:hover { transform: translateY(-3px); outline-color: var(--stroke-2); box-shadow: var(--shadow); }
.h-card img {
  width: 100%; aspect-ratio: 4/4.6; object-fit: cover;
  background: linear-gradient(135deg, #221f33, #14121f);
}
.h-card .h-ov {
  position: absolute; inset: auto 0 0 0;
  padding: 34px 14px 13px;
  background: linear-gradient(transparent, rgba(5, 5, 10, .92));
}
.h-card .h-name { display: block; font-weight: 700; font-size: 15.5px; }
.h-card .h-tag {
  display: block; word-break: break-word; overflow-wrap: anywhere;
  font-size: 12px; line-height: 1.35; color: var(--text-2); margin-top: 2px;
}
.h-empty {
  grid-column: 1/-1; padding: 40px; text-align: center;
  color: var(--text-3); border: 1px dashed var(--stroke-2); border-radius: var(--r-lg);
  font-size: 14px;
}

/* ── Chat head ── */
.chat-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: rgba(12, 12, 20, .75);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--stroke);
  z-index: 5;
}
.chat-avatar-wrap { padding: 0; border-radius: 50%; }
.chat-avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
  outline: 2px solid var(--stroke-2);
  background: linear-gradient(135deg, #2a2a3a, #1a1a28);
}
.chat-id { flex: 1; min-width: 0; }
.chat-name { font-weight: 700; font-size: 15.5px; }
.chat-sub { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); }
.presence-dot { width: 6px; height: 6px; border-radius: 50%; background: #34d399; }

.icon-btn {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px; color: var(--text-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

/* ── Chat scroll/log ── */
.chat-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth; }
.chat-log {
  max-width: 780px; margin: 0 auto;
  padding: 22px 16px 10px;
  display: flex; flex-direction: column; gap: 14px;
}

.msg { display: flex; gap: 10px; max-width: 86%; animation: rise .28s cubic-bezier(.2,.8,.3,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg.user { margin-left: auto; flex-direction: row-reverse; }
.msg-avatar {
  width: 30px; height: 30px; border-radius: 50%; object-fit: cover;
  margin-top: auto; flex-shrink: 0;
  outline: 1px solid var(--stroke);
  background: linear-gradient(135deg, #2a2a3a, #1a1a28);
}
.msg-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.bubble {
  padding: 11px 15px;
  border-radius: 18px;
  font-size: 14.8px; line-height: 1.55;
  white-space: pre-wrap; word-wrap: break-word;
}
.msg.user .bubble {
  background: var(--grad);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 6px 20px rgba(139, 92, 246, .25);
}
.msg.persona .bubble {
  background: var(--panel-2);
  border: 1px solid var(--stroke);
  border-bottom-left-radius: 6px;
}

/* media inline */
.media-card {
  border-radius: var(--r-lg); overflow: hidden;
  outline: 1px solid var(--stroke-2);
  background: var(--bg-2);
  max-width: 380px;
  box-shadow: var(--shadow);
}
.msg.user .media-card { align-self: flex-end; }
.media-card img, .media-card video { width: 100%; display: block; max-height: 480px; object-fit: cover; }
.media-card audio { width: 100%; display: block; padding: 10px 12px; margin: 0; }
.media-actions {
  display: flex; gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--stroke);
  background: rgba(10, 10, 18, .55);
}
.m-act {
  font-size: 12px; color: var(--text-2);
  padding: 6px 11px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--stroke);
  text-decoration: none; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.m-act:hover { color: var(--text); border-color: var(--stroke-2); }

/* typing indicator */
.typing { display: inline-flex; gap: 4px; padding: 14px 16px; align-items: center; }
.typing i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-3);
  animation: pulse 1.2s infinite ease-in-out;
}
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 70%, 100% { opacity: .3; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }

/* ── Composer ── */
.composer-wrap {
  position: relative;
  padding: 6px 14px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(7, 7, 12, .9) 30%);
}
.chips {
  max-width: 780px; margin: 0 auto 8px;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 2px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 7px 13px;
  font-size: 12.5px; color: var(--text-2);
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  transition: all .15s;
  white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: var(--stroke-2); background: var(--panel-2); }

.composer {
  max-width: 780px; margin: 0 auto;
  display: flex; align-items: flex-end; gap: 4px;
  background: var(--bg-2);
  border: 1px solid var(--stroke-2);
  border-radius: 24px;
  padding: 8px;
  transition: border-color .2s, box-shadow .2s;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .45);
}
.composer:focus-within { border-color: rgba(139, 92, 246, .6); box-shadow: 0 10px 40px rgba(0, 0, 0, .45), 0 0 0 3px rgba(139, 92, 246, .12); }
.composer textarea {
  flex: 1; resize: none; border: 0; outline: 0; background: none;
  max-height: 140px; min-height: 24px; line-height: 1.5;
  font-size: 15px; padding: 6px 2px;
}
.composer textarea::placeholder { color: var(--text-3); }
.attach, .mic {
  width: 40px; height: 40px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 17px;
  color: var(--text-2);
  transition: background .15s, color .15s;
}
.attach:hover, .mic:hover { background: var(--panel-2); color: var(--text); }
.mic.recording {
  background: rgba(248, 113, 113, .18); color: #f87171;
  animation: micPulse 1.2s infinite;
}
@keyframes micPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, .45); } 50% { box-shadow: 0 0 0 8px rgba(248, 113, 113, 0); } }

.attach-menu {
  position: absolute; bottom: calc(100% - 92px); left: 14px;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 190px;
  background: var(--bg-2); border: 1px solid var(--stroke-2);
  border-radius: 14px; padding: 6px;
  box-shadow: var(--shadow); z-index: 20;
}
.attach-menu[hidden] { display: none; }
.attach-menu button { text-align: left; padding: 10px 14px; border-radius: 10px; font-size: 14px; }
.attach-menu button:hover { background: var(--panel-2); }
.attach-preview {
  max-width: 780px; margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--panel); border: 1px solid var(--stroke);
  border-radius: 12px; padding: 8px 12px;
  font-size: 13px; color: var(--text-2);
}
.attach-preview[hidden] { display: none; }
.ap-thumb { flex-shrink: 0; display: flex; align-items: center; }
.ap-thumb img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; outline: 1px solid var(--stroke-2); }
.ap-thumb audio { height: 34px; max-width: 260px; }
.attach-preview button { color: var(--text-3); font-size: 14px; padding: 2px 6px; }
.attach-preview button:hover { color: #f87171; }

/* lightbox (ver media en grande) */
.lightbox {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  background: rgba(4, 4, 8, .9);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.lightbox[hidden] { display: none; }
.lb-body img, .lb-body video {
  max-width: 92vw; max-height: 82dvh;
  border-radius: 14px; outline: 1px solid var(--stroke-2);
  box-shadow: var(--shadow);
}
.lb-close {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); right: 16px;
  padding: 9px 16px; border-radius: 999px;
  background: rgba(20, 20, 32, .92); border: 1px solid var(--stroke-2);
  color: var(--text); font-size: 13.5px; z-index: 91;
}
.lb-close:hover { background: rgba(30, 30, 46, .95); }
.media-card.zoomable { cursor: zoom-in; }

/* crear: detalle colapsable de lo que ya sabe */
.spec-details { font-size: 13px; color: var(--text-2); }
.spec-details summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.spec-details .spec-preview { margin-top: 8px; }
.send {
  width: 40px; height: 40px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--grad); color: #fff;
  box-shadow: 0 4px 14px rgba(139, 92, 246, .4);
  transition: transform .15s, opacity .2s;
}
.send:hover { transform: scale(1.06); }
.send:disabled { opacity: .5; transform: none; cursor: default; }
.send.busy { animation: spinGrad 1s linear infinite; }
@keyframes spinGrad { to { transform: rotate(360deg); } }

/* ══ Modals ══ */
.modal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 4, 8, .72);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  padding: 18px;
}
.modal[hidden] { display: none; }
/* Author display rules (.modal-body, .field…) beat the UA's [hidden] rule —
   this restores hide-ability for every element that toggles the attribute. */
[hidden] { display: none !important; }
.modal-card {
  width: 100%; max-width: 520px; max-height: 88dvh; overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--stroke-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  animation: pop .25s cubic-bezier(.2,.8,.3,1) both;
}
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(10px); } to { opacity: 1; transform: none; } }
.modal-card.small { max-width: 380px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 0;
}
.modal-head h2 { font-size: 18px; font-weight: 700; }
.modal-body { padding: 16px 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-hint { font-size: 13px; color: var(--text-2); line-height: 1.5; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.field > span { font-weight: 600; color: var(--text-2); font-size: 12.5px; }
.field input, .field textarea {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--r-sm);
  padding: 11px 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.field textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
.field input:focus, .field textarea:focus {
  border-color: rgba(139, 92, 246, .55);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, .1);
}
.field-hint { font-size: 11.5px; color: var(--text-3); line-height: 1.45; }
.row { display: flex; gap: 8px; }
.row input { flex: 1; }
.wide { width: 100%; }

.btn {
  padding: 11px 18px;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  border: 1px solid var(--stroke);
  font-weight: 600; font-size: 14px;
  transition: all .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { border-color: var(--stroke-2); background: rgba(255,255,255,.1); }
.btn.primary {
  background: var(--grad); border: 0; color: #fff;
  box-shadow: 0 6px 20px rgba(139, 92, 246, .3);
}
.btn.primary:hover { box-shadow: 0 8px 26px rgba(139, 92, 246, .45); }
.btn.full { width: 100%; }
.btn.danger {
  background: rgba(248, 113, 113, .12);
  border-color: rgba(248, 113, 113, .35); color: #f87171;
}
.btn.danger:hover { background: rgba(248, 113, 113, .22); }
.btn-loader {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: spinGrad .7s linear infinite;
  display: inline-block;
}
.btn-loader[hidden] { display: none; }
.form-err { font-size: 13px; color: #f87171; line-height: 1.4; }

.spec-preview {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: var(--r-md);
  padding: 14px;
  font-size: 12.8px; line-height: 1.55; color: var(--text-2);
  white-space: pre-wrap;
  max-height: 200px; overflow-y: auto;
}

.missing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .missing-grid { grid-template-columns: 1fr; } }
.missing-grid .field.is-missing input { border-color: var(--amber, #f5a623); }
.missing-grid .miss-tag { font-style: normal; font-size: 10px; font-weight: 700; color: var(--amber, #f5a623); text-transform: uppercase; letter-spacing: 0.4px; margin-left: 4px; }

.voice-wrap { display: flex; flex-direction: column; gap: 8px; }
.voice-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-2); }
.voice-list { display: flex; flex-direction: column; gap: 8px; }
.vp-card { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line, rgba(255,255,255,0.09)); border-radius: 12px; cursor: pointer; }
.vp-card:hover { border-color: rgba(255,255,255,0.22); }
.vp-card:has(input:checked) { border-color: var(--accent, #8b5cf6); background: color-mix(in srgb, var(--accent, #8b5cf6) 10%, transparent); }
.vp-card input { accent-color: var(--accent, #8b5cf6); }
.vp-play { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; border: 1px solid var(--line, rgba(255,255,255,0.14)); background: rgba(255,255,255,0.06); color: var(--text-1, #fff); font-size: 12px; cursor: pointer; }
.vp-play:hover { background: rgba(255,255,255,0.14); }
.vp-dot { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--accent, #8b5cf6) 22%, transparent); color: var(--accent-2, #c4b5fd); font-size: 13px; }
.vp-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vp-info b { font-size: 13px; }
.vp-info small { font-size: 11.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.knowledge-list { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; }
.k-item {
  font-size: 12.5px; color: var(--text-2); line-height: 1.45;
  background: var(--panel); border-radius: var(--r-sm); padding: 8px 11px;
}
.k-item b { color: var(--text); font-weight: 650; }
.k-empty { font-size: 12.5px; color: var(--text-3); }

.danger-zone { border-top: 1px solid var(--stroke); padding-top: 14px; margin-top: 4px; }

/* ══ Toast ══ */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: rgba(20, 20, 32, .95);
  border: 1px solid var(--stroke-2);
  color: var(--text); font-size: 13.5px;
  padding: 11px 18px; border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 100;
  animation: rise .25s ease both;
  max-width: 86vw; text-align: center;
}

/* scrim + responsive */
#scrim { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .25s; }
.only-mobile { display: none !important; }

@media (max-width: 860px) {
  .only-mobile { display: inline-flex !important; }
  #sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-102%);
    transition: transform .28s cubic-bezier(.2,.8,.3,1);
    box-shadow: var(--shadow);
    padding-top: env(safe-area-inset-top);
  }
  #sidebar.open { transform: none; }
  #scrim.on { opacity: 1; pointer-events: auto; }
  .home-inner { padding-top: 30px; }
  .home-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .msg { max-width: 92%; }
  .media-card { max-width: 100%; }
  .media-card img, .media-card video { max-height: 380px; }
  .chat-head { padding-left: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
/* ══ Auth (login / registro / recuperar) ══ */
.auth-screen {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  background: radial-gradient(1200px 700px at 70% -10%, rgba(139,92,246,.16), transparent 60%),
              radial-gradient(900px 600px at 0% 100%, rgba(236,72,153,.12), transparent 55%),
              #07070c;
  padding: 20px;
}
.auth-card {
  width: 100%; max-width: 380px;
  padding: 30px 28px 22px;
  border-radius: 22px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  animation: authIn .35s cubic-bezier(.2,.8,.3,1);
}
@keyframes authIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.auth-brand { font-size: 22px; font-weight: 700; letter-spacing: .3px; }
.auth-brand .brand-glyph { color: var(--accent, #8b5cf6); margin-right: 4px; }
.auth-sub { margin: 6px 0 18px; font-size: 12.5px; color: var(--text-3); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-nav { display: flex; justify-content: space-between; margin-top: 16px; }
.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  font-size: 12.5px; color: var(--text-3); text-decoration: underline;
  text-underline-offset: 3px;
}
.link-btn:hover { color: var(--text-1, #fff); }
.auth-msg {
  margin: 0 0 14px; padding: 10px 12px; border-radius: 10px;
  font-size: 12.5px; line-height: 1.45;
  background: rgba(229,72,77,.12); border: 1px solid rgba(229,72,77,.35);
  color: #ff8a8d; word-break: break-word;
}
.auth-msg.ok {
  background: rgba(70,167,88,.12); border-color: rgba(70,167,88,.35); color: #7ed992;
}
.whoami { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn {
  background: none; border: 0; padding: 2px 4px; cursor: pointer;
  font-size: 11.5px; color: var(--text-3);
}
.logout-btn:hover { color: #ff8a8d; }
