:root {
  --brand: #0f766e;
  --brand-strong: #0b5f58;
  --side-bg: #12302e;
  --side-fg: #c9dad8;
  --side-muted: #85a3a0;
  --side-hover: rgba(255, 255, 255, 0.07);
  --side-active: #14b8a6;
  --bg: #ffffff;
  --bg-soft: #f6f7f8;
  --bg-hover: #f3f5f6;
  --fg: #1d1f21;
  --muted: #616a70;
  --border: #e2e5e8;
  --mention-bg: #fff6d6;
  --mention-fg: #8a5a00;
  --mention-line: #f2c744;
  --code-bg: #f1f3f4;
  --danger: #d1344b;
  --online: #2bac76;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
  --radius: 8px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --side-bg: #0d2321;
    --bg: #1a1d21;
    --bg-soft: #222529;
    --bg-hover: #222529;
    --fg: #e3e5e7;
    --muted: #9aa1a7;
    --border: #33373c;
    --mention-bg: #3a3218;
    --mention-fg: #f5cf6a;
    --code-bg: #2b2f34;
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.46 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
}
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--muted); }

/* ---------- Botones ---------- */
.btn {
  border: 1px solid var(--border); background: var(--bg); border-radius: 6px;
  padding: 8px 14px; font-weight: 600;
}
.btn:hover { background: var(--bg-hover); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.ghost { background: transparent; }
.icon-btn {
  border: 0; background: transparent; border-radius: 6px; width: 28px; height: 28px;
  display: inline-grid; place-items: center; font-size: 16px; line-height: 1;
}
.icon-btn:hover { background: var(--bg-hover); }

/* ---------- Acceso ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 16px; background: var(--bg-soft); }
.auth-card {
  width: 100%; max-width: 380px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 14px; padding: 28px; box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 800; }
.logo {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 19px; flex: none;
}
.auth-sub { color: var(--muted); margin: 6px 0 20px; }
.tabs { display: flex; gap: 4px; background: var(--bg-soft); padding: 4px; border-radius: 8px; margin-bottom: 18px; }
.tab { flex: 1; border: 0; background: transparent; padding: 7px; border-radius: 6px; font-weight: 600; color: var(--muted); }
.tab.active { background: var(--bg); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
#auth-form label, .modal-card label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
#auth-form input, .modal-card input {
  display: block; width: 100%; margin-top: 6px; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--bg); font-weight: 400;
}
#auth-form input:focus, .modal-card input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
#auth-form .btn { width: 100%; padding: 10px; }
.form-error { color: var(--danger); font-size: 14px; min-height: 1em; margin: 0 0 10px; }

/* ---------- Estructura ---------- */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar {
  width: 260px; flex: none; background: var(--side-bg); color: var(--side-fg);
  display: flex; flex-direction: column; min-height: 0;
}
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.side-panel {
  width: 380px; flex: none; border-left: 1px solid var(--border); display: flex; flex-direction: column;
  min-height: 0; background: var(--bg);
}

/* ---------- Barra lateral ---------- */
.ws-header {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08); font-weight: 800; font-size: 18px; color: #fff;
}
.ws-header .logo { width: 28px; height: 28px; font-size: 15px; background: var(--side-active); }
.search-wrap { padding: 12px 12px 4px; }
.search-wrap input {
  width: 100%; padding: 6px 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.08); color: #fff;
}
.search-wrap input::placeholder { color: var(--side-muted); }
.side-scroll { flex: 1; overflow-y: auto; padding: 8px 0; }
.side-section { margin-bottom: 14px; }
.side-title {
  display: flex; align-items: center; justify-content: space-between; padding: 4px 12px 4px 16px;
  color: var(--side-muted); font-size: 13px; font-weight: 600;
}
.side-title .icon-btn { color: var(--side-muted); width: 24px; height: 24px; }
.side-title .icon-btn:hover { background: var(--side-hover); color: #fff; }
.side-list { list-style: none; margin: 0; padding: 0 8px; }
.side-item {
  display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 6px;
  cursor: pointer; color: var(--side-fg); white-space: nowrap;
}
.side-item:hover { background: var(--side-hover); }
.side-item.active { background: var(--side-active); color: #fff; }
.side-item.unread { color: #fff; font-weight: 700; }
.side-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.side-item .hash { width: 16px; text-align: center; opacity: .8; }
.side-item .you { opacity: .6; font-weight: 400; }
.badge {
  background: #e0365a; color: #fff; border-radius: 9px; font-size: 12px; font-weight: 700;
  padding: 0 7px; line-height: 18px;
}
.side-link {
  border: 0; background: transparent; color: var(--side-muted); padding: 4px 8px 4px 32px;
  margin: 2px 8px 0; font-size: 14px; text-align: left; width: calc(100% - 16px); border-radius: 6px;
}
.side-link:hover { background: var(--side-hover); color: #fff; }
.presence { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--side-muted); flex: none; margin: 0 3.5px; }
.presence.on { background: var(--online); border-color: var(--online); }
.me-bar {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.08);
}
.me-bar .who { flex: 1; min-width: 0; line-height: 1.2; }
.me-bar .who strong { display: block; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-bar .who span { font-size: 12px; color: var(--side-muted); }
.me-bar .icon-btn { color: var(--side-muted); }
.me-bar .icon-btn:hover { background: var(--side-hover); color: #fff; }

/* ---------- Cabecera de canal ---------- */
.ch-header {
  display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--border);
  min-height: 58px;
}
.ch-info { flex: 1; min-width: 0; }
.ch-header h1 { font-size: 17px; margin: 0; display: flex; align-items: center; gap: 6px; }
.ch-topic {
  border: 0; background: transparent; padding: 0; color: var(--muted); font-size: 13px; text-align: left;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block;
}
.ch-topic.editable:hover { color: var(--fg); text-decoration: underline; }
.menu-btn { display: none; }

/* ---------- Mensajes ---------- */
.messages { flex: 1; overflow-y: auto; padding: 8px 0 12px; overflow-x: hidden; }
.intro { padding: 28px 20px 12px; }
.intro h2 { margin: 0 0 4px; font-size: 22px; }
.intro p { margin: 0; color: var(--muted); }
.load-more { text-align: center; color: var(--muted); font-size: 13px; padding: 10px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.day-sep { position: relative; text-align: center; margin: 14px 0 6px; }
.day-sep::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--border); }
.day-sep span {
  position: relative; background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 2px 12px; font-size: 12px; font-weight: 700;
}
.msg { position: relative; display: flex; gap: 10px; padding: 6px 20px 4px; }
.msg.compact { padding-top: 1px; padding-bottom: 1px; }
.msg:hover { background: var(--bg-hover); }
.msg.mention-me { background: var(--mention-bg); box-shadow: inset 3px 0 0 var(--mention-line); }
.msg.flash { animation: flash 2s ease-out; }
@keyframes flash { from { background: var(--mention-bg); } to { background: transparent; } }
.gutter { width: 36px; flex: none; }
.avatar {
  width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; color: #fff;
  font-weight: 700; font-size: 14px; flex: none; user-select: none;
}
.avatar.sm { width: 24px; height: 24px; border-radius: 6px; font-size: 11px; }
.hover-time { display: none; font-size: 11px; color: var(--muted); text-align: right; padding-top: 3px; width: 100%; }
.msg.compact:hover .hover-time { display: block; }
.body { flex: 1; min-width: 0; }
.meta { display: flex; align-items: baseline; gap: 8px; }
.meta .name { font-weight: 800; }
.meta .time { font-size: 12px; color: var(--muted); }
.text { overflow-wrap: anywhere; }
.text code { background: var(--code-bg); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; font-size: 13px; color: #c7254e; }
.text pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px;
  margin: 4px 0; font-size: 13px; overflow-x: auto; white-space: pre-wrap;
}
.text a { color: #1264a3; }
.text blockquote { margin: 2px 0; padding-left: 10px; border-left: 4px solid var(--border); color: var(--muted); }
.mention { background: rgba(29, 155, 209, .14); color: #1264a3; border-radius: 3px; padding: 0 2px; font-weight: 600; }
.mention.me { background: var(--mention-line); color: #3d2e00; }
.edited { color: var(--muted); font-size: 12px; margin-left: 4px; }
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction {
  border: 1px solid var(--border); background: var(--bg-soft); border-radius: 12px; padding: 0 8px;
  font-size: 13px; line-height: 22px; display: inline-flex; gap: 4px; align-items: center;
}
.reaction span { font-weight: 600; color: var(--muted); font-size: 12px; }
.reaction.mine { border-color: #1d9bd1; background: rgba(29, 155, 209, .12); }
.reaction.mine span { color: #1264a3; }
.reaction.add { opacity: 0; }
.msg:hover .reaction.add { opacity: 1; }
.thread-link {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; border: 1px solid transparent;
  background: transparent; padding: 3px 6px 3px 3px; border-radius: 6px; font-size: 13px;
}
.thread-link:hover { border-color: var(--border); background: var(--bg); }
.thread-link strong { color: #1264a3; }
.actions {
  position: absolute; right: 16px; top: -14px; display: none; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 2px; box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.msg:hover .actions { display: flex; }
.actions button { border: 0; background: transparent; border-radius: 5px; width: 30px; height: 28px; font-size: 15px; }
.actions button:hover { background: var(--bg-hover); }
.editor textarea {
  width: 100%; border: 1px solid var(--brand); border-radius: 6px; padding: 6px 8px; resize: none;
  background: var(--bg); min-height: 60px;
}
.editor .row { display: flex; gap: 6px; justify-content: flex-end; margin-top: 4px; align-items: center; font-size: 12px; }
.editor .row .muted { flex: 1; }
.thread-sep { display: flex; align-items: center; gap: 10px; padding: 6px 20px; color: var(--muted); font-size: 13px; }
.thread-sep::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* ---------- Compositor ---------- */
.composer-wrap { padding: 0 18px 4px; }
.composer {
  display: flex; align-items: flex-end; gap: 6px; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 6px 6px 12px; background: var(--bg);
}
.composer:focus-within { border-color: var(--muted); }
.composer textarea {
  flex: 1; border: 0; outline: 0; resize: none; background: transparent; max-height: 200px; padding: 5px 0;
}
.send-btn {
  border: 0; background: var(--brand); color: #fff; border-radius: 6px; width: 34px; height: 32px; font-size: 14px;
}
.send-btn:hover { background: var(--brand-strong); }
.typing { height: 20px; font-size: 12px; color: var(--muted); padding: 2px 4px; }

/* ---------- Hilo ---------- */
.panel-header {
  display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 18px;
  min-height: 58px; border-bottom: 1px solid var(--border);
}

/* ---------- Modal, selector de emoji y avisos ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal-card {
  background: var(--bg); border-radius: 12px; width: 100%; max-width: 520px; max-height: 85vh; overflow-y: auto;
  padding: 22px 24px; box-shadow: var(--shadow);
}
.modal-card h2 { margin: 0 0 16px; font-size: 20px; display: flex; justify-content: space-between; align-items: center; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-top: 1px solid var(--border);
}
.list-row:first-of-type { border-top: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow small { color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result { padding: 10px 6px; border-top: 1px solid var(--border); cursor: pointer; border-radius: 6px; }
.result:hover { background: var(--bg-hover); }
.result .where { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.picker {
  position: fixed; z-index: 60; background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); padding: 6px; display: grid; grid-template-columns: repeat(6, 36px); gap: 2px;
}
.picker button { border: 0; background: transparent; font-size: 20px; height: 36px; border-radius: 6px; }
.picker button:hover { background: var(--bg-hover); }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1d1f21; color: #fff;
  padding: 10px 16px; border-radius: 8px; z-index: 70; box-shadow: var(--shadow); max-width: calc(100% - 32px);
}
.backdrop { display: none; }

/* ---------- Espacio de trabajo y categorías ---------- */
.ws-header { width: 100%; border: 0; background: transparent; text-align: left; }
.ws-header:hover { background: var(--side-hover); }
.ws-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-chev { font-size: 12px; color: var(--side-muted); }
.category { margin-top: 10px; }
.cat-title { display: flex; align-items: center; padding: 0 12px 2px 8px; }
.cat-toggle {
  flex: 1; display: flex; align-items: center; gap: 4px; border: 0; background: transparent; text-align: left;
  color: var(--side-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 2px 4px;
}
.cat-toggle:hover { color: #fff; }
.chev { display: inline-block; transition: transform .15s; font-size: 10px; width: 12px; }
.chev.closed { transform: rotate(-90deg); }
.cat-title .icon-btn { color: var(--side-muted); width: 22px; height: 22px; }
.cat-title .icon-btn:hover { background: var(--side-hover); color: #fff; }
.side-item.deactivated .label { text-decoration: line-through; opacity: .6; }
.ch-actions { display: flex; gap: 2px; }
.ch-actions .icon-btn { width: 34px; height: 34px; }
.ch-actions .icon-btn.active { background: var(--bg-hover); outline: 1px solid var(--border); }
.ch-icon { color: var(--muted); font-weight: 400; }
.composer.disabled { background: var(--bg-soft); }
.composer.disabled .send-btn { opacity: .4; cursor: not-allowed; }
[data-profile] { cursor: pointer; }
.meta .name:hover, .member-name:hover { text-decoration: underline; }

/* ---------- Lista de miembros ---------- */
.members-panel { width: 260px; }
.members-list { flex: 1; overflow-y: auto; padding: 8px; }
.mem-group { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 14px 8px 4px; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 6px; }
.member-row:hover { background: var(--bg-hover); }
.member-row.offline { opacity: .5; }
.member-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-wrap { position: relative; flex: none; }
.presence-dot {
  position: absolute; right: -3px; bottom: -3px; width: 11px; height: 11px; border-radius: 50%;
  background: #8b949b; border: 2px solid var(--bg);
}
.presence-dot.on { background: var(--online); }

/* ---------- Ventanas flotantes ---------- */
.popover {
  position: fixed; z-index: 55; background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); overflow: hidden;
}
.popover.menu { padding: 6px; min-width: 240px; display: flex; flex-direction: column; }
.popover.menu button { border: 0; background: transparent; text-align: left; padding: 8px 10px; border-radius: 6px; }
.popover.menu button:hover { background: var(--brand); color: #fff; }
.popover.menu button.danger { color: var(--danger); }
.popover.menu button.danger:hover { background: var(--danger); color: #fff; }
.popover.profile { width: 300px; max-width: calc(100vw - 16px); }
.profile-banner { height: 60px; opacity: .85; }
.profile-body { padding: 0 16px 16px; }
.profile-body .avatar.lg { position: relative; margin-top: -36px; border: 4px solid var(--bg); }
.profile-name { font-size: 19px; font-weight: 800; margin-top: 6px; }
.profile-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.profile-section { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
.btn.full { width: 100%; margin-top: 14px; }
.avatar.lg { width: 72px; height: 72px; border-radius: 18px; font-size: 26px; }
.avatar.xs { width: 18px; height: 18px; border-radius: 5px; font-size: 9px; display: inline-grid; vertical-align: middle; }
.pill {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 1px 8px; border-radius: 10px;
  background: var(--bg-soft); border: 1px solid var(--border); font-weight: 600; margin-left: 4px;
}
.pill.danger { color: var(--danger); border-color: var(--danger); }
.pill.ok { color: var(--online); }
.role-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.role-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 8px;
  border-radius: 6px; background: var(--bg-soft); border: 1px solid var(--border); white-space: nowrap;
}
.role-chip i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.role-chip button { border: 0; background: transparent; padding: 0 0 0 2px; color: var(--muted); font-size: 14px; line-height: 1; }
.role-chip button:hover { color: var(--danger); }
.add-role {
  font-size: 12px; border: 1px dashed var(--border); background: transparent; border-radius: 6px; padding: 2px 4px; color: var(--muted);
}

/* ---------- Ajustes (modal ancho) ---------- */
.modal-card.wide { max-width: 980px; height: min(85vh, 760px); padding: 0; overflow: hidden; }
.settings { display: flex; height: 100%; }
.settings-nav {
  width: 210px; flex: none; background: var(--bg-soft); border-right: 1px solid var(--border); padding: 18px 10px;
  display: flex; flex-direction: column; gap: 2px; overflow-y: auto;
}
.settings-nav-title { font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--muted); padding: 0 10px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-nav button { border: 0; background: transparent; text-align: left; padding: 7px 10px; border-radius: 6px; font-weight: 600; color: var(--muted); }
.settings-nav button:hover { background: var(--bg-hover); color: var(--fg); }
.settings-nav button.active { background: var(--border); color: var(--fg); }
.settings-body { flex: 1; overflow-y: auto; padding: 22px 26px; min-width: 0; }
.modal-card select {
  display: block; width: 100%; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--bg); font-weight: 400;
}
.modal-card select.add-role, .ow-targets select { margin-top: 0; }
.field-title { font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--muted); margin: 20px 0 8px; letter-spacing: .03em; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 12px; }
.notice { background: var(--bg-soft); border: 1px solid var(--border); border-left: 4px solid var(--brand); padding: 8px 12px; border-radius: 6px; font-size: 13px; margin: 0 0 14px; }
.notice.warn { border-left-color: var(--mention-line); }
.grow { flex: 1; min-width: 0; }
.grow small, .perm-row small, .radio small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.editor-actions { display: flex; gap: 8px; align-items: center; margin-top: 18px; }
.editor-actions.sticky { position: sticky; bottom: -22px; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--border); }
.btn-group { display: flex; gap: 4px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-outline { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.danger-outline:hover { background: var(--danger); color: #fff; }
.modal-card label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin-bottom: 10px; }
.modal-card label.check input { width: auto; margin: 0; display: inline; }
.modal-card label.radio {
  display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 8px; cursor: pointer;
}
.modal-card label.radio input { width: auto; margin: 3px 0 0; display: inline; }
.modal-card label.radio:has(input:checked) { border-color: var(--brand); background: var(--bg-soft); }
.inline-fields { display: flex; gap: 20px; align-items: center; margin-bottom: 14px; }
.modal-card label.inline { display: flex; align-items: center; gap: 8px; margin: 0; }
.modal-card input[type=color] { width: 44px; height: 30px; padding: 2px; margin: 0; display: inline-block; }
.modal-card .inline-fields label.check { margin: 0; }
.perm-group { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; margin: 16px 0 4px; }
.modal-card .perm-row, .perm-row {
  display: flex; align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); margin: 0; font-weight: 400;
}
.perm-row > span { flex: 1; min-width: 0; }
.perm-row.warn strong { color: var(--danger); }
.perm-row.big { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; }
.switch {
  appearance: none; -webkit-appearance: none; width: 40px !important; height: 22px; border-radius: 11px; background: #8b949b;
  position: relative; cursor: pointer; flex: none; margin: 0 !important; padding: 0 !important; border: 0 !important; transition: background .15s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s;
}
.switch:checked { background: var(--online); }
.switch:checked::after { transform: translateX(18px); }
.switch:disabled { opacity: .45; cursor: not-allowed; }

.roles-layout { display: flex; gap: 20px; align-items: flex-start; }
.roles-list { width: 210px; flex: none; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; }
.roles-list .btn { margin-bottom: 8px; }
.role-row {
  display: flex; align-items: center; gap: 8px; border: 0; background: transparent; text-align: left; padding: 7px 8px; border-radius: 6px;
}
.role-row:hover { background: var(--bg-hover); }
.role-row.active { background: var(--border); }
.role-row i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.role-row small { color: var(--muted); }
.role-editor { flex: 1; min-width: 0; }
.editor-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.editor-head h3 { margin: 0; flex: 1; font-size: 17px; }

.filter { display: block; width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); }
.member-admin { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.member-admin .role-chips { margin-top: 4px; }
.member-admin.is-deactivated { opacity: .6; }
.cat-admin, .invite-row, .audit-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.audit-row { align-items: flex-start; }
.invite-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.invite-form label { margin-bottom: 0 !important; }
.invite-box { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; padding: 12px; border-radius: 8px; background: var(--bg-soft); border: 1px solid var(--border); }
.modal-card .invite-box input { flex: 1; min-width: 200px; margin: 0; display: inline-block; width: auto; }
.danger-zone { display: flex; gap: 16px; align-items: center; margin-top: 30px; padding: 14px; border: 1px solid var(--danger); border-radius: 8px; }

.ow-layout { display: flex; gap: 20px; align-items: flex-start; }
.ow-targets { width: 220px; flex: none; display: flex; flex-direction: column; gap: 2px; }
.ow-targets .field-title { margin-top: 0; }
.ow-target { display: flex; align-items: center; gap: 6px; border: 0; background: transparent; text-align: left; padding: 6px 8px; border-radius: 6px; }
.ow-target:hover { background: var(--bg-hover); }
.ow-target.active { background: var(--border); }
.ow-target .role-chip { background: transparent; border: 0; padding: 0; font-size: 14px; }
.ow-targets select { margin-top: 8px !important; font-size: 13px; }
.ow-editor { flex: 1; min-width: 0; }
.ow-editor .hint { margin-top: 0; }
.tri { display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; flex: none; }
.tri button { border: 0; background: transparent; width: 34px; height: 28px; font-weight: 700; color: var(--muted); }
.tri button + button { border-left: 1px solid var(--border); }
.tri button.deny.on { background: var(--danger); color: #fff; }
.tri button.inherit.on { background: var(--muted); color: var(--bg); }
.tri button.allow.on { background: var(--online); color: #fff; }
.tri.locked { opacity: .45; }
.tri button:disabled { cursor: not-allowed; }
.private-roles { margin: 10px 0; }
.private-roles label.check { justify-content: space-between; }

/* ---------- Acceso: segundo paso y 2FA obligatorio ---------- */
#twofa-form .btn { width: 100%; padding: 10px; margin-bottom: 6px; }
.twofa-title { margin: 0 0 16px; }
.twofa-title strong { display: block; font-size: 17px; margin-bottom: 4px; }
.twofa-title .muted { font-size: 14px; }
.auth-card.wide-card { max-width: 620px; }
#setup2fa-logout { margin-top: 12px; }
#setup2fa .twofa-box form label, #setup2fa .twofa-box input { display: block; width: 100%; }
#setup2fa input { margin-top: 6px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); }

/* ---------- Mi cuenta ---------- */
.profile-preview { display: flex; gap: 16px; align-items: center; padding: 14px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 18px; }
.profile-preview .role-chips { margin-top: 6px; }
.twofa-box { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.twofa-box.ok { border-color: var(--online); }
.twofa-box p { margin: 0 0 10px; }
.twofa-setup { display: flex; gap: 20px; align-items: flex-start; }
.twofa-setup img { border-radius: 8px; background: #fff; padding: 6px; flex: none; }
.twofa-setup form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.twofa-setup form label { flex: 1; min-width: 200px; margin: 0 !important; }
code.secret { font-size: 14px; letter-spacing: .08em; padding: 4px 8px; display: inline-block; margin-top: 4px; user-select: all; }
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; margin: 12px 0; }
.codes code { font-size: 15px; text-align: center; padding: 6px; border: 1px dashed var(--border); border-radius: 6px; background: var(--bg-soft); user-select: all; }
code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }

/* ---------- Archivos adjuntos ---------- */
.attach-btn { align-self: flex-end; margin-bottom: 2px; font-size: 17px; }
.composer { padding-left: 6px; }
.composer.waiting .send-btn { opacity: .5; cursor: progress; }
.pending { display: flex; gap: 8px; overflow-x: auto; padding: 8px 2px; }
.pending-item {
  position: relative; display: flex; align-items: center; gap: 8px; flex: none; width: 220px; padding: 6px 28px 10px 6px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg-soft); overflow: hidden;
}
.pending-item img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; flex: none; }
.pending-item .file-icon { font-size: 26px; width: 40px; text-align: center; flex: none; }
.pi-info { min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.pi-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-meta { color: var(--muted); font-size: 12px; }
.pending-item.error { border-color: var(--danger); }
.pending-item.error .pi-meta { color: var(--danger); }
.pi-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: transparent; }
.pi-bar i { display: block; height: 100%; background: var(--brand); transition: width .15s; }
.pending-item button { position: absolute; top: 4px; right: 4px; border: 0; background: transparent; font-size: 16px; color: var(--muted); width: 22px; height: 22px; border-radius: 4px; }
.pending-item button:hover { background: var(--bg-hover); color: var(--danger); }
.attachments { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; align-items: flex-start; }
.att-image { border: 0; padding: 0; background: var(--bg-soft); border-radius: 8px; overflow: hidden; cursor: zoom-in; display: block; max-width: 100%; }
.att-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.att-image.single { max-width: min(360px, 100%); }
.att-image.single:not([style]) img { max-height: 280px; width: auto; max-width: 100%; }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, 150px); gap: 4px; max-width: 460px; }
.att-grid .att-image { width: 150px; height: 150px; }
.att-file {
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); width: 100%; max-width: 400px;
}
.att-file .file-icon { font-size: 26px; flex: none; }
.att-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.att-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.att-info small { color: var(--muted); font-size: 12px; }
.att-file a.icon-btn { text-decoration: none; }
.drop-hint { display: none; }
.main.dragging, .side-panel.dragging { position: relative; }
.main.dragging .drop-hint, .side-panel.dragging .drop-hint {
  display: grid; place-items: center; position: absolute; inset: 8px; z-index: 20; border: 3px dashed var(--brand); border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 85%, transparent); font-size: 18px; font-weight: 700; color: var(--brand); pointer-events: none;
}
.viewer { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .88); display: flex; flex-direction: column; color: #fff; }
.viewer-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.viewer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.viewer-name small { opacity: .7; font-weight: 400; margin-left: 6px; }
.viewer .icon-btn { color: #fff; }
.viewer .icon-btn:hover { background: rgba(255,255,255,.15); }
.viewer-media { flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 16px 16px; }
.viewer-media img, .viewer-media video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.viewer-media audio { width: min(480px, 100%); }

/* ---------- Llamadas ---------- */
#call-btn.live { background: var(--online); color: #fff; }
.call-view { border-bottom: 1px solid var(--border); background: #111417; flex: none; }
.call-banner { display: flex; align-items: center; gap: 10px; padding: 8px 18px; background: var(--bg-soft); color: var(--fg); }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--online); box-shadow: 0 0 0 0 var(--online); animation: pulse 1.6s infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(43,172,118,.6); } 100% { box-shadow: 0 0 0 10px rgba(43,172,118,0); } }
.call-stage { display: flex; flex-direction: column; height: min(46vh, 460px); }
.app.call-expanded .call-view { flex: 1; }
.app.call-expanded .call-stage { height: 100%; }
.app.call-expanded #messages, .app.call-expanded .main > .composer-wrap { display: none; }
.call-grid { flex: 1; min-height: 0; }
.tile { position: relative; background: #1e2328; border-radius: 10px; overflow: hidden; display: grid; place-items: center; min-height: 0; outline: 3px solid transparent; transition: outline-color .1s; }
.tile.speaking { outline-color: var(--online); }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; background: #000; }
.tile.screen video { object-fit: contain; }
.tile.mirror video { transform: scaleX(-1); }
.tile.has-video video { display: block; }
.tile.has-video .tile-avatar { display: none; }
.tile.connecting { opacity: .6; }
.tile-label {
  position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-weight: 600;
  padding: 2px 8px; border-radius: 6px; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.call-controls { display: flex; justify-content: center; gap: 10px; padding: 8px 10px 12px; }
.call-ctl { width: 46px; height: 46px; border-radius: 50%; border: 0; background: #2b3138; color: #fff; font-size: 19px; }
.call-ctl:hover { background: #3a414a; }
.call-ctl.off { background: #4a2128; }
.call-ctl.on { background: var(--brand); }
.call-ctl.hangup, .icon-btn.hangup { background: var(--danger); color: #fff; }
.call-panel { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-top: 1px solid rgba(255,255,255,.08); background: rgba(0,0,0,.2); }
.call-panel-info { flex: 1; min-width: 0; border: 0; background: transparent; text-align: left; display: flex; flex-direction: column; color: var(--side-fg); border-radius: 6px; padding: 2px 6px; }
.call-panel-info:hover { background: var(--side-hover); }
.call-panel-info .muted { color: var(--side-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-text { color: #3ddc97; font-weight: 700; font-size: 13px; }
.call-panel .icon-btn { color: var(--side-fg); }
.call-tag { font-size: 11px; color: #3ddc97; font-weight: 700; flex: none; }
.ring {
  position: fixed; right: 20px; bottom: 20px; z-index: 75; display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); max-width: calc(100vw - 40px);
  animation: ring-in .2s ease-out;
}
@keyframes ring-in { from { transform: translateY(20px); opacity: 0; } }
.ring-text { display: flex; flex-direction: column; min-width: 0; margin-right: 6px; }
.ring-text span { color: var(--muted); font-size: 13px; }

/* ---------- Actividad, guardados y fijados ---------- */
.side-nav { padding: 0 8px 10px; display: flex; flex-direction: column; gap: 1px; }
.nav-item { border: 0; background: transparent; width: 100%; text-align: left; font: inherit; }
.nav-item.active { background: var(--side-active); color: #fff; }
.ch-actions .icon-btn { position: relative; }
.pin-count { position: absolute; right: 1px; bottom: 1px; font-size: 10px; font-weight: 700; color: var(--muted); }
.ch-actions .icon-btn.active { background: var(--bg-hover); outline: 1px solid var(--border); }
.msg.pinned { background: color-mix(in srgb, var(--mention-line) 7%, transparent); }
.pinned-label { font-size: 12px; color: var(--mention-fg); font-weight: 600; margin-bottom: 2px; }
.saved-label { font-size: 12px; }
.actions button.on { background: color-mix(in srgb, var(--brand) 18%, transparent); }
.list-panel { width: 380px; }
.list-items { flex: 1; overflow-y: auto; padding: 8px; }
.list-item { padding: 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; cursor: pointer; background: var(--bg); }
.list-item:hover { border-color: var(--muted); background: var(--bg-hover); }
.li-where { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.li-reason { font-weight: 700; color: var(--fg); }
.li-head { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.li-head .btn { margin-left: auto; }
.li-name { font-weight: 700; }
.li-files { font-size: 12px; color: var(--muted); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .text { font-size: 14px; max-height: 6.5em; overflow: hidden; }
a.channel-link { color: #1264a3; background: rgba(29, 155, 209, .12); border-radius: 3px; padding: 0 2px; cursor: pointer; text-decoration: none; font-weight: 600; }
a.channel-link:hover { text-decoration: underline; }

/* ---------- Estado y «No molestar» ---------- */
.status-emoji { margin-left: 4px; font-size: 14px; cursor: default; }
.dnd-badge { margin-left: 3px; font-size: 12px; opacity: .85; }
.me-status { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; text-align: left; padding: 4px; border-radius: 8px; color: inherit; }
.me-status:hover { background: var(--side-hover); }
.me-status .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.dnd-dot { position: absolute; right: -6px; bottom: -6px; font-size: 11px; }
.status-menu { width: 300px; }
.status-head { display: flex; align-items: center; gap: 10px; padding: 6px 10px 10px; }
.status-head > div { display: flex; flex-direction: column; min-width: 0; }
.status-head .muted { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-sep { border-top: 1px solid var(--border); margin: 4px 0; }
.menu-label { font-size: 12px; font-weight: 700; color: var(--muted); padding: 6px 10px 2px; }
.menu-label small { font-weight: 400; }
.profile-status { margin-top: 6px; font-size: 14px; }
.profile-status small { color: var(--muted); }
.status-input { display: flex; gap: 8px; align-items: center; border: 1px solid var(--border); border-radius: 8px; padding: 4px; }
.status-emoji-btn { width: 40px; height: 40px; border: 0; border-radius: 6px; background: var(--bg-soft); font-size: 22px; flex: none; }
.modal-card .status-input input { border: 0; margin: 0; outline: none; }
.status-presets { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.status-presets button { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; text-align: left; padding: 7px 8px; border-radius: 6px; }
.status-presets button:hover { background: var(--bg-hover); }
.status-presets small { color: var(--muted); margin-left: auto; }

/* ---------- Autocompletar ---------- */
.composer-wrap { position: relative; }
.autocomplete {
  position: absolute; left: 18px; right: 18px; bottom: calc(100% - 4px); z-index: 25; background: var(--bg);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; max-height: 320px; overflow-y: auto;
}
.ac-title { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 8px 6px; }
.ac-title span { font-weight: 400; }
.ac-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; }
.ac-item .muted { overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.ac-item.active { background: var(--brand); color: #fff; }
.ac-item.active .muted { color: rgba(255,255,255,.8); }
.ac-icon { width: 22px; text-align: center; font-size: 17px; flex: none; }
.ac-online { color: var(--online); font-size: 10px; }

/* ---------- Selector de emoji ---------- */
.picker { display: flex; flex-direction: column; width: 352px; max-width: calc(100vw - 16px); height: 380px; max-height: calc(100vh - 16px); padding: 8px; gap: 6px; }
.picker-search { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); }
.picker-tabs { display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.picker .picker-tabs button { font-size: 17px; height: 30px; width: 34px; }
.picker-body { flex: 1; overflow-y: auto; }
.picker-title { font-size: 12px; font-weight: 700; color: var(--muted); padding: 8px 2px 4px; position: sticky; top: 0; background: var(--bg); }
.picker-grid { display: grid; grid-template-columns: repeat(8, 1fr); }
.picker .emoji-cell { font-size: 22px; height: 38px; }
.picker-empty { padding: 20px; text-align: center; }

/* ---------- Foto de perfil ---------- */
img.avatar.photo { object-fit: cover; background: var(--bg-soft); padding: 0; display: block; }
img.avatar.xs { display: inline-block; vertical-align: middle; }
.profile-body img.avatar.lg { position: relative; margin-top: -36px; border: 4px solid var(--bg); }
.avatar-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.modal-card label.btn { display: inline-flex; align-items: center; gap: 4px; margin: 0; cursor: pointer; font-weight: 600; }

/* ---------- Silenciar y archivar ---------- */
.side-item.muted { opacity: .55; }
.side-item.muted:hover, .side-item.muted.active { opacity: 1; }
.mute-icon { font-size: 11px; flex: none; }
.archived-section .cat-toggle { font-style: italic; }
.archived-banner {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 4px; border: 1px dashed var(--border);
  border-radius: var(--radius); background: var(--bg-soft); color: var(--muted); font-size: 14px;
}
.archived-banner strong { color: var(--fg); }
.ch-header h1 .pill { font-size: 11px; font-weight: 600; }
.archive-zone { border-color: var(--border); }

/* ---------- Vista previa de enlaces ---------- */
.link-preview {
  position: relative; display: flex; gap: 12px; margin-top: 6px; max-width: 520px; padding: 8px 12px; border-left: 4px solid var(--border);
  background: var(--bg-soft); border-radius: 0 8px 8px 0;
}
.lp-body { flex: 1; min-width: 0; }
.lp-site { font-size: 12px; color: var(--muted); font-weight: 600; }
.lp-title { display: block; font-weight: 700; color: #1264a3; text-decoration: none; margin: 1px 0 2px; }
.lp-title:hover { text-decoration: underline; }
.lp-desc { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lp-image { flex: none; align-self: center; }
.lp-image img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; display: block; }
.lp-remove {
  position: absolute; top: 2px; right: 4px; border: 0; background: transparent; color: var(--muted); font-size: 16px;
  width: 22px; height: 22px; border-radius: 4px; display: none;
}
.msg:hover .lp-remove { display: block; }
.lp-remove:hover { background: var(--bg-hover); color: var(--danger); }
.link-preview:has(.lp-remove) .lp-image { margin-right: 18px; }

/* ---------- Iconos vectoriales (Lucide) ---------- */
.icon {
  width: 18px; height: 18px; flex: none; vertical-align: -0.22em;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icon.sm { width: 16px; height: 16px; }
.icon.xs { width: 13px; height: 13px; stroke-width: 2.25; vertical-align: -0.15em; }
.icon.lg { width: 22px; height: 22px; }

/* Botones de icono: gris en reposo, color de texto al pasar por encima */
.icon-btn { color: var(--muted); }
.icon-btn:hover { color: var(--fg); }
.ch-actions .icon-btn.active, .ch-actions #call-btn.live { color: var(--fg); }
.ch-actions #call-btn.live { color: #fff; }
.ch-actions #mute-btn.active { color: var(--danger); }
.side-title .icon-btn, .cat-title .icon-btn { display: inline-grid; place-items: center; }
.ws-chev { display: inline-grid; place-items: center; }

/* Barra lateral */
.side-item .hash { display: inline-grid; place-items: center; width: 18px; opacity: .85; }
.side-item.active .hash, .nav-item.active .hash { opacity: 1; }
.chev { display: inline-grid; place-items: center; width: 14px; }
.mute-icon { display: inline-grid; place-items: center; color: var(--side-muted); }
.search-wrap { position: relative; }
.search-wrap .icon { position: absolute; left: 21px; top: 50%; margin-top: 2px; transform: translateY(-50%); color: var(--side-muted); pointer-events: none; }
.search-wrap input { padding-left: 30px; }
.me-bar .icon-btn { width: 30px; height: 30px; }
.dnd-badge { display: inline-grid; place-items: center; color: var(--muted); vertical-align: middle; }
.dnd-dot { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--side-bg); color: #f5cf6a; }
.owner-crown { color: #d4a017; display: inline-grid; place-items: center; }
.call-tag { display: inline-flex; align-items: center; gap: 2px; }

/* Cabecera, menús y paneles */
.ch-icon { display: inline-grid; place-items: center; }
.ch-header h1 .pill { gap: 4px; }
.ch-topic { cursor: default; }
.ch-topic.editable { cursor: pointer; }
.popover.menu button { display: flex; align-items: center; gap: 10px; }
.popover.menu button .icon { color: var(--muted); }
.popover.menu button:hover .icon, .popover.menu button.danger .icon { color: inherit; }
.menu-label { display: flex; align-items: center; gap: 6px; }
.panel-header strong { display: inline-flex; align-items: center; gap: 8px; }
.li-reason { display: inline-flex; align-items: center; gap: 4px; }
.pinned-label, .li-files { display: flex; align-items: center; gap: 4px; }
.saved-label { color: var(--brand); display: inline-grid; place-items: center; }
.pill { gap: 4px; }
.ok-text { color: var(--online); display: inline-flex; align-items: center; gap: 4px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.full { display: flex; }
.archived-banner > .icon { color: var(--muted); }
.notice .icon, .perm-row strong .icon, .hint .icon { color: var(--muted); }
.perm-row strong { display: inline-flex; align-items: center; gap: 6px; }
.twofa-title strong { display: flex; align-items: center; gap: 8px; }
.twofa-title strong .icon { color: var(--brand); }

/* Mensajes */
.actions button { display: inline-grid; place-items: center; color: var(--muted); }
.actions button:hover { color: var(--fg); }
.actions button.on { color: var(--brand); }
.reaction.add { color: var(--muted); padding: 0 6px; }
.reaction.add .icon { width: 15px; height: 15px; }
.lp-remove, .pending-item button, .role-chip button { display: inline-grid; place-items: center; }
.send-btn { display: inline-grid; place-items: center; }
.send-btn .icon { width: 17px; height: 17px; }
.attach-btn { width: 30px; height: 30px; }
.ac-icon { display: inline-grid; place-items: center; }
.ac-icon .icon { color: var(--muted); }
.ac-item.active .ac-icon .icon { color: #fff; }

/* Iconos de tipo de archivo, con color por tipo */
.file-icon {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; flex: none;
  background: color-mix(in srgb, currentColor 14%, transparent); color: #64748b;
}
.file-icon .icon { width: 20px; height: 20px; }
.file-icon.kind-pdf { color: #dc2626; }
.file-icon.kind-doc { color: #2563eb; }
.file-icon.kind-sheet { color: #16a34a; }
.file-icon.kind-slides { color: #ea580c; }
.file-icon.kind-zip { color: #a16207; }
.file-icon.kind-image { color: #9333ea; }
.file-icon.kind-video { color: #db2777; }
.file-icon.kind-audio { color: #0d9488; }
.file-icon.kind-code { color: #475569; }
.pending-item .file-icon { width: 40px; height: 40px; font-size: inherit; }

/* Llamadas */
.call-ctl { display: inline-grid; place-items: center; }
.call-ctl .icon { width: 20px; height: 20px; }
.tile-label { display: flex; align-items: center; gap: 4px; }
.ring .btn .icon { width: 15px; height: 15px; }

/* Ajustes */
.tri button { display: inline-grid; place-items: center; }
.btn-group .btn { padding: 4px 8px; }
.role-row small { display: inline-grid; place-items: center; }

/* Selector de emoji */
.picker-tabs button { display: inline-grid; place-items: center; color: var(--muted); }
.picker-tabs button:hover { color: var(--fg); }

/* ---------- Correo corporativo y acceso ---------- */
.link-btn { border: 0; background: transparent; color: var(--brand); font-size: 14px; padding: 8px 0 0; display: block; margin: 0 auto; }
.link-btn:hover { text-decoration: underline; }
.auth-step .btn { width: 100%; padding: 10px; margin-bottom: 6px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { flex: 1; min-width: 220px; margin: 0 !important; }
.inline-form .btn { flex: none; }
#setup-email .inline-form input { display: block; width: 100%; margin-top: 6px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); }
#setup-email .inline-form label { font-weight: 600; font-size: 14px; }
#setup-email-logout { margin-top: 14px; }
.email-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; }
.email-row .grow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.outbox-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.outbox-row > .icon { color: var(--muted); }
.field-title .btn { margin-left: 8px; text-transform: none; letter-spacing: 0; }
.notice > .icon:first-child { margin-right: 4px; }

/* ---------- Móvil ---------- */
/* En pantallas medianas los paneles laterales se superponen por la derecha en vez de estrechar la conversación. */
@media (max-width: 1100px) {
  .side-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 30; box-shadow: var(--shadow); max-width: 100vw; }
}
@media (max-width: 900px) {
  .side-panel { position: fixed; inset: 0; width: auto; z-index: 30; border-left: 0; }
}
@media (max-width: 768px) {
  .menu-btn { display: inline-grid; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; width: 280px; }
  .app.side-open .sidebar { transform: none; }
  .app.side-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .ch-header { padding: 8px 12px; }
  .msg { padding-left: 16px; padding-right: 16px; }
  .composer-wrap { padding: 0 12px 4px; }
  .actions { right: 8px; }
  .modal { padding: 0; }
  .modal-card.wide { height: 100%; max-height: none; border-radius: 0; }
  .settings { flex-direction: column; }
  .settings-nav { width: auto; flex-direction: row; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--border); flex: none; }
  .settings-nav-title { display: none; }
  .settings-nav button { white-space: nowrap; }
  .settings-body { padding: 16px; }
  .editor-actions.sticky { bottom: -16px; }
  .roles-layout, .ow-layout { flex-direction: column; }
  .roles-list, .ow-targets { width: 100%; position: static; }
  .member-admin { flex-wrap: wrap; }
  .twofa-setup { flex-direction: column; align-items: center; }
  .call-stage { height: 55vh; }
  .call-people { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .ch-actions .icon-btn { width: 30px; }
  .ring { left: 12px; right: 12px; bottom: 12px; flex-wrap: wrap; }
}

/* ---------- Integraciones: mensajes de apps ---------- */
.app-badge {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .03em; line-height: 1;
  padding: 3px 4px; border-radius: 3px; background: var(--code-bg); color: var(--muted); vertical-align: 2px; margin-left: 4px;
}
.emoji-avatar { display: grid; place-items: center; font-size: 22px; background: var(--bg-soft); }
.msg-card {
  border-left: 4px solid var(--card-color, var(--border)); border-radius: 4px;
  padding: 6px 12px; margin: 6px 0 2px; max-width: 620px; background: var(--bg-soft);
}
.card-pretext { margin-top: 2px; }
.card-author { font-size: 13px; color: var(--muted); font-weight: 600; }
.card-title { font-weight: 700; }
.card-title a, .card-author a { color: var(--brand); text-decoration: none; }
.card-title a:hover, .card-author a:hover { text-decoration: underline; }
.card-text { margin-top: 2px; }
.card-fields { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 6px; }
.card-field { flex: 1 1 100%; min-width: 0; }
.card-field.short { flex: 1 1 calc(50% - 16px); }
.card-field-title { font-weight: 700; font-size: 13px; }
.card-footer { margin-top: 6px; font-size: 12px; color: var(--muted); }

/* ---------- Integraciones: ajustes ---------- */
.app-list { margin-top: 12px; }
.app-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  border: 0; border-bottom: 1px solid var(--border); background: none; padding: 12px 4px;
}
.app-row:hover { background: var(--bg-hover); }
.app-row .pill { margin-left: 4px; }
.app-create { border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin: 12px 0; }
.app-head { display: flex; align-items: center; gap: 14px; margin: 14px 0 6px; }
.app-head-name { font-size: 18px; font-weight: 700; }
.scope-list { display: grid; gap: 2px; margin-bottom: 8px; }
.scope-row { display: flex !important; gap: 10px; align-items: flex-start; padding: 6px 4px; border-radius: 6px; margin: 0 !important; font-weight: 400 !important; }
.scope-row:hover { background: var(--bg-hover); }
.modal-card .scope-row input { display: inline-block; width: auto; flex: none; margin: 4px 0 0; padding: 0; }
.scope-row > span { flex: 1; min-width: 0; }
.scope-row small { display: block; color: var(--muted); font-size: 12px; }
.scope-row.disabled { opacity: .55; }
.reveal-box {
  border: 1px solid var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent);
  border-radius: 8px; padding: 12px 14px; margin: 12px 0;
}
.reveal-box > strong { display: flex; align-items: center; gap: 6px; }
.reveal-box small { display: block; color: var(--muted); font-size: 12px; }
.copy-row { display: flex; gap: 8px; margin: 8px 0; }
.copy-row input { flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.code-sample {
  background: var(--code-bg); border-radius: 6px; padding: 10px 12px; font-size: 12px;
  overflow-x: auto; white-space: pre; margin: 0 0 12px;
}
.delivery-list { border: 1px solid var(--border); border-radius: 8px; max-height: 260px; overflow-y: auto; margin-bottom: 8px; }
.delivery-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
.delivery-row:last-child { border-bottom: 0; }
.delivery-row small { color: var(--muted); white-space: nowrap; }
.delivery-status { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; min-width: 54px; }
.delivery-row.ok .delivery-status { color: var(--online); }
.delivery-row.bad .delivery-status { color: var(--danger); }
.delivery-row .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: inherit; }

/* ---------- Productividad ---------- */
.send-group { display: inline-flex; flex: none; }
.send-group .send-btn { border-radius: 6px 0 0 6px; }
.send-more {
  border: 0; border-left: 1px solid rgba(255,255,255,.25); background: var(--brand); color: #fff;
  border-radius: 0 6px 6px 0; width: 22px; height: 32px; display: grid; place-items: center; padding: 0;
}
.send-more:hover { background: var(--brand-strong); }
.composer.disabled .send-more { opacity: .4; cursor: not-allowed; }
.draft-icon { color: var(--side-muted); margin-left: auto; display: inline-flex; }
.side-item .count { margin-left: auto; font-size: 12px; color: var(--side-muted); }
.unread-sep { position: relative; text-align: right; margin: 8px 20px 2px; }
.unread-sep::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--danger); }
.unread-sep span { position: relative; background: var(--bg); color: var(--danger); font-size: 11px; font-weight: 800; padding: 0 6px; text-transform: uppercase; letter-spacing: .04em; }

/* Selección para reenviar */
.select-box { flex: none; border: 0; background: none; color: var(--muted); padding: 6px 0 0; align-self: flex-start; }
.msg.selected { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.msg.selected .select-box { color: var(--brand); }
.selection-bar {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--brand); border-radius: var(--radius);
  padding: 8px 10px; background: var(--bg); margin-bottom: 4px;
}
.selection-bar .grow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.scheduled-hint { font-size: 12px; color: var(--muted); padding: 2px 4px 4px; display: flex; align-items: center; gap: 4px; }
.link-btn { border: 0; background: none; color: #1264a3; padding: 0; font: inherit; font-size: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* Reenviados */
.forward { border-left: 3px solid var(--border); padding: 2px 0 2px 10px; margin: 4px 0; }
.forward.can-open { cursor: pointer; }
.forward.can-open:hover { border-left-color: var(--brand); }
.fw-head { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.fwd-preview { font-size: 13px; border-left: 3px solid var(--border); padding: 2px 8px; margin-bottom: 6px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fwd-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; margin: 8px 0 14px; padding: 4px; }
.modal-card .fwd-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; margin: 0; font-weight: 400; cursor: pointer; }
.modal-card .fwd-item input { width: auto; margin: 0; display: inline-block; }
.fwd-item:hover, .fwd-item.on { background: var(--bg-hover); }
.fwd-item .muted { margin-left: 4px; font-size: 13px; }
.modal-card textarea { width: 100%; margin-top: 6px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--fg); font: inherit; resize: vertical; }

/* Confirmaciones de lectura */
.msg-foot { float: right; display: inline-flex; align-items: center; gap: 4px; margin: 3px 0 0 10px; font-size: 11px; color: var(--muted); line-height: 1; }
.msg-foot:empty { display: none; }
.receipt {
  display: inline-flex; align-items: center; gap: 2px; border: 0; background: none;
  color: var(--muted); font-size: 11px; padding: 0; line-height: 1;
}
.receipt.read { color: #34b7f1; }
button.receipt:hover { color: var(--fg); }
.popover.receipts-pop { padding: 8px; min-width: 220px; max-height: 340px; overflow-y: auto; }
.receipt-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; font-size: 14px; }
.menu-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 6px 8px 4px; display: flex; align-items: center; gap: 4px; }
.small { font-size: 13px; }

/* Encuestas */
.poll { margin: 6px 0 2px; max-width: 460px; display: flex; flex-direction: column; gap: 6px; }
.poll-opt {
  position: relative; display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; overflow: hidden;
  border: 1px solid var(--border); background: var(--bg); border-radius: 8px; padding: 8px 10px;
}
.poll-opt:hover:not(:disabled) { border-color: var(--brand); }
.poll-opt:disabled { cursor: default; }
.poll-opt.mine { border-color: var(--brand); }
.poll-bar { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--brand) 14%, transparent); transition: width .3s; }
.poll-check, .poll-label, .poll-count { position: relative; }
.poll-check { color: var(--muted); display: inline-flex; }
.poll-opt.mine .poll-check { color: var(--brand); }
.poll-label { flex: 1; min-width: 0; font-weight: 600; }
.poll-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.poll-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.poll.closed .poll-opt { opacity: .85; }
.poll-edit-row { display: flex; gap: 6px; align-items: center; }
.modal-card .poll-edit-row input { margin-top: 0; margin-bottom: 8px; }

/* Listas: recordatorios y programados */
.li-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.li-error { color: var(--danger); font-size: 13px; display: flex; align-items: center; gap: 4px; margin: 4px 0; }
.list-item.failed { border-color: var(--danger); }
.list-item.reminder.due { border-color: var(--brand); box-shadow: inset 3px 0 0 var(--brand); }
.list-item.reminder.done { opacity: .65; }
.rem-new { display: flex; gap: 6px; margin-bottom: 12px; }
.rem-new input { flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--fg); font: inherit; }

/* Directorio */
.dir-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.modal-card .dir-filters input { flex: 1; min-width: 200px; margin-top: 0; width: auto; }
.dir-filters select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--fg); font: inherit; }
.dir-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; max-height: 60vh; overflow-y: auto; }
.dir-card { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.dir-card .avatar-wrap { position: relative; }
.dir-card .name { font-weight: 700; }
.dir-line { font-size: 13px; display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.profile-job { font-size: 14px; margin-top: 4px; }
.profile-time { font-size: 13px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 2px; }
.form-grid.even { grid-template-columns: 1fr 1fr; }
.modal-card select[name="acct-timezone"] { display: block; width: 100%; margin-top: 6px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--fg); font: inherit; font-weight: 400; }
.search-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }

/* Buscador rápido y atajos */
.modal-card.switcher-card { padding: 0; width: min(560px, calc(100vw - 32px)); align-self: flex-start; margin-top: 12vh; }
.modal-card.switcher-card #sw-input { margin: 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 16px 18px; font-size: 17px; outline: none; background: transparent; }
.sw-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.sw-list .ac-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.sw-list .ac-item .muted { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-list .ac-item.active { background: var(--brand); color: #fff; }
.sw-list .ac-item.active .muted { color: rgba(255,255,255,.8); }
.sw-unread { background: var(--danger); color: #fff; border-radius: 9px; font-size: 11px; font-weight: 700; padding: 0 6px; }
.sw-help { display: flex; gap: 14px; flex-wrap: wrap; padding: 8px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
table.shortcuts { width: 100%; border-collapse: collapse; }
table.shortcuts td { padding: 8px 6px; border-bottom: 1px solid var(--border); }
kbd { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--bg-soft); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 2px 6px; white-space: nowrap; }

.h2-icon { display: inline-flex; align-items: center; gap: 8px; }


/* Mis mensajes a la derecha: el mismo estilo de Slack (foto, nombre y hora), pero en espejo */
body.bubbles .msg.mine { flex-direction: row-reverse; }
body.bubbles .msg.mine .body { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
body.bubbles .msg.mine .body > * { max-width: 100%; }
body.bubbles .msg.mine .meta { flex-direction: row-reverse; }
body.bubbles .msg.mine .hover-time { text-align: left; }
body.bubbles .msg.mine .reactions { justify-content: flex-end; }
body.bubbles .msg.mine .text blockquote { border-left: 0; border-right: 4px solid var(--border); padding: 0 10px 0 0; }
body.bubbles .msg.mine .forward { border-left: 0; border-right: 3px solid var(--border); padding: 2px 10px 2px 0; }
body.bubbles .msg.mine .fw-head { justify-content: flex-end; }
body.bubbles .msg.mine .text pre, body.bubbles .msg.mine .msg-card, body.bubbles .msg.mine .poll,
body.bubbles .msg.mine .attachments, body.bubbles .msg.mine .link-preview { text-align: left; }
body.bubbles .msg.mine .poll { width: 460px; }
body.bubbles .msg.mine .pinned-label { align-self: flex-end; }
body.bubbles .msg.mine .actions { right: auto; left: 16px; }
body.bubbles .msg.mine.editing .body { align-items: stretch; text-align: left; }
body.bubbles .msg.mine .msg-foot { margin: 3px 0 0; }

/* ---------- Reuniones (servidor de medios) ---------- */
.call-grid { display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.call-focus { display: none; }
.call-grid.has-focus { flex-direction: row; }
.call-grid.has-focus .call-focus { display: grid; flex: 1; min-width: 0; gap: 8px; grid-auto-rows: 1fr; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.call-people { flex: 1; min-height: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); grid-auto-rows: minmax(0, 1fr); overflow-y: auto; }
.call-grid[data-size="s"] .call-people[data-count="1"] { grid-template-columns: minmax(0, 640px); justify-content: center; }
.call-grid[data-size="l"] .call-people { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.call-grid[data-size="xl"] .call-people { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); grid-auto-rows: 100px; }
.call-grid.has-focus .call-people { flex: 0 0 210px; grid-template-columns: 1fr; grid-auto-rows: 118px; align-content: start; }
.call-grid .tile { min-height: 90px; cursor: pointer; }
.call-grid .tile.pinned { outline-color: var(--brand); }
.call-grid[data-size="xl"] .tile .avatar.lg { width: 44px; height: 44px; font-size: 16px; }
.call-rec { display: flex; align-items: center; gap: 8px; justify-content: center; color: #fff; background: rgba(209,52,75,.85); font-size: 13px; font-weight: 600; padding: 4px 10px; }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: #fff; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.rec-text { color: var(--danger); font-weight: 700; }
.call-ctl#ctl-record .icon { color: #ff5a6e; fill: #ff5a6e; }
.call-ctl#ctl-record.recording { background: var(--danger); }
.call-ctl#ctl-record.recording .icon { color: #fff; fill: #fff; animation: blink 1.2s infinite; }
@media (max-width: 768px) {
  .call-grid.has-focus { flex-direction: column; }
  .call-grid.has-focus .call-people { flex: 0 0 110px; grid-auto-flow: column; grid-auto-columns: 140px; grid-template-columns: none; grid-auto-rows: 100%; overflow-x: auto; }
}

/* ---------- Pestaña «Archivos» ---------- */
.files-tools { position: sticky; top: -10px; background: var(--bg); padding: 0 0 8px; z-index: 1; }
.files-tools input { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--fg); font: inherit; }
.files-types { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.chip { border: 1px solid var(--border); background: var(--bg); border-radius: 14px; padding: 2px 10px; font-size: 12px; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.file-row { display: flex; align-items: center; gap: 2px; border-bottom: 1px solid var(--border); padding: 4px 0; }
.file-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; padding: 6px 4px; border-radius: 6px; }
.file-main:hover { background: var(--bg-hover); }
.file-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; flex: none; }
.file-info { min-width: 0; display: flex; flex-direction: column; }
.file-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.file-info small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Reuniones y eventos ---------- */
.event-card { display: flex; gap: 12px; border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: 8px; padding: 10px 12px; margin: 6px 0 2px; max-width: 620px; background: var(--bg); text-align: left; }
.event-card.cancelled { border-left-color: var(--danger); opacity: .75; }
.event-card.cancelled .ev-title { text-decoration: line-through; }
.event-card.finished { border-left-color: var(--border); opacity: .8; }
.ev-date { flex: none; width: 48px; border: 1px solid var(--border); border-radius: 8px; text-align: center; overflow: hidden; align-self: flex-start; }
.ev-month { display: block; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 1px 0; }
.ev-day { display: block; font-size: 20px; font-weight: 800; padding: 2px 0 3px; }
.ev-body { flex: 1; min-width: 0; }
.ev-title { font-weight: 800; font-size: 15px; }
.ev-when, .ev-where { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.ev-desc { font-size: 14px; margin-top: 6px; }
.ev-people { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.ev-people .avatar.xs { margin-right: -6px; border: 2px solid var(--bg); }
.ev-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ev-actions .btn.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.ev-kind { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.ev-kind .radio { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin: 0; }
.form-grid.three { grid-template-columns: 1.4fr 1fr 1fr; }
.cal-item { display: flex; gap: 10px; align-items: flex-start; }
.cal-item.now { border-color: var(--brand); box-shadow: inset 3px 0 0 var(--brand); }
.cal-time { width: 52px; flex: none; font-weight: 700; font-size: 14px; display: flex; flex-direction: column; }
.cal-time small { color: var(--muted); font-weight: 400; }
.cal-title { font-weight: 700; display: flex; align-items: center; gap: 4px; }
.cal-status { display: flex; align-items: center; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.list-items > .btn.full { margin-bottom: 10px; }
.event-alert { bottom: auto; top: 20px; }
.ev-alert-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }

/* ---------- Crear canal privado y categoría: listas para elegir ---------- */
.private-who { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pick-list { max-height: 210px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 4px; margin-top: 4px; }
.modal-card .pick-item { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; margin: 0; font-weight: 400; cursor: pointer; font-size: 14px; }
.modal-card .pick-item input { width: auto; margin: 0; display: inline-block; }
.pick-item:hover { background: var(--bg-hover); }
.pick-item:has(input:checked) { background: color-mix(in srgb, var(--brand) 12%, transparent); }
.modal-card .pick-filter { margin-top: 4px; padding: 6px 9px; font-size: 13px; }
@media (max-width: 600px) {
  .private-who, .ev-kind, .form-grid.three { grid-template-columns: 1fr; }
}
.ev-people > span { display: inline-flex; align-items: center; gap: 0; }
.ev-people .avatar.xs:last-of-type { margin-right: 6px; }

/* ===========================================================================
   Repaso de la interfaz: cabecera con pestañas, vistas a pantalla completa,
   calendario mensual, «+» del cuadro de texto y barra lateral ordenable
   =========================================================================== */

/* Cabecera: tres botones */
.ch-actions { gap: 6px; align-items: center; }
.hdr-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg); color: var(--fg); font-size: 13px; font-weight: 600;
}
.hdr-btn:hover { background: var(--bg-hover); }
.hdr-btn.active { background: var(--bg-hover); border-color: var(--muted); }
#call-btn.live { background: var(--online); border-color: var(--online); color: #fff; }
#members-count:empty { display: none; }

/* Pestañas del canal */
.ch-tabs { display: flex; gap: 2px; padding: 0 16px; border-bottom: 1px solid var(--border); flex: none; overflow-x: auto; }
.ch-tabs button {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--muted); font-size: 13px; font-weight: 600;
  padding: 8px 10px 7px; border-bottom: 2px solid transparent; white-space: nowrap;
}
.ch-tabs button:hover { color: var(--fg); }
.ch-tabs button.active { color: var(--fg); border-bottom-color: var(--brand); }
.tab-count { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 9px; font-size: 11px; padding: 0 6px; color: var(--muted); }

/* Vista de pestaña (archivos, fijados) en lugar de los mensajes */
.tab-view { display: none; flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px 30px; }
.main.tab-other .tab-view { display: block; }
.main.tab-other #messages, .main.tab-other > .composer-wrap, .main.tab-other > .drop-hint { display: none !important; }
.tab-tools { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.search-box { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; background: var(--bg); max-width: 520px; }
.search-box input { flex: 1; border: 0; outline: 0; background: transparent; padding: 8px 0; color: var(--fg); font: inherit; }
.search-box .icon { color: var(--muted); }
.files-table { display: flex; flex-direction: column; }
.ft-head, .ft-row { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1.3fr) minmax(0, 1.3fr) 90px 76px; gap: 10px; align-items: center; }
.ft-head { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 0 8px 6px; border-bottom: 1px solid var(--border); }
.ft-row { padding: 4px 8px; border-bottom: 1px solid var(--border); border-radius: 6px; }
.ft-row:hover { background: var(--bg-hover); }
.ft-name { display: flex; align-items: center; gap: 10px; min-width: 0; border: 0; background: none; padding: 4px 0; text-align: left; color: inherit; text-decoration: none; }
.ft-cell { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ft-actions { display: flex; justify-content: flex-end; }
.files-table > .btn { align-self: center; margin-top: 12px; }
.file-icon.kind-link { color: var(--brand); }
.pins-view { max-width: 820px; }
@media (max-width: 768px) {
  .ft-head { display: none; }
  .ft-row { grid-template-columns: minmax(0, 1fr) auto; }
  .ft-row .ft-cell { display: none; }
}

/* Calendario a pantalla completa */
.calendar-view { display: none; flex: 1; min-height: 0; flex-direction: column; }
.main.view-calendar .calendar-view { display: flex; }
.main.view-calendar > :not(.calendar-view) { display: none !important; }
.cal-header { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.cal-header h1 { font-size: 17px; margin: 0; display: flex; align-items: center; gap: 8px; }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-month { font-weight: 700; margin-left: 6px; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.cal-weekdays span { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: 6px 0; }
.cal-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(6, minmax(0, 1fr)); }
.cal-cell {
  display: flex; flex-direction: column; gap: 2px; align-items: stretch; text-align: left; min-height: 0; overflow: hidden;
  border: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--bg); padding: 4px 6px; color: var(--fg);
}
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell:hover { background: var(--bg-hover); }
.cal-cell.outside { color: var(--muted); background: var(--bg-soft); }
.cal-cell.selected { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-num { font-size: 13px; font-weight: 700; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; flex: none; }
.cal-cell.today .cal-num { background: var(--danger); color: #fff; }
.cal-chip {
  font-size: 12px; line-height: 1.35; padding: 1px 6px; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: color-mix(in srgb, var(--muted) 16%, transparent); flex: none;
}
.cal-chip.meeting { background: color-mix(in srgb, var(--brand) 18%, transparent); }
.cal-chip.declined { opacity: .55; text-decoration: line-through; }
.cal-more { font-size: 11px; color: var(--muted); padding-left: 6px; }
.cal-desc { margin: 4px 0; max-height: 4.5em; overflow: hidden; }
@media (max-width: 768px) {
  .cal-chip { font-size: 10px; padding: 0 3px; }
  .cal-chip b { display: none; }
}

/* «Más tarde»: pestañas en el título del panel */
.panel-tabs { display: inline-flex; gap: 2px; }
.panel-tabs button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 700; padding: 4px 8px; border-radius: 6px; }
.panel-tabs button:hover { background: var(--bg-hover); color: var(--fg); }
.panel-tabs button.active { background: var(--bg-hover); color: var(--fg); }

/* Cuadro de texto: botón «+» */
.plus-btn { border-radius: 50%; background: var(--bg-soft); }
.plus-btn:hover { background: var(--bg-hover); }

/* Barra lateral: cerrar mensajes directos y arrastrar */
.side-item .dm-close { display: none; margin-left: auto; border: 0; background: none; color: var(--side-muted); padding: 2px; border-radius: 4px; }
.side-item:hover .dm-close { display: inline-flex; }
.side-item:hover .dm-close ~ *, .side-item:hover .badge + .dm-close { margin-left: 4px; }
.side-item .dm-close:hover { color: #fff; background: var(--side-hover); }
.side-item:hover .badge { display: none; }
.side-empty { color: var(--side-muted); font-size: 13px; padding: 4px 16px; }
[draggable="true"] { cursor: grab; }
.dragging { opacity: .4; }
.side-item.drop-before { box-shadow: inset 0 2px 0 var(--side-active); }
.side-item.drop-after { box-shadow: inset 0 -2px 0 var(--side-active); }
.category.drop-before { box-shadow: 0 -2px 0 var(--side-active); }
.category.drop-after { box-shadow: 0 2px 0 var(--side-active); }
.cat-title.drop-into, .side-list.drop-into { background: var(--side-hover); border-radius: 6px; }
.side-list[data-cat=""]:empty { min-height: 6px; }
/* «Programar el envío» está en el menú «+»: la flecha junto a «Enviar» sobra. */
.send-more { display: none; }
.send-group .send-btn { border-radius: 6px; }

/* ===========================================================================
   Comandos con barra: lista, pista mientras se escribe y respuestas «solo para ti»
   =========================================================================== */
.autocomplete { max-height: 340px; overflow-y: auto; }
.cmd-main { display: flex; align-items: baseline; gap: 6px; min-width: 0; flex: 1; overflow: hidden; }
.cmd-usage { color: var(--muted); font-size: 13px; white-space: nowrap; }
.cmd-desc { margin-left: 6px; overflow: hidden; text-overflow: ellipsis; }
.ac-item.active .cmd-usage { color: rgba(255,255,255,.8); }
.ac-item .pill { flex: none; font-size: 11px; }
.autocomplete.cmd-hint .ac-title { padding-bottom: 2px; }
.autocomplete.cmd-hint .ac-title strong { color: var(--fg); }
.cmd-preview { padding: 2px 8px 6px; font-size: 13px; color: var(--fg); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cmd-preview .icon { color: var(--muted); }
.ephemeral-list:empty { display: none; }
.ephemeral-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; max-height: 40vh; overflow-y: auto; }
.ephemeral {
  position: relative; border: 1px solid var(--border); border-left: 3px solid var(--brand); border-radius: 8px;
  background: var(--bg-soft); padding: 8px 36px 8px 12px; font-size: 14px;
}
.ephemeral > [data-eph-close] { position: absolute; top: 4px; right: 4px; }
.eph-only { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.eph-from { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.cmd-help { display: grid; gap: 4px; margin-top: 4px; }
.cmd-help > div { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 10px; font-size: 13px; }
.cmd-help code { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-help span { color: var(--muted); }
@media (max-width: 768px) {
  .cmd-help > div { grid-template-columns: 1fr; gap: 0; }
  .cmd-desc { display: none; }
}
.command-form { margin-top: 8px; }

/* Botones de las apps en los mensajes */
.app-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.app-btn { text-decoration: none; }
.app-btn.app-btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.app-btn.app-btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.app-btn.app-btn-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.app-btn.busy { opacity: .6; cursor: progress; }

/* ===========================================================================
   Barra de formato, listas en los mensajes
   =========================================================================== */
.composer { flex-wrap: wrap; }
.format-bar { display: none; flex-basis: 100%; gap: 2px; padding: 0 0 4px; margin: -2px 0 2px -6px; border-bottom: 1px solid var(--border); }
.composer.formatting .format-bar { display: flex; }
.format-bar .icon-btn { width: 28px; height: 28px; }
[data-format-btn].active { color: var(--brand); background: var(--bg-hover); }
.msg .text ul, .msg .text ol, .ephemeral .text ul, .ephemeral .text ol { margin: 2px 0; padding-left: 22px; }
.msg .text li { margin: 1px 0; }

/* Responder citando y respuestas de hilo enviadas también al canal */
.quote-ref, .thread-ref {
  display: flex; align-items: baseline; gap: 6px; max-width: 100%; border: 0; text-align: left; color: var(--fg); font: inherit; font-size: 13px;
  background: var(--bg-soft); border-left: 3px solid var(--muted); border-radius: 4px; padding: 3px 8px; margin: 2px 0 4px; cursor: pointer;
}
.quote-ref:hover, .thread-ref:hover { background: var(--bg-hover); }
.quote-author { font-weight: 700; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.ref-text { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.thread-ref { background: none; border-left: 0; padding: 0; color: var(--muted); }
.thread-ref strong { color: var(--fg); }
.also-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.reply-bar {
  display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 6px 4px 10px; margin-bottom: 4px;
  border-left: 3px solid var(--brand); background: var(--bg-soft); border-radius: 6px;
}
.reply-bar .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.also-channel { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin: 4px 2px 0; cursor: pointer; }
.popover.menu button.danger { color: var(--danger); }
.mention.role { --role-color: var(--brand); color: var(--role-color); background: color-mix(in srgb, var(--role-color) 14%, transparent); }
.mention.role.me { background: color-mix(in srgb, var(--warning, #ecb22e) 25%, transparent); }

/* Avisos: horario y palabras clave */
.schedule-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 4px 0 8px; }
.schedule-row.off { opacity: .45; pointer-events: none; }
.day-chips { display: flex; gap: 4px; }
.day-chip input { position: absolute; opacity: 0; pointer-events: none; }
.day-chip span {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border);
  font-size: 13px; font-weight: 700; cursor: pointer; color: var(--muted);
}
.day-chip input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.day-chip input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.schedule-row label.inline { display: flex; align-items: center; gap: 6px; margin: 0; }
.dnd-badge.off-hours { color: var(--muted); }
.popover.menu button.checked { font-weight: 700; }

/* Emoji propios */
.custom-emoji { height: 1.4em; width: auto; max-width: 3em; vertical-align: -0.35em; object-fit: contain; }
.reaction .custom-emoji { height: 16px; vertical-align: -3px; }
.emoji-cell .custom-emoji { height: 24px; vertical-align: middle; }
.ac-icon .custom-emoji { height: 20px; }
.custom-emoji.big { height: 32px; max-width: 64px; }
.emoji-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.emoji-admin-item { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 8px; padding: 6px 6px 6px 10px; }
.emoji-admin-item code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.emoji-upload input[type=file] { padding: 6px 0; }

/* Vista «No leídos» */
.unreads-view { display: none; flex: 1; min-height: 0; flex-direction: column; }
.main.view-unreads .unreads-view { display: flex; }
.main.view-unreads > :not(.unreads-view) { display: none !important; }
.unreads-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 20px 30px; }
.unread-group { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 14px; overflow: hidden; }
.unread-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--bg-soft); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.unread-title { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--fg); font: inherit; font-size: 15px; padding: 0; cursor: pointer; }
.unread-title:hover strong { text-decoration: underline; }
.unread-msgs .msg { cursor: pointer; }
.unreads-view .msg .actions { display: none !important; }
.unreads-empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.unreads-empty .icon { width: 40px; height: 40px; color: var(--online); }
.unreads-empty h2 { color: var(--fg); margin: 10px 0 4px; }
.badge.muted-badge { background: var(--side-hover); color: var(--side-fg, #fff); }

/* Enlaces fijos del canal, junto a las pestañas */
.ch-tabs { align-items: center; }
.tab-sep { width: 1px; height: 18px; background: var(--border); margin: 0 6px; flex: none; }
.ch-tabs .bookmark { display: inline-flex; align-items: center; border-radius: 6px; flex: none; }
.ch-tabs .bookmark:hover { background: var(--bg-hover); }
.ch-tabs .bookmark a { display: inline-flex; align-items: center; gap: 5px; padding: 5px 2px 5px 8px; color: var(--fg); text-decoration: none; font-size: 13px; max-width: 200px; }
.ch-tabs .bookmark a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-tabs .bookmark a .icon { color: var(--muted); flex: none; }
.ch-tabs .bookmark .bookmark-menu { border: 0; background: none; padding: 4px; color: var(--muted); opacity: 0; border-bottom: 0; }
.ch-tabs .bookmark:hover .bookmark-menu, .ch-tabs .bookmark .bookmark-menu:focus-visible { opacity: 1; }
.ch-tabs .bookmark-add { color: var(--muted); font-weight: 500; padding: 5px 8px; border-radius: 6px; border-bottom: 0; }
.ch-tabs .bookmark-add:hover { background: var(--bg-hover); color: var(--fg); }

/* Notas de voz y vídeos cortos */
.clip-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--border)); border-radius: 10px; background: var(--bg-soft);
}
.clip-bar .rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: rec-blink 1.2s infinite; }
.clip-bar.paused .rec-dot { animation: none; background: var(--muted); }
@keyframes rec-blink { 50% { opacity: .25; } }
.clip-kind { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 13px; }
.clip-time { font-variant-numeric: tabular-nums; font-weight: 700; }
.clip-max { font-size: 12px; }
.clip-preview { width: 160px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: #000; transform: scaleX(-1); }
.att-audio { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 10px; padding: 4px 6px 4px 10px; max-width: 420px; background: var(--bg-soft); }
.att-audio .icon { color: var(--muted); flex: none; }
.att-audio audio { flex: 1; min-width: 0; height: 36px; }
.att-clip video { max-width: min(420px, 100%); max-height: 300px; border-radius: 10px; background: #000; display: block; }
.voice-btn { color: var(--muted); }

/* Canales tipo foro */
.main.forum-mode > .composer-wrap { display: none; }
.forum { max-width: 900px; margin: 0 auto; padding: 14px 20px 30px; }
.forum-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.forum-search { flex: 1; min-width: 200px; }
.forum-bar select { height: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--fg); padding: 0 8px; }
.forum-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.forum-tag-btn, .forum-tag-pick span {
  --tag-color: var(--muted); border: 1px solid color-mix(in srgb, var(--tag-color) 55%, var(--border)); background: none; color: var(--fg);
  border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.forum-tag-btn.on, .forum-tag-pick input:checked + span { background: color-mix(in srgb, var(--tag-color) 22%, transparent); border-color: var(--tag-color); }
.forum-tag-pick input { position: absolute; opacity: 0; pointer-events: none; }
.forum-tag { --tag-color: var(--muted); display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--tag-color) 20%, transparent); color: color-mix(in srgb, var(--tag-color) 70%, var(--fg)); }
.post-list { display: flex; flex-direction: column; gap: 10px; }
.post-card { display: flex; gap: 14px; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--bg); cursor: pointer; }
.post-card:hover { border-color: var(--muted); background: var(--bg-soft); }
.post-card.unread { border-left: 3px solid var(--brand); }
.post-card.pinned { background: color-mix(in srgb, var(--warning, #ecb22e) 6%, var(--bg)); }
.post-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.post-meta { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.post-author { font-weight: 600; }
.post-meta .pill.new { background: var(--brand); color: #fff; border-color: var(--brand); }
.post-card-title { margin: 0; font-size: 16px; line-height: 1.3; }
.post-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.post-excerpt { color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-excerpt ul, .post-excerpt ol { margin: 0; padding-left: 18px; }
.post-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.post-foot > span { display: inline-flex; align-items: center; gap: 4px; }
.post-reaction { border: 1px solid var(--border); border-radius: 999px; padding: 0 6px; }
.post-thumb { width: 110px; height: 80px; object-fit: cover; border-radius: 8px; flex: none; align-self: center; }
.post-head { margin-bottom: 4px; }
.post-title { font-size: 17px; font-weight: 700; line-height: 1.3; }
.post-head .post-tags { margin-top: 4px; }
.tag-edit-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.tag-edit-row input[type=color] { width: 36px; height: 32px; padding: 0; border: 0; background: none; }
.tag-edit-row input[name=name] { flex: 1; }
.kind-pick { display: grid; gap: 6px; margin-bottom: 8px; }
@media (max-width: 768px) {
  .forum { padding: 10px 12px 24px; }
  .post-thumb { width: 72px; height: 56px; }
}

/* Invitados externos */
.guest-badge { background: color-mix(in srgb, #e8912d 22%, transparent); color: #c0701a; }
.invite-kind { display: grid; gap: 6px; grid-column: 1 / -1; }
.invite-form .field-title, .guest-channels { grid-column: 1 / -1; }
.guest-channels { max-height: 180px; overflow-y: auto; }

/* Indicador de carga */
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }


/* Archivos sin permiso de descarga, visor de PDF y YouTube */
.att-file.locked { opacity: .75; }
.att-file.locked .att-info small { display: inline-flex; align-items: center; gap: 3px; }
.viewer-media.pdf { display: block; overflow: auto; padding: 16px; }
.pdf-pages { display: flex; flex-direction: column; gap: 12px; align-items: center; width: 100%; }
.pdf-page { background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.4); max-width: 100%; }
.pdf-loading { color: #fff; padding: 40px; }
.link-preview.video { flex-direction: column; }
.lp-play { position: relative; border: 0; padding: 0; background: #000; border-radius: 8px; overflow: hidden; width: min(480px, 100%); aspect-ratio: 16 / 9; cursor: pointer; display: grid; place-items: center; }
.lp-play img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.play-badge { position: relative; width: 56px; height: 40px; border-radius: 10px; background: rgba(230, 33, 23, .92); color: #fff; display: grid; place-items: center; }
.play-badge .icon { width: 22px; height: 22px; }
.lp-frame { width: min(480px, 100%); aspect-ratio: 16 / 9; border: 0; border-radius: 8px; background: #000; }
.notice ul.plain { margin: 6px 0 4px; padding-left: 18px; }
.notice ul.plain li { margin: 2px 0; }

/* Sesiones de una persona (Ajustes → Miembros) */
.member-sessions { margin: 4px 0 10px 52px; padding: 6px 10px; border-left: 2px solid var(--border); }
.member-sessions .invite-row { padding: 6px 0; }
.member-sessions code { font-size: 12px; }


/* Revisiones de documentos, marca de agua, alertas, auditoría */
.rev-badge { border: 1px solid var(--brand); color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); border-radius: 999px; padding: 0 7px; font-size: 11px; font-weight: 700; cursor: pointer; }
.rev-badge.static { cursor: default; margin-left: 4px; }
.popover.versions { min-width: 320px; }
.popover.versions button { display: flex; gap: 8px; align-items: center; }
.popover.versions .rev-num { font-weight: 700; color: var(--brand); min-width: 48px; }
.popover.versions small { color: var(--muted); }
.in-file { color: var(--brand); }
.watermark { position: absolute; inset: 0; pointer-events: none; overflow: hidden; display: flex; flex-wrap: wrap; gap: 90px 60px; align-content: flex-start; padding: 40px; transform: rotate(-30deg) scale(1.4); transform-origin: center; }
.watermark span { color: rgba(128, 128, 128, .28); font-size: 15px; font-weight: 700; white-space: nowrap; user-select: none; }
.viewer-media { position: relative; }
.audit-row.alert { background: color-mix(in srgb, var(--danger) 10%, transparent); border-radius: 8px; }
.audit-row.alert strong { color: var(--danger); }
.avatar.system { display: inline-grid; place-items: center; background: var(--bg-soft); color: var(--muted); }
.audit-export { margin-bottom: 10px; }

/* ---------- GIF ---------- */
.gif-btn .gif-label { font-size: 10px; font-weight: 800; letter-spacing: .02em; border: 1.5px solid currentColor; border-radius: 4px; padding: 0 3px; line-height: 14px; }
.gif-picker { width: 352px; height: 420px; }
.gif-tabs { display: flex; gap: 4px; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.gif-tabs .grow { flex: 1; }
.picker .gif-tabs button:not(.btn) { font-size: 13px; height: 28px; padding: 0 10px; border-radius: 14px; display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.picker .gif-tabs button.on { background: var(--bg-hover); color: var(--text); font-weight: 600; }
.picker .gif-tabs .btn.small { font-size: 12px; height: 26px; }
.gif-grid { columns: 2; column-gap: 6px; }
.gif-cell { position: relative; break-inside: avoid; margin-bottom: 6px; }
.picker .gif-pick { display: block; width: 100%; height: auto; padding: 0; border-radius: 6px; overflow: hidden; background: var(--bg-hover); min-height: 60px; }
.gif-pick img { display: block; width: 100%; height: 100%; object-fit: cover; }
.picker .gif-mini { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; font-size: 13px; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; opacity: 0; display: grid; place-items: center; }
.gif-cell:hover .gif-mini, .gif-mini:focus-visible { opacity: 1; }
.picker .gif-mini:hover { background: rgba(0,0,0,.8); }
.gif-foot { font-size: 11px; color: var(--muted); text-align: center; margin: 4px 0 2px; }
@media (hover: none) { .gif-mini { opacity: 1; } }
.li-repeat { font-size: 12px; color: var(--accent, var(--muted)); margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.away-banner { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); padding: 6px 10px; margin: 0 16px 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-hover); }

/* ---------- Escritor en dos líneas (como Slack): texto arriba, herramientas debajo ---------- */
.composer { flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 0; padding: 4px 6px 6px 6px; }
.composer textarea { width: 100%; padding: 6px 6px 4px; min-height: 22px; }
.composer .format-bar { margin: 0 0 2px; padding: 0 0 4px; }
.composer-tools { display: flex; align-items: center; gap: 2px; padding-top: 2px; }
.composer-tools .tool-btn { width: 30px; height: 30px; color: var(--muted); font-size: 17px; border-radius: 6px; }
.composer-tools .tool-btn:hover { color: var(--fg); background: var(--bg-hover); }
.composer-tools .plus-btn { width: 28px; height: 28px; margin-right: 2px; }
.aa-btn span { font-size: 14px; font-weight: 600; letter-spacing: -.02em; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.tools-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.composer-tools .send-group { margin-left: auto; }
.composer-tools .send-btn { height: 30px; width: 34px; }
.composer-tools .send-more { display: grid; height: 30px; }
.send-group .send-btn { border-radius: 6px 0 0 6px; }
.composer.disabled .composer-tools .tool-btn, .composer.disabled .plus-btn { opacity: .5; }

/* Pestañas «Emoji | GIF» del selector */
.picker-mode { display: flex; gap: 4px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.picker .picker-mode button { font-size: 13px; font-weight: 600; height: 28px; padding: 0 14px; border-radius: 14px; color: var(--muted); }
.picker .picker-mode button.on { background: var(--bg-hover); color: var(--fg); }
.picker-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.picker .emoji-cell { min-width: 0; padding: 0; }
.picker-body { overflow-x: hidden; }
.members-toolbar { display: flex; gap: 8px; align-items: center; }
.members-toolbar .filter { flex: 1; }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .two-cols { grid-template-columns: 1fr; } }
.role-picks { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 10px; }
.modal-card .role-picks label.check { margin: 0; }

/* ---------- Presencia (como en Teams) y foto en los mensajes directos (como en Slack) ---------- */
.avatar.xs { width: 20px; height: 20px; border-radius: 5px; font-size: 9px; }
.dm-avatar { position: relative; flex: none; display: inline-flex; margin-right: 6px; }
.dm-avatar .presence-dot { right: -3px; bottom: -3px; width: 10px; height: 10px; border: 2px solid var(--side-bg, #1a1d21); background: transparent; box-shadow: inset 0 0 0 1.5px var(--side-muted); }
.side-item.active .dm-avatar .presence-dot { border-color: var(--side-active); }
.presence-dot.on, .dm-avatar .presence-dot.on { background: var(--online); box-shadow: none; }
.presence.busy, .presence-dot.busy, .dm-avatar .presence-dot.busy { background: #d92c2c; border-color: #d92c2c; box-shadow: none; }
.presence.away, .presence-dot.away, .dm-avatar .presence-dot.away { background: #e0a100; border-color: #e0a100; box-shadow: none; }
.presence.dnd, .presence-dot.dnd, .dm-avatar .presence-dot.dnd { background: #d92c2c linear-gradient(#fff, #fff) center / 55% 2px no-repeat; border-color: #d92c2c; box-shadow: none; }
.dm-avatar + .presence { display: none; }
.side-item.deactivated .dm-avatar { opacity: .5; }

/* ---------- Explorar canales ---------- */
.side-title #browse-channels { margin-left: auto; }
.side-title #browse-channels + #add-channel { margin-left: 0; }
.browse-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.browse-filters .filter { flex: 1 1 220px; }
.browse-filters select { flex: 0 0 auto; }
.browse-list { display: flex; flex-direction: column; max-height: 60vh; overflow-y: auto; margin: 0 -8px; }
.browse-row { display: flex; align-items: center; gap: 10px; text-align: left; border: 0; background: transparent; padding: 8px; border-radius: 8px; color: inherit; }
.browse-row:hover { background: var(--bg-hover); }
.browse-row .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.browse-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.browse-icon { color: var(--muted); flex: none; display: inline-flex; }
.browse-empty { padding: 16px 8px; }
.modal-card.browse-card { width: min(600px, calc(100vw - 32px)); }
.modal-card .browse-filters select, .modal-card .browse-filters input { width: auto; margin: 0; }
.modal-card .browse-filters .filter { flex: 1 1 220px; }
.browse-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.browse-name .pill { margin: 0; }

/* ---------- Llamada entrante en el centro (como en Slack y Discord) ---------- */
.ring {
  position: fixed; inset: 0; right: auto; bottom: auto; width: 100%; height: 100%; z-index: 90; display: grid; place-items: center;
  padding: 16px; background: rgba(0, 0, 0, .45); border: 0; border-radius: 0; box-shadow: none; max-width: none; animation: ring-fade .15s ease-out;
}
.ring.hidden { display: none; }
@keyframes ring-fade { from { opacity: 0; } }
.ring-card {
  width: min(340px, 100%); background: var(--bg); color: var(--fg); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.4);
  padding: 28px 24px 22px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; animation: ring-pop .2s ease-out;
}
@keyframes ring-pop { from { transform: scale(.92); opacity: 0; } }
.ring-avatar { position: relative; margin-bottom: 10px; }
.ring-avatar .avatar.lg { width: 88px; height: 88px; border-radius: 50%; font-size: 32px; margin: 0; border: 0; }
.ring-avatar::before, .ring-avatar::after {
  content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--online); opacity: 0; animation: ring-pulse 2s ease-out infinite;
}
.ring-avatar::after { animation-delay: 1s; }
@keyframes ring-pulse { 0% { transform: scale(.95); opacity: .8; } 100% { transform: scale(1.35); opacity: 0; } }
.ring-name { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.ring-sub { color: var(--muted); font-size: 14px; }
.ring-actions { display: flex; gap: 22px; margin-top: 18px; }
.ring-action { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.ring-btn { width: 54px; height: 54px; border-radius: 50%; border: 0; display: grid; place-items: center; color: #fff; cursor: pointer; transition: transform .1s, filter .1s; }
.ring-btn .icon { width: 22px; height: 22px; }
.ring-btn:hover { transform: scale(1.06); filter: brightness(1.1); }
.ring-btn.accept { background: #1f9d55; }
.ring-btn.decline { background: #d92c2c; }
@media (prefers-reduced-motion: reduce) { .ring-avatar::before, .ring-avatar::after, .ring-card, .ring { animation: none; } }

/* Cabecera de un mensaje directo: foto con el círculo de estado (como en Slack) */
.dm-head-avatar { position: relative; display: inline-flex; margin-right: 8px; cursor: pointer; flex: none; }
.dm-head-avatar .avatar.sm { width: 26px; height: 26px; border-radius: 7px; }
.dm-head-avatar .presence-dot { right: -3px; bottom: -3px; width: 11px; height: 11px; border: 2px solid var(--bg); background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.dm-head-avatar .presence-dot.on { background: var(--online); box-shadow: none; }
.ch-topic:empty { display: none; }
.dm-head-avatar .presence-dot.busy { background: #d92c2c; box-shadow: none; }
.dm-head-avatar .presence-dot.away { background: #e0a100; box-shadow: none; }
.dm-head-avatar .presence-dot.dnd { background: #d92c2c linear-gradient(#fff, #fff) center / 55% 2px no-repeat; box-shadow: none; }

/* Doble check junto al mensaje (no en el borde derecho de la pantalla) */
.msg-foot { float: none; display: flex; margin: 2px 0 0; justify-content: flex-start; }
body.bubbles .msg.mine .msg-foot { justify-content: flex-end; }

/* ---------- Vistas a pantalla completa: Personas, Actividad y Más tarde (como en Slack) ---------- */
.people-view { display: none; flex: 1; min-height: 0; flex-direction: column; }
.main.view-people .people-view { display: flex; }
.main.view-people > :not(.people-view) { display: none !important; }
.people-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 20px 30px; }
.people-body .dir-filters { max-width: 720px; }
#app.list-full .main { display: none; }
#app.list-full #list-panel { flex: 1; width: auto; max-width: none; border-left: 0; position: static; box-shadow: none; inset: auto; }
#app.list-full #list-panel .panel-header { padding: 14px 20px; border-bottom: 1px solid var(--border); }
#app.list-full #list-panel .panel-header strong { font-size: 18px; }
#app.list-full #list-close { display: none; }
#app.list-full .list-items { width: 100%; max-width: 900px; margin: 0 auto; padding: 8px 20px 30px; }
.cat-title .cat-more { opacity: 0; }
.cat-title:hover .cat-more, .cat-title .cat-more:focus-visible { opacity: 1; }
@media (hover: none) { .cat-title .cat-more { opacity: 1; } }

/* Elegir micrófono, altavoz y cámara durante la llamada */
.ctl-group { display: inline-flex; align-items: center; position: relative; }
.ctl-dev { width: 20px; height: 20px; border-radius: 50%; border: 0; background: #2b3138; color: #fff; display: grid; place-items: center; padding: 0; margin-left: -12px; margin-top: 26px; box-shadow: 0 0 0 2px #15191d; z-index: 1; cursor: pointer; }
.ctl-dev:hover { background: #3a414a; }
.popover.device-menu { min-width: 260px; max-width: 360px; }
.popover.device-menu button { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Roles al estilo Discord ---------- */
.dr-layout { display: flex; gap: 0; align-items: stretch; min-height: 460px; margin: -4px -8px 0; }
.dr-list { width: 220px; flex: none; border-right: 1px solid var(--border); padding: 0 10px 10px 4px; display: flex; flex-direction: column; gap: 2px; }
.dr-list-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: 4px 4px 6px 8px; }
.dr-roles { display: flex; flex-direction: column; gap: 2px; }
.dr-role { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 2px; border-radius: 6px; cursor: pointer; font-size: 14px; user-select: none; }
.dr-role:hover { background: var(--bg-hover); }
.dr-role.active { background: var(--border); }
.dr-role i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.dr-role small { color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 2px; }
.dr-role .grow small { display: block; }
.dr-grip { color: var(--muted); opacity: 0; width: 14px; display: inline-flex; justify-content: center; }
.dr-role:hover .dr-grip, .dr-role[draggable="false"] .dr-grip { opacity: 1; }
.dr-everyone { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 10px; border-radius: 0 0 6px 6px; }
.dr-everyone .dr-grip { opacity: 1; }
.dr-role.drop-before { box-shadow: inset 0 2px 0 var(--brand); }
.dr-role.drop-after { box-shadow: inset 0 -2px 0 var(--brand); }
.dr-empty { padding: 6px 8px; font-size: 13px; }
.dr-editor { flex: 1; min-width: 0; padding: 0 4px 0 20px; display: flex; flex-direction: column; position: relative; }
.dr-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dr-head h3 { margin: 0; font-size: 15px; text-transform: uppercase; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--border); margin: 10px 0 14px; }
.dr-tabs button { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; padding: 8px 0; border-bottom: 2px solid transparent; cursor: pointer; }
.dr-tabs button.on { color: var(--fg); border-bottom-color: var(--brand); }
.dr-body { flex: 1; padding-bottom: 70px; }
.dr-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-bottom: 18px; }
.dr-field small { text-transform: none; font-weight: 400; }
.dr-field input { text-transform: none; font-weight: 400; }
.dr-field .req { color: var(--danger); }
.dr-colors { display: flex; gap: 12px; align-items: flex-start; }
.dr-palette { display: grid; grid-template-columns: repeat(10, 20px); gap: 8px; }
.dr-swatch { width: 20px; height: 20px; border-radius: 4px; border: 0; padding: 0; cursor: pointer; display: grid; place-items: center; color: #fff; }
.dr-swatch.big { width: 66px; height: 48px; border-radius: 6px; background: #99aab5; border: 1px solid var(--border); }
.dr-swatch.custom { position: relative; background: var(--bg-soft); color: var(--fg); }
.dr-swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.dr-swatch.on { outline: 2px solid var(--fg); outline-offset: 1px; }
.dr-sep { border: 0; border-top: 1px solid var(--border); margin: 6px 0 12px; }
.dr-perm-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.dr-perm-tools .filter { flex: 1; margin: 0; }
.dr-members { display: flex; flex-direction: column; }
.dr-member { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--border); }
.dr-member .grow small { display: inline; }
.dr-unsaved { position: sticky; bottom: 0; display: flex; align-items: center; gap: 14px; background: #111214; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.35); margin-top: 10px; animation: dr-bar .15s ease-out; }
.dr-unsaved.hidden { display: none; }
.dr-unsaved .link-btn { color: #fff; }
.dr-unsaved .save { background: #248046; color: #fff; border: 0; }
.dr-unsaved .save:hover { background: #1a6334; }
@keyframes dr-bar { from { transform: translateY(10px); opacity: 0; } }
.dr-picker-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 5; border-radius: inherit; }
.dr-picker { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 16px; width: min(420px, 92%); max-height: 80%; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.dr-picker h3 { margin: 0; }
.dr-picker-list { overflow-y: auto; max-height: 340px; }
.dr-picker-list .dr-member { cursor: pointer; }
.dr-picker-list input[type=checkbox] { width: auto; margin: 0; }
@media (max-width: 760px) {
  .dr-layout { flex-direction: column; }
  .dr-list { width: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .dr-editor { padding: 12px 0 0; }
  .dr-palette { grid-template-columns: repeat(5, 20px); }
}

/* Miembros: una fila limpia por persona y las acciones en el menú «⋯» */
.member-admin { align-items: flex-start; padding: 12px 4px; }
.member-admin > .avatar { margin-top: 2px; }
.member-info { min-width: 0; }
.member-line { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
.member-mail { font-size: 13px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-admin .role-chips { margin-top: 6px; }
.modal-card .member-admin select.add-role { width: auto; min-width: 0; height: 22px; padding: 0 4px; margin: 0; }
.member-more { position: relative; flex: none; }
.member-more .icon-btn.active { background: var(--bg-hover); }
.member-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 240px; display: flex; flex-direction: column; }
.member-menu a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 6px; color: var(--fg); text-decoration: none; font-size: 14px; }
.member-menu a:hover { background: var(--bg-hover); }
.pill.warn { color: #b7791f; border-color: #b7791f55; }
