/* Sistema de caja - paleta AdminPOS (slate oscuro + verde esmeralda), compacto y mobile-first */
:root {
  --shell-950: #020617;
  --surface-900: #0f172a;
  --raised-800: #1e293b;
  --edge-700: #334155;
  --muted-400: #94a3b8;
  --ink-100: #f1f5f9;
  --kasi: #10b981;
  --kasi-600: #059669;
  --kasi-400: #34d399;
  --leido: #67e8f9;
  --peligro: #f87171;
  --r-lg: 8px;
  --r-xl: 12px;
  --r-2xl: 16px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--shell-950);
  color: var(--ink-100);
  font-family: Outfit, Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
a { color: var(--kasi-400); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--kasi-400); outline-offset: 2px; }
button, input, textarea { font: inherit; color: inherit; }
svg { display: block; }

/* ---------- Controles ---------- */
.btn {
  min-height: 44px; padding: 0 16px; border: 0; border-radius: var(--r-xl);
  background: var(--raised-800); color: var(--muted-400);
  font-weight: 700; font-size: 13px; letter-spacing: .03em; cursor: pointer;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--kasi-600); color: #fff; }
.btn-primary:hover { background: var(--kasi); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.icon-btn {
  width: 44px; height: 44px; flex: 0 0 44px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted-400); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.icon-btn:hover { background: var(--raised-800); color: var(--ink-100); }
.icon-btn.small { width: 36px; height: 36px; flex-basis: 36px; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.send { background: var(--kasi-600); color: #fff; }
.icon-btn.send:hover { background: var(--kasi); }
.icon-btn.send:disabled { opacity: .5; }

.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 12px; font-weight: 700; color: var(--muted-400); letter-spacing: .04em; margin-bottom: 4px; }
.field input, .search {
  width: 100%; min-height: 44px; padding: 0 12px; background: var(--shell-950);
  border: 1px solid var(--raised-800); border-radius: var(--r-lg); color: #fff; font-size: 16px;
}
.field input::placeholder, .search::placeholder, textarea::placeholder { color: var(--muted-400); }
.error { color: var(--peligro); font-size: 13px; margin: 0 0 8px; }
.muted { color: var(--muted-400); }
.center { text-align: center; }

/* ---------- Auth ---------- */
.auth-page {
  min-height: 100%; display: flex; align-items: center; justify-content: center;
  padding: calc(16px + var(--sat)) 16px calc(16px + var(--sab));
}
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface-900);
  border: 1px solid var(--raised-800); border-radius: var(--r-2xl); padding: 24px 20px;
}
.auth-card h1 { margin: 8px 0 2px; font-size: 24px; font-weight: 800; }
.auth-card p { margin: 0 0 16px; }
.auth-logo { border-radius: 14px; }
.form .btn { width: 100%; margin-top: 4px; }

/* ---------- Layout ---------- */
.chat-page { overflow: hidden; }
.app {
  height: 100vh; height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr);
  background: var(--shell-950);
}
.side, .conv { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--shell-950); }
.side { position: relative; }
/* Móvil: o lista o conversación */
.app .conv { display: none; }
.app.in-conv .side { display: none; }
.app.in-conv .conv { display: flex; }
#btn-back { display: inline-flex; }

.bar {
  display: flex; align-items: center; gap: 6px; flex: 0 0 auto;
  padding: calc(6px + var(--sat)) calc(8px + var(--sar)) 6px calc(8px + var(--sal));
  background: var(--surface-900); border-bottom: 1px solid var(--raised-800);
}
.brand { margin: 0 auto 0 8px; font-size: 18px; font-weight: 800; }
.bar-actions { display: flex; align-items: center; gap: 2px; }
.bar-actions form { margin: 0; }
.searchbar { padding: 8px calc(10px + var(--sar)) 8px calc(10px + var(--sal)); background: var(--shell-950); }
.searchbar .search { min-height: 40px; border-radius: 999px; background: var(--surface-900); padding: 0 16px; font-size: 15px; }

/* ---------- Lista ---------- */
.chat-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(88px + var(--sab)); }
.chat-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 66px;
  padding: 8px calc(12px + var(--sar)) 8px calc(12px + var(--sal));
  background: none; border: 0; border-bottom: 1px solid var(--surface-900);
  text-align: left; cursor: pointer;
}
.chat-row:hover, .chat-row.active { background: var(--surface-900); }
.chat-row.active { box-shadow: inset 3px 0 0 var(--kasi); }
.chat-main { flex: 1; min-width: 0; }
.chat-top { display: flex; align-items: baseline; gap: 8px; }
.chat-name { flex: 1; min-width: 0; font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-time { font-size: 11px; color: var(--muted-400); flex: 0 0 auto; }
.chat-row.has-unread .chat-time { color: var(--kasi-400); }
.chat-bottom { display: flex; align-items: center; gap: 8px; margin-top: 1px; }
.chat-last { flex: 1; min-width: 0; color: var(--muted-400); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row.has-unread .chat-last { color: var(--ink-100); }
.badge {
  flex: 0 0 auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--kasi-600); color: #fff; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

.avatar {
  flex: 0 0 46px; width: 46px; height: 46px; border-radius: 999px; background: var(--raised-800);
  color: var(--kasi-400); font-weight: 800; font-size: 16px; display: flex; align-items: center; justify-content: center;
  letter-spacing: .02em; user-select: none;
}
.avatar svg { width: 22px; height: 22px; }
.bar .avatar { flex-basis: 40px; width: 40px; height: 40px; font-size: 14px; }

.fab {
  position: absolute; right: calc(16px + var(--sar)); bottom: calc(16px + var(--sab)); z-index: 5;
  width: 56px; height: 56px; border: 0; border-radius: 999px; background: var(--kasi-600); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(2, 6, 23, .6);
}
.fab:hover { background: var(--kasi); }
.fab:active { transform: scale(.94); }
.fab { padding: 0; margin: 0; line-height: 0; -webkit-appearance: none; appearance: none; }
.fab svg { width: 28px; height: 28px; flex: 0 0 28px; }
.fab-menu {
  position: absolute; right: calc(16px + var(--sar)); bottom: calc(82px + var(--sab)); z-index: 5;
  display: flex; flex-direction: column; min-width: 190px; padding: 6px;
  background: var(--raised-800); border: 1px solid var(--edge-700); border-radius: var(--r-xl); box-shadow: 0 8px 24px rgba(2, 6, 23, .6);
}
.fab-menu button {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border: 0; border-radius: var(--r-lg);
  background: none; color: var(--ink-100); font-weight: 600; text-align: left; cursor: pointer;
}
.fab-menu button:hover { background: var(--edge-700); }
.fab-menu svg { width: 20px; height: 20px; color: var(--kasi-400); }

.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted-400); padding: 24px; text-align: center; }
.empty p { margin: 0; }
.empty-icon svg { width: 48px; height: 48px; opacity: .6; }
.empty .btn { margin-top: 8px; }
.conv-empty { display: none; }
.list-note { padding: 16px; text-align: center; color: var(--muted-400); }

/* ---------- Conversación ---------- */
.conv-view { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.conv-head { flex: 1; min-width: 0; }
.conv-title { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-sub { font-size: 12px; color: var(--muted-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-sub.typing { color: var(--kasi-400); font-weight: 600; }

.msgs-wrap { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.messages {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 10px calc(10px + var(--sar)) 10px calc(10px + var(--sal));
  display: flex; flex-direction: column; gap: 2px;
  /* Wallpaper sutil: garabatos en slate sobre el fondo oscuro */
  background-color: #060d1f;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160' fill='none' stroke='%23334155' stroke-opacity='.35' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='24' cy='26' r='8'/%3E%3Cpath d='M92 20l6 10 10-6-4 12'/%3E%3Cpath d='M126 48c4-8 12-8 16 0s12 8 16 0'/%3E%3Crect x='20' y='88' width='16' height='12' rx='3'/%3E%3Cpath d='M64 70v14M57 77h14'/%3E%3Cpath d='M100 100a10 10 0 1 0 14 14'/%3E%3Cpath d='M138 112l8 8-8 8-8-8z'/%3E%3Cpath d='M30 140q8-10 16 0'/%3E%3Cpath d='M76 140l4-8 4 8z'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}
.older { align-self: center; margin-bottom: 6px; min-height: 36px; font-size: 12px; }
.day { align-self: center; margin: 10px 0 6px; padding: 3px 12px; border-radius: var(--r-lg); background: var(--raised-800); color: var(--muted-400); font-size: 11px; font-weight: 600; box-shadow: 0 1px 2px rgba(2, 6, 23, .5); }

.msg { max-width: min(84%, 540px); display: flex; flex-direction: column; position: relative; }
.msg.first { margin-top: 6px; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }
.bubble {
  position: relative; padding: 5px 9px 4px; border-radius: var(--r-xl); background: var(--raised-800); color: var(--ink-100);
  max-width: 100%; white-space: pre-wrap; word-break: break-word; box-shadow: 0 1px 1px rgba(2, 6, 23, .45);
}
.bubble::after { content: ""; display: table; clear: both; }
.mine .bubble { background: var(--kasi-600); color: #fff; }
/* Colita en el primer mensaje de cada racha */
.msg.first .bubble::before { content: ""; position: absolute; top: 0; width: 10px; height: 12px; }
.msg.first.theirs .bubble { border-top-left-radius: 2px; }
.msg.first.theirs .bubble::before { left: -7px; background: var(--raised-800); clip-path: polygon(100% 0, 100% 100%, 0 0); }
.msg.first.mine .bubble { border-top-right-radius: 2px; }
.msg.first.mine .bubble::before { right: -7px; background: var(--kasi-600); clip-path: polygon(0 0, 100% 0, 0 100%); }
.sender { font-size: 12.5px; font-weight: 700; margin-bottom: 1px; }
.bubble .text { display: inline; }
.meta {
  float: right; display: inline-flex; align-items: center; gap: 3px; margin: 7px 0 -2px 10px;
  font-size: 10.5px; line-height: 1; opacity: .75; white-space: nowrap; user-select: none;
}
.ticks { display: inline-flex; width: 17px; height: 11px; }
.ticks svg { width: 17px; height: 11px; }
.ticks .t2 { display: none; }
.ticks.delivered .t2, .ticks.read .t2 { display: inline; }
.ticks.delivered { opacity: .85; }
.ticks.read { color: var(--leido); opacity: 1; }
.meta:has(.ticks.read) { opacity: 1; }

.img-btn { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; margin: 0 0 3px; }
.img-btn img { display: block; max-width: 100%; max-height: 300px; border-radius: 8px; background: var(--surface-900); min-width: 140px; min-height: 90px; object-fit: cover; }

.doc {
  display: flex; align-items: center; gap: 10px; min-height: 44px; margin-bottom: 3px;
  padding: 6px 8px; border-radius: var(--r-lg); background: rgba(2, 6, 23, .28); color: inherit; text-decoration: none;
}
.doc svg { width: 28px; height: 28px; flex: 0 0 28px; }
.doc-info { min-width: 0; flex: 1; display: block; }
.doc-name, .doc-size { display: block; }
.doc-name { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.doc-size { font-size: 11px; opacity: .75; }

.down {
  position: absolute; right: calc(14px + var(--sar)); bottom: 12px; z-index: 3; width: 44px; height: 44px; border: 1px solid var(--edge-700);
  border-radius: 999px; background: var(--raised-800); color: var(--ink-100); cursor: pointer;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(2, 6, 23, .6);
}
.down svg { width: 22px; height: 22px; }
.down-count {
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%); min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--kasi-600); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.attach-preview {
  display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 14px;
  background: var(--surface-900); border-top: 1px solid var(--raised-800);
}
.attach-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--kasi-400); font-size: 13px; }
.send-error { padding: 6px 14px; background: var(--surface-900); color: var(--peligro); font-size: 13px; }

.composer {
  flex: 0 0 auto; display: flex; align-items: flex-end; gap: 4px;
  padding: 6px calc(8px + var(--sar)) calc(6px + var(--sab)) calc(8px + var(--sal));
  background: var(--surface-900); border-top: 1px solid var(--raised-800);
}
.composer textarea {
  flex: 1; min-width: 0; resize: none; max-height: 140px; min-height: 44px; padding: 11px 14px;
  background: var(--shell-950); border: 1px solid var(--raised-800); border-radius: 22px; font-size: 16px; line-height: 20px;
}

.attach-menu {
  position: absolute; left: calc(8px + var(--sal)); bottom: calc(62px + var(--sab)); z-index: 6;
  display: flex; flex-direction: column; min-width: 210px; padding: 6px;
  background: var(--raised-800); border: 1px solid var(--edge-700); border-radius: var(--r-xl); box-shadow: 0 8px 24px rgba(2, 6, 23, .6);
}
.attach-menu button {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 10px; border: 0; border-radius: var(--r-lg);
  background: none; color: var(--ink-100); font-weight: 600; text-align: left; cursor: pointer;
}
.attach-menu button:hover { background: var(--edge-700); }
.am-ico { width: 32px; height: 32px; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: rgba(16, 185, 129, .12); color: var(--kasi-400); }
.am-ico svg { width: 18px; height: 18px; }

/* ---------- Vista previa de foto ---------- */
.photo-modal { position: fixed; inset: 0; z-index: 70; background: var(--shell-950); display: flex; flex-direction: column; }
.photo-top { padding: calc(6px + var(--sat)) calc(8px + var(--sar)) 6px calc(8px + var(--sal)); }
.photo-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px; }
.photo-body img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.photo-foot {
  display: flex; align-items: center; gap: 8px; padding: 8px calc(10px + var(--sar)) calc(8px + var(--sab)) calc(10px + var(--sal));
  background: var(--surface-900); border-top: 1px solid var(--raised-800);
}
.photo-caption { flex: 1; min-width: 0; min-height: 44px; padding: 0 16px; border-radius: 22px; background: var(--shell-950); border: 1px solid var(--raised-800); font-size: 16px; }

/* ---------- Modales ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(2, 6, 23, .8); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 480px; max-height: 88dvh; display: flex; flex-direction: column; gap: 8px;
  background: var(--surface-900); border: 1px solid var(--edge-700); border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  padding: 8px 12px calc(12px + var(--sab));
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0 0 0 4px; font-size: 18px; }
.sheet-foot { display: flex; flex-direction: column; gap: 6px; }
.sheet-foot .btn { width: 100%; }
.user-list { flex: 1; min-height: 120px; overflow-y: auto; overscroll-behavior: contain; }
.user-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 6px 8px;
  background: none; border: 0; border-radius: var(--r-lg); text-align: left; cursor: pointer;
}
.user-row:hover { background: var(--raised-800); }
.user-row .u-main { flex: 1; min-width: 0; }
.user-row .u-name { font-weight: 700; }
.user-row .u-user { font-size: 12px; color: var(--muted-400); }
.check { width: 22px; height: 22px; border: 2px solid var(--edge-700); border-radius: 6px; flex: 0 0 22px; display: flex; align-items: center; justify-content: center; }
.user-row.selected .check { background: var(--kasi-600); border-color: var(--kasi-600); }
.user-row.selected .check::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip { padding: 4px 10px; border-radius: 8px; background: rgba(16, 185, 129, .1); color: var(--kasi-400); font-size: 12px; font-weight: 700; }

/* ---------- Visor de imagen ---------- */
.viewer { position: fixed; inset: 0; z-index: 60; background: rgba(2, 6, 23, .95); display: flex; align-items: center; justify-content: center; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; padding: calc(56px + var(--sat)) 0 var(--sab); }
.viewer-bar { position: absolute; top: var(--sat); right: var(--sar); display: flex; gap: 4px; padding: 6px; }

/* ---------- Escritorio: dos columnas ---------- */
@media (min-width: 860px) {
  .app { grid-template-columns: 380px minmax(0, 1fr); }
  .app .conv, .app.in-conv .side, .app.in-conv .conv { display: flex; }
  .side { border-right: 1px solid var(--raised-800); }
  .conv-empty { display: flex; }
  #btn-back { display: none; }
  .modal { align-items: center; }
  .sheet { border-radius: var(--r-2xl); padding-bottom: 12px; }
  .msg { max-width: min(70%, 560px); }
}

@media (prefers-reduced-motion: reduce) { .btn:active, .fab:active { transform: none; } }

/* ---------- Logo de Buxo y menú superior ---------- */
.bar { position: relative; }
.brand-logo { width: 32px; height: 32px; border-radius: 8px; margin-left: 6px; flex: 0 0 32px; }
.brand-logo + .brand { margin-left: 4px; }
.empty-logo { border-radius: 20px; opacity: .95; }
.auth-card { text-align: center; }
.auth-card .form, .auth-card .field { text-align: left; }
.auth-logo { display: block; margin: 0 auto 6px; border-radius: 16px; }
.top-menu {
  position: absolute; right: calc(8px + var(--sar)); top: calc(54px + var(--sat)); z-index: 20;
  display: flex; flex-direction: column; min-width: 210px; padding: 6px;
  background: var(--raised-800); border: 1px solid var(--edge-700); border-radius: var(--r-xl); box-shadow: 0 8px 24px rgba(2, 6, 23, .6);
}
.top-menu form { margin: 0; }
.top-menu a, .top-menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: var(--r-lg);
  background: none; color: var(--ink-100); font-weight: 600; font-size: 14px; text-align: left; text-decoration: none; cursor: pointer;
}
.top-menu a:hover, .top-menu button:hover { background: var(--edge-700); }
.top-menu svg { width: 20px; height: 20px; color: var(--kasi-400); }

/* ---------- Administración de usuarios ---------- */
.admin-page { overflow-y: auto; }
.admin-bar { position: sticky; top: 0; z-index: 10; }
.admin { max-width: 720px; margin: 0 auto; padding: 12px calc(12px + var(--sar)) calc(24px + var(--sab)) calc(12px + var(--sal)); }
.admin-lead { margin: 0 0 12px; }
.card { background: var(--surface-900); border: 1px solid var(--raised-800); border-radius: var(--r-2xl); padding: 12px; margin-bottom: 10px; }
.card-title { font-weight: 800; cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--kasi-400); list-style: none; }
.card-title::-webkit-details-marker { display: none; }
.admin-form { margin-top: 4px; }
.check-line { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-bottom: 8px; font-weight: 600; }
.check-line input { width: 22px; height: 22px; accent-color: var(--kasi-600); }
.notice { padding: 10px 12px; border-radius: var(--r-xl); margin-bottom: 10px; font-size: 13px; }
.notice.ok { background: rgba(16, 185, 129, .1); color: var(--kasi-400); }
.notice.bad { background: rgba(244, 63, 94, .1); color: #fb7185; }
.user-cards { display: grid; gap: 0; }
.user-card.inactive { opacity: .7; }
.uc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.uc-main { min-width: 0; }
.uc-name { font-weight: 700; font-size: 15px; }
.uc-user { font-size: 12px; color: var(--muted-400); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.pill { padding: 3px 8px; border-radius: var(--r-lg); font-size: 11px; font-weight: 700; background: var(--raised-800); color: var(--muted-400); }
.pill-ok { background: rgba(16, 185, 129, .1); color: var(--kasi-400); }
.pill-admin { background: rgba(245, 158, 11, .1); color: #fbbf24; }
.pill-off { background: var(--raised-800); color: var(--muted-400); }
.uc-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; margin-top: 10px; }
.uc-actions form { margin: 0; }
.uc-pass { flex: 1 1 220px; min-width: 0; }
.uc-pass summary { list-style: none; display: flex; align-items: center; width: 100%; }
.uc-pass summary::-webkit-details-marker { display: none; }
.uc-pass[open] summary { margin-bottom: 8px; }
.uc-pass-form { display: flex; gap: 8px; }
.uc-pass-form .search { flex: 1; min-width: 0; }
.btn-danger { background: rgba(244, 63, 94, .12); color: #fb7185; }
/* ---------- Lista de chats: layout tipo app móvil moderna ---------- */
.side-head { background: transparent; border-bottom: 0; padding-top: calc(10px + var(--sat)); padding-bottom: 2px; }
.side-head .brand { font-size: 28px; font-weight: 800; letter-spacing: -.01em; margin-left: 4px; }
.side-head .brand-logo { width: 30px; height: 30px; flex-basis: 30px; margin-left: 8px; }
.side-head .icon-btn { color: var(--ink-100); }
.side-head .top-menu { top: calc(58px + var(--sat)); }

.searchbar { position: relative; padding: 8px calc(14px + var(--sar)) 8px calc(14px + var(--sal)); background: transparent; }
.searchbar .search { min-height: 46px; border: 0; border-radius: 999px; background: var(--raised-800); padding: 0 16px 0 48px; font-size: 16px; }
.search-ico { position: absolute; left: calc(14px + var(--sal) + 16px); top: 8px; height: 46px; display: flex; align-items: center; color: var(--muted-400); pointer-events: none; }
.search-ico svg { width: 20px; height: 20px; }

.filter-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 4px calc(14px + var(--sar)) 10px calc(14px + var(--sal)); }
.filter-chips::-webkit-scrollbar { display: none; }
.fchip { flex: 0 0 auto; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--edge-700); background: transparent; color: #cbd5e1; font-weight: 600; font-size: 14px; white-space: nowrap; cursor: pointer; }
.fchip.active { background: rgba(16, 185, 129, .18); border-color: transparent; color: #6ee7b7; }
.fchip-n { margin-left: 4px; }
.fchip-n:empty { display: none; }

.chat-list { padding-bottom: 96px; }
.chat-row { min-height: 72px; gap: 14px; border-bottom: 0; padding: 8px calc(14px + var(--sar)) 8px calc(14px + var(--sal)); }
.chat-row.active { box-shadow: none; background: var(--surface-900); }
.chat-row .avatar { flex-basis: 54px; width: 54px; height: 54px; font-size: 19px; }
.chat-row .avatar svg { width: 26px; height: 26px; }
.chat-name { font-size: 17px; }
.chat-last { display: flex; align-items: center; gap: 5px; min-width: 0; margin-top: 2px; color: #9aa8bd; font-size: 15px; white-space: nowrap; overflow: hidden; }
.chat-last-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chat-last .ticks { flex: 0 0 17px; }
.mini-ico { display: inline-flex; flex: 0 0 auto; }
.mini-ico svg { width: 16px; height: 16px; }
.chat-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 6px; flex: 0 0 auto; align-self: stretch; }
.chat-time { font-size: 12px; }
.badge { min-width: 22px; height: 22px; background: var(--kasi); color: #04211a; font-weight: 800; }
.badge-ph { height: 22px; }

.fab { width: 56px; height: 56px; border-radius: 16px; background: var(--kasi); color: #03160f; bottom: calc(64px + var(--sab) + 16px); }
.fab:hover { background: var(--kasi-400); }
.fab-menu { bottom: calc(64px + var(--sab) + 82px); }

.bottom-nav { flex: 0 0 auto; display: flex; align-items: stretch; justify-content: space-around; min-height: 64px; padding: 6px calc(8px + var(--sar)) calc(6px + var(--sab)) calc(8px + var(--sal)); background: var(--surface-900); border-top: 1px solid var(--raised-800); }
.nav-item { flex: 1; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted-400); text-decoration: none; font-size: 12px; font-weight: 600; }
.nav-ico { position: relative; display: flex; align-items: center; justify-content: center; width: 64px; height: 32px; border-radius: 999px; }
.nav-ico svg { width: 24px; height: 24px; }
.nav-item.active { color: var(--ink-100); }
.nav-item.active .nav-ico { background: rgba(16, 185, 129, .22); color: #6ee7b7; }
.nav-badge { position: absolute; top: -5px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--kasi); color: #04211a; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
/* ---------- Llamadas de voz ---------- */
.call-btn { color: var(--kasi-400); }
.msg.sys { align-self: center; max-width: 90%; margin: 6px 0; }
.sys-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--raised-800); color: var(--ink-100); font-size: 13px; font-weight: 600; box-shadow: 0 1px 2px rgba(2, 6, 23, .5); }
.sys-pill svg { width: 16px; height: 16px; color: var(--kasi-400); flex: 0 0 16px; }
.sys-pill.bad svg { color: #fb7185; }
.sys-pill .t { font-size: 10.5px; font-weight: 400; opacity: .7; }
.mini-ico.bad svg { color: #fb7185; }

.call-screen {
  position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: calc(48px + var(--sat)) 24px calc(40px + var(--sab));
  background: radial-gradient(120% 80% at 50% 0%, #0f2a24 0%, #07101f 55%, #020617 100%);
}
.call-top { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; width: 100%; }
.call-label { font-size: 13px; color: var(--muted-400); letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }
.call-avatar { width: 128px; height: 128px; border-radius: 999px; margin: 18px 0 6px; display: flex; align-items: center; justify-content: center; font-size: 46px; font-weight: 800; box-shadow: 0 0 0 10px rgba(16, 185, 129, .08); }
.call-screen[data-mode="in"] .call-avatar { animation: callpulse 1.8s ease-out infinite; }
.call-name { font-size: 28px; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.call-status { font-size: 18px; color: #cbd5e1; min-height: 26px; font-variant-numeric: tabular-nums; }
.call-actions { display: flex; align-items: flex-start; justify-content: center; gap: 28px; width: 100%; }
.call-action { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; color: #cbd5e1; min-width: 72px; }
.call-btn-round { width: 68px; height: 68px; border: 0; border-radius: 999px; background: var(--raised-800); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.call-btn-round svg { width: 28px; height: 28px; }
.call-btn-round:active { transform: scale(.94); }
.call-btn-round.on { background: #e2e8f0; color: #0f172a; }
.call-btn-round.red { background: #ef4444; }
.call-btn-round.green { background: var(--kasi); color: #03160f; }
.call-actions + .call-actions { margin-top: 0; }
@keyframes callpulse { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .45); } 100% { box-shadow: 0 0 0 36px rgba(16, 185, 129, 0); } }
@media (prefers-reduced-motion: reduce) { .call-screen[data-mode="in"] .call-avatar { animation: none; } }

.toast { position: fixed; left: 50%; bottom: calc(88px + var(--sab)); transform: translateX(-50%); z-index: 90; max-width: min(92vw, 420px); padding: 10px 16px; border-radius: var(--r-xl); background: var(--raised-800); border: 1px solid var(--edge-700); color: var(--ink-100); font-size: 14px; text-align: center; box-shadow: 0 8px 24px rgba(2, 6, 23, .6); }
.call-screen:not([hidden]) ~ .toast { bottom: calc(24px + var(--sab)); z-index: 95; }