/* ============================================================
   NEXUS — Sistema de diseño
   Tipografía del sistema, dos temas (claro/oscuro), un acento.
   ============================================================ */

:root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface-2: #f2f2f4;
    --surface-3: #e8e8ed;
    --border: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.14);
    --text: #1d1d1f;
    --text-2: #6e6e73;
    /* --text-3 solo para elementos NO textuales (bordes, iconos tenues); no
       cumple contraste AA como texto. Para texto tenue usa --text-muted. */
    --text-3: #a1a1a6;
    --text-muted: #6e6e73;
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --accent-soft: rgba(0, 113, 227, 0.10);
    --danger: #ff3b30;
    --danger-text: #d70015;
    --danger-soft: rgba(255, 59, 48, 0.10);
    --ok: #34c759;
    --ok-text: #1e9e4a;
    --pin: #ff9f0a;
    --radius-lg: 18px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.05);
    --shadow-pop: 0 8px 40px rgba(0, 0, 0, 0.16);
    --topbar-h: 60px;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

[data-theme="dark"] {
    --bg: #161617;
    --surface: #1f1f21;
    --surface-2: #29292c;
    --surface-3: #333336;
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.18);
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #6e6e73;
    --text-muted: #a1a1a6;
    --accent: #2997ff;
    --accent-hover: #45a5ff;
    --accent-soft: rgba(41, 151, 255, 0.14);
    --danger: #ff453a;
    --danger-text: #ff6961;
    --danger-soft: rgba(255, 69, 58, 0.14);
    --ok: #30d158;
    --ok-text: #4cd964;
    --pin: #ffd60a;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-pop: 0 8px 40px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    transition: background 0.25s var(--ease), color 0.25s var(--ease);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; }

img { max-width: 100%; }

button { font-family: var(--font); }

::selection { background: var(--accent-soft); }

/* Foco visible por teclado (accesibilidad): un anillo claro en todo lo
   interactivo, incluidos los inputs que quitan el outline por defecto. */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* Respeta la preferencia del sistema de reducir movimiento. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---------- Utilidades ---------- */

.avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--surface-3);
    display: block;
}
.avatar--28 { width: 28px; height: 28px; }
.avatar--32 { width: 32px; height: 32px; }
.avatar--40 { width: 40px; height: 40px; }
.avatar--48 { width: 48px; height: 48px; }
.avatar--120 { width: 120px; height: 120px; }

.icon { width: 20px; height: 20px; flex-shrink: 0; }
.icon--16 { width: 16px; height: 16px; }
.icon--24 { width: 24px; height: 24px; }

.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    border-radius: 980px;
    padding: 10px 22px;
    transition: background 0.18s var(--ease), transform 0.12s var(--ease), opacity 0.18s;
    user-select: none;
    white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }

.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn--soft { background: var(--surface-2); color: var(--text); }
.btn--soft:hover:not(:disabled) { background: var(--surface-3); }

.btn--ghost { background: transparent; color: var(--text-2); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }

.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 88%, black); }

.btn--sm { font-size: 13px; padding: 7px 16px; }

/* ============================================================
   LOGIN
   ============================================================ */

.login-body {
    min-height: 100vh;
    display: flex;
    background: var(--bg);
}

.login-brand {
    flex: 1.1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 64px;
    background:
        radial-gradient(120% 140% at 8% 0%, #4338ca 0%, rgba(67, 56, 202, 0) 55%),
        radial-gradient(120% 120% at 100% 8%, #0ea5e9 0%, rgba(14, 165, 233, 0) 60%),
        radial-gradient(150% 130% at 85% 100%, #10b981 0%, rgba(16, 185, 129, 0) 55%),
        #101828;
    color: #fff;
    overflow: hidden;
}
.login-brand__logo { width: 148px; position: absolute; top: 56px; left: 64px; }
.login-brand__title {
    font-size: clamp(38px, 4.4vw, 58px);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.05;
    margin: 0 0 18px 0;
}
.login-brand__subtitle {
    font-size: 17px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.78);
    max-width: 460px;
    margin: 0;
}

.login-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    background: var(--surface);
}
.login-panel__inner { width: 100%; max-width: 380px; }
.login-panel__logo { width: 120px; margin-bottom: 40px; display: none; }

.login-title {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 10px 0;
}
.login-sub {
    color: var(--text-2);
    font-size: 15px;
    line-height: 1.6;
    margin: 0 0 32px 0;
}

.login-field { position: relative; margin-bottom: 14px; }
.login-field input {
    width: 100%;
    font-family: var(--font);
    font-size: 16px;
    color: var(--text);
    background: var(--surface-2);
    border: 1.5px solid transparent;
    border-radius: var(--radius);
    padding: 15px 16px;
    outline: none;
    transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}
.login-field input::placeholder { color: var(--text-3); }
.login-field input:focus { border-color: var(--accent); background: var(--surface); }

.login-btn { width: 100%; padding: 14px 22px; font-size: 16px; }

.login-alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: var(--danger-soft);
    color: var(--danger-text);
    border-radius: var(--radius);
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
}

.login-hint { color: var(--text-muted); font-size: 13px; margin-top: 24px; line-height: 1.6; }

/* Estado "revisa tu correo" */
.login-sent { text-align: left; }
.login-sent__badge {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}
.login-sent__badge .icon { width: 26px; height: 26px; }
.login-sent strong { word-break: break-all; }
.login-again {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    margin-top: 26px;
}

.login-footer {
    position: absolute;
    bottom: 24px;
    left: 0;
    right: 0;
    text-align: center;
    color: var(--text-3);
    font-size: 12px;
}

@media (max-width: 860px) {
    .login-brand { display: none; }
    .login-panel { background: var(--bg); }
    .login-panel__inner {
        background: var(--surface);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-card);
        border: 1px solid var(--border);
        padding: 40px 32px;
        max-width: 420px;
    }
    .login-panel__logo { display: block; }
}

/* Spinner sutil */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.spinner--accent { border-color: var(--accent-soft); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   CASCARÓN — barra superior y paneles
   ============================================================ */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-h);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
    .topbar { background: var(--surface); }
}

.topbar__inner {
    max-width: 1200px;
    height: 100%;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar__logo img { height: 34px; display: block; }

.topbar__search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-2);
    border-radius: 980px;
    padding: 9px 16px;
    color: var(--text-3);
    width: 260px;
    transition: background 0.18s var(--ease);
}
.topbar__search:focus-within { background: var(--surface-3); }
.topbar__search input {
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    width: 100%;
}
.topbar__search input::placeholder { color: var(--text-3); }

.topbar__nav {
    display: flex;
    gap: 4px;
    margin: 0 auto;
}
.topbar__navlink {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-2);
    font-size: 11px;
    font-weight: 500;
    padding: 6px 26px;
    border-radius: var(--radius-sm);
    position: relative;
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.topbar__navlink:hover { background: var(--surface-2); color: var(--text); }
.topbar__navlink.is-active { color: var(--accent); }
.topbar__navlink.is-active::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 16px;
    right: 16px;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--accent);
}

.topbar__acciones {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}
.topbar__icono {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--surface-2);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s var(--ease);
}
.topbar__icono:hover { background: var(--surface-3); }
.topbar__avatar {
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
}

.badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Avatares con iniciales de respaldo */
.avatar-wrap {
    display: inline-flex;
    border-radius: 50%;
    flex-shrink: 0;
    vertical-align: middle;
}
.avatar-wrap--fallback {
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #5561f2, #10b981);
    color: #fff;
    font-weight: 600;
}
.avatar-wrap--fallback::before { content: attr(data-iniciales); font-size: 0.85em; }
.avatar-wrap--fallback.avatar--28::before { font-size: 11px; }
.avatar-wrap--fallback.avatar--32::before { font-size: 12px; }
.avatar-wrap--fallback.avatar--40::before { font-size: 15px; }
.avatar-wrap--fallback.avatar--48::before { font-size: 18px; }
.avatar-wrap--fallback.avatar--120::before { font-size: 44px; }

/* Paneles flotantes (notificaciones, menú usuario) */
.panel {
    position: fixed;
    top: calc(var(--topbar-h) + 8px);
    right: 16px;
    width: 360px;
    max-width: calc(100vw - 24px);
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-pop);
    z-index: 200;
    overflow: hidden;
    animation: panel-in 0.16s var(--ease);
}
@keyframes panel-in {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to { opacity: 1; transform: none; }
}
.panel--usuario { width: 300px; padding: 8px; }
.panel__encabezado {
    padding: 16px 18px 10px;
}
.panel__encabezado h3 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.panel__cuerpo { max-height: min(480px, 70vh); overflow-y: auto; padding: 4px 8px 8px; }
.panel__vacio { color: var(--text-muted); font-size: 14px; text-align: center; padding: 28px 0; }
.panel__division { border: none; border-top: 1px solid var(--border); margin: 6px 4px; }
.panel__item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: none;
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background 0.13s var(--ease);
}
.panel__item:hover { background: var(--surface-2); }
.panel__item .icon { color: var(--text-2); }
.panel__item--perfil { padding: 10px 12px; }
.panel__item--perfil span { display: flex; flex-direction: column; }
.panel__item--perfil strong { font-size: 15px; }
.panel__item--perfil small { color: var(--text-2); font-size: 12px; font-weight: 400; }

.notif {
    display: flex;
    gap: 12px;
    padding: 10px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.13s var(--ease);
    align-items: flex-start;
}
.notif:hover { background: var(--surface-2); }
.notif__texto { font-size: 14px; line-height: 1.4; color: var(--text); }
.notif__texto small { display: block; color: var(--text-muted); font-size: 12px; margin-top: 3px; }
.notif__extracto { color: var(--text-2); }
.notif--nueva .notif__punto {
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    margin: 6px 0 0 auto;
    flex-shrink: 0;
}

.aviso-cuenta {
    position: sticky;
    top: var(--topbar-h);
    z-index: 90;
    background: var(--pin);
    color: #3a2c00;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 16px;
}
.aviso-cuenta__btn {
    background: rgba(0, 0, 0, 0.15);
    color: inherit;
    border: none;
    border-radius: 980px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 12px;
    margin-left: 8px;
    cursor: pointer;
}

/* ============================================================
   FEED — estructura y tarjetas
   ============================================================ */

.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: calc(var(--topbar-h) + 24px) 16px 60px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 28px;
    align-items: start;
}
.app--simple { grid-template-columns: minmax(0, 1fr); max-width: 720px; }

.feed { max-width: 640px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.rail { position: sticky; top: calc(var(--topbar-h) + 24px); display: flex; flex-direction: column; gap: 16px; }
.rail__card { padding: 18px 18px 12px; }
.rail__titulo {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.rail__item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px 6px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.13s var(--ease);
    color: var(--text);
}
.rail__item:hover { background: var(--surface-2); }
.rail__item-texto { font-size: 13px; line-height: 1.35; overflow: hidden; }
.rail__item-texto strong { display: block; font-size: 13px; }
.rail__item-texto span {
    color: var(--text-2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Composer */
.composer { padding: 16px; }
.composer__fila { display: flex; gap: 12px; align-items: center; }
.composer__disparador {
    flex: 1;
    text-align: left;
    background: var(--surface-2);
    border: none;
    border-radius: 980px;
    padding: 12px 18px;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 15px;
    cursor: pointer;
    transition: background 0.15s var(--ease);
}
.composer__disparador:hover { background: var(--surface-3); }

/* Tarjeta de publicación */
.post { overflow: visible; }
.post__cabecera {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px 0;
}
.post__autoria { min-width: 0; }
.post__autor {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}
.post__autor a { color: inherit; }
.post__autor a:hover { text-decoration: underline; }
.post__meta { color: var(--text-2); font-size: 12.5px; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.post__pin {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--pin);
    font-size: 12px;
    font-weight: 600;
}
.post__menu-btn {
    margin-left: auto;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: none;
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.13s var(--ease);
}
.post__menu-btn:hover { background: var(--surface-2); }

.post__contenido {
    padding: 10px 16px 4px;
    font-size: 15px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.post__contenido a { word-break: break-all; }
.post__contenido--grande { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; }
.mencion { color: var(--accent); font-weight: 600; }

/* Media */
.post__media { margin-top: 8px; display: grid; gap: 2px; }
.post__media--1 { grid-template-columns: 1fr; }
.post__media--2 { grid-template-columns: 1fr 1fr; }
.post__media--3 { grid-template-columns: 1fr 1fr; }
.post__media--3 .media-item:first-child { grid-column: span 2; }
.post__media--4 { grid-template-columns: 1fr 1fr; }
.media-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background: var(--surface-3);
}
.media-item img, .media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.post__media--1 .media-item img { max-height: 620px; object-fit: contain; background: var(--surface-2); }
.post__media--1 .media-item { max-height: 620px; }
.post__media--2 .media-item, .post__media--3 .media-item:not(:first-child), .post__media--4 .media-item { aspect-ratio: 1; }
.post__media--3 .media-item:first-child { aspect-ratio: 2 / 1; }
.media-item__mas {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 600;
}
.media-item__play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
    pointer-events: none;
}
.media-item__play .icon { width: 52px; height: 52px; filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4)); }
/* Video sin miniatura: fondo oscuro con degradado sutil. */
.media-item--video {
    min-height: 220px;
    background: linear-gradient(135deg, #2a2a2e 0%, #1a1a1d 100%);
}

/* Vista previa de enlace */
.link-preview {
    margin: 10px 16px 4px;
    display: flex;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    background: var(--surface-2);
    text-decoration: none;
}
.link-preview img { width: 110px; height: 90px; object-fit: cover; flex-shrink: 0; }
.link-preview__texto { padding: 10px 12px 10px 0; min-width: 0; align-self: center; }
.link-preview__texto:first-child { padding-left: 12px; }
.link-preview strong { display: block; color: var(--text); font-size: 14px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.link-preview span { color: var(--text-2); font-size: 12.5px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* Resumen y acciones de reacción */
.post__resumen {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px 8px;
    color: var(--text-2);
    font-size: 13px;
}
.post__resumen-reacciones {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--text-2);
    font-family: var(--font);
    font-size: 13px;
    padding: 0;
}
.post__resumen-reacciones:hover { text-decoration: underline; }
.emoji-pila { display: inline-flex; }
.emoji-pila span {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--surface);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    margin-left: -4px;
    border: 1.5px solid var(--surface);
}
.emoji-pila span:first-child { margin-left: 0; }
.post__resumen-der { margin-left: auto; display: flex; gap: 12px; }
.post__resumen-der button {
    border: none;
    background: none;
    color: var(--text-2);
    font-family: var(--font);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
}
.post__resumen-der button:hover { text-decoration: underline; }
.post__vistas { color: var(--text-muted); font-size: 12.5px; }

.post__acciones {
    display: flex;
    border-top: 1px solid var(--border);
    margin: 0 12px;
    padding: 4px 0;
    position: relative;
}
.post__accion {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 0;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.13s var(--ease), color 0.13s var(--ease);
    position: relative;
}
.post__accion:hover { background: var(--surface-2); }
.post__accion.is-reaccionado { color: var(--accent); }
.post__accion .emoji { font-size: 17px; line-height: 1; }

/* Selector de reacciones */
.picker {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 980px;
    box-shadow: var(--shadow-pop);
    padding: 6px 10px;
    display: flex;
    gap: 2px;
    z-index: 50;
    animation: panel-in 0.15s var(--ease);
}
.picker button {
    border: none;
    background: none;
    font-size: 26px;
    line-height: 1;
    padding: 5px;
    cursor: pointer;
    border-radius: 50%;
    transition: transform 0.14s var(--ease);
}
.picker button:hover { transform: scale(1.35) translateY(-4px); }

/* Comentarios */
.post__comentarios { padding: 4px 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.comentario { display: flex; gap: 10px; }
.comentario__cuerpo { min-width: 0; flex: 1; }
.comentario__burbuja {
    background: var(--surface-2);
    border-radius: 16px;
    padding: 8px 14px;
    display: inline-block;
    max-width: 100%;
}
.comentario__autor { font-size: 13px; font-weight: 600; color: var(--text); display: block; }
.comentario__autor a { color: inherit; }
.comentario__texto { font-size: 14px; line-height: 1.45; word-wrap: break-word; white-space: pre-wrap; }
.comentario__imagen { margin-top: 6px; }
.comentario__imagen img { max-width: 220px; max-height: 220px; border-radius: 12px; display: block; cursor: pointer; }
.comentario__pie {
    display: flex;
    gap: 14px;
    padding: 3px 14px 0;
    font-size: 12px;
    color: var(--text-muted);
    align-items: center;
    position: relative;
}
.comentario__pie button {
    border: none;
    background: none;
    color: var(--text-2);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}
.comentario__pie button:hover { text-decoration: underline; }
.comentario__pie .is-reaccionado { color: var(--accent); }
.comentario__respuestas { margin: 8px 0 0 24px; display: flex; flex-direction: column; gap: 8px; }

.comentario-form { display: flex; gap: 10px; align-items: flex-start; padding-top: 4px; }
.comentario-form__caja {
    flex: 1;
    background: var(--surface-2);
    border-radius: 18px;
    padding: 8px 12px;
    position: relative;
}
.comentario-form textarea {
    width: 100%;
    border: none;
    background: none;
    outline: none;
    resize: none;
    font-family: var(--font);
    font-size: 14px;
    color: var(--text);
    line-height: 1.4;
    max-height: 120px;
}
.comentario-form textarea::placeholder { color: var(--text-3); }
.comentario-form__herramientas { display: flex; gap: 4px; align-items: center; justify-content: flex-end; }
.comentario-form__herramientas button {
    border: none;
    background: none;
    color: var(--text-2);
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.13s var(--ease);
}
.comentario-form__herramientas button:hover { background: var(--surface-3); }
.comentario-form__herramientas .btn-enviar-comentario { color: var(--accent); }
.comentario-form__adjunto { position: relative; display: inline-block; margin-top: 6px; }
.comentario-form__adjunto img { max-height: 90px; border-radius: 10px; display: block; }
.comentario-form__adjunto button {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: var(--text);
    color: var(--surface);
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
}
.respondiendo-a {
    font-size: 12px;
    color: var(--text-2);
    padding: 0 14px 4px;
}
.respondiendo-a button { border: none; background: none; color: var(--accent); cursor: pointer; font-size: 12px; padding: 0; }

/* Dropdown de menciones */
.mencion-dropdown {
    position: absolute;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    z-index: 300;
    width: 280px;
    max-height: 280px;
    overflow-y: auto;
    padding: 6px;
}
.mencion-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.mencion-item:hover, .mencion-item.is-activo { background: var(--surface-2); }
.mencion-item__texto { min-width: 0; }
.mencion-item__texto strong { display: block; font-size: 14px; }
.mencion-item__texto span { color: var(--text-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* Menú contextual del post */
.menu-contextual {
    position: absolute;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    z-index: 150;
    min-width: 200px;
    padding: 6px;
    animation: panel-in 0.13s var(--ease);
}
.menu-contextual button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: none;
    background: none;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}
.menu-contextual button:hover { background: var(--surface-2); }
.menu-contextual button.peligro { color: var(--danger); }
.menu-contextual .icon { width: 17px; height: 17px; color: var(--text-2); }
.menu-contextual button.peligro .icon { color: var(--danger); }

/* ============================================================
   MODALES
   ============================================================ */

.modal-fondo {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fondo-in 0.18s var(--ease);
}
@keyframes fondo-in { from { opacity: 0; } to { opacity: 1; } }
[data-theme="dark"] .modal-fondo { background: rgba(0, 0, 0, 0.7); }

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-pop);
    width: 100%;
    max-width: 560px;
    max-height: min(86vh, 900px);
    display: flex;
    flex-direction: column;
    animation: modal-in 0.2s var(--ease);
}
@keyframes modal-in {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to { opacity: 1; transform: none; }
}
.modal__cabecera {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.modal__cabecera h3 { margin: 0 auto; font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.modal__cerrar {
    position: absolute;
    right: 14px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal__cerrar:hover { background: var(--surface-3); }
.modal__cabecera { position: relative; }
.modal__cuerpo { padding: 16px 20px; overflow-y: auto; }
.modal__pie { padding: 12px 20px 16px; flex-shrink: 0; border-top: 1px solid var(--border); }

/* Composer modal */
.composer-modal textarea {
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    background: none;
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.5;
    color: var(--text);
    min-height: 120px;
}
.composer-modal textarea::placeholder { color: var(--text-3); }
.composer-modal__previews { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.composer-modal__preview { position: relative; width: 96px; height: 96px; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.composer-modal__preview img, .composer-modal__preview video { width: 100%; height: 100%; object-fit: cover; }
.composer-modal__preview button {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    line-height: 1;
}
.composer-modal__barra {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 8px 8px 14px;
    margin-top: 14px;
}
.composer-modal__barra span { font-size: 14px; font-weight: 600; color: var(--text-2); }
.composer-modal__barra div { display: flex; gap: 4px; }
.composer-modal__barra button {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ok);
}
.composer-modal__barra button:hover { background: var(--surface-2); }
.contador { font-size: 12px; color: var(--text-3); text-align: right; margin-top: 4px; }
.contador--alerta { color: var(--pin); }

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 500;
    display: flex;
    animation: fondo-in 0.15s var(--ease);
}
/* Zona de la media: ocupa el espacio libre y centra la imagen/video. */
.lightbox__media {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 24px;
}
.lightbox img, .lightbox video {
    max-width: 100%;
    max-height: calc(100vh - 48px);
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}
.lightbox__cerrar {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    z-index: 2;
    transition: background 0.15s var(--ease), transform 0.15s var(--spring);
}
.lightbox__cerrar:hover { background: rgba(255, 255, 255, 0.25); transform: scale(1.08); }
.lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    z-index: 2;
    transition: background 0.15s var(--ease);
}
.lightbox__nav:hover { background: rgba(255, 255, 255, 0.22); }
.lightbox__nav--prev { left: 18px; }
.lightbox__nav--next { right: 18px; }
.lightbox__contador {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 12px;
    border-radius: 980px;
}

/* Teatro: panel de comentarios a la derecha (estilo Facebook). */
.lightbox--teatro .lightbox__media { background: #000; }
.lightbox__panel {
    width: 380px;
    flex-shrink: 0;
    background: var(--surface);
    overflow-y: auto;
    animation: panel-teatro 0.28s var(--spring);
}
@keyframes panel-teatro {
    from { transform: translateX(30px); opacity: 0; }
    to { transform: none; opacity: 1; }
}
/* La tarjeta del post dentro del panel: plana y a lo ancho. */
.post--teatro {
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}
.post--teatro:hover { box-shadow: none; }
.post--teatro .post__media,
.post--teatro .post__link-preview { display: none; }
.post--teatro .post__comentarios { display: block !important; }

@media (max-width: 820px) {
    .lightbox--teatro { flex-direction: column; }
    .lightbox--teatro .lightbox__media { flex: none; height: 45vh; padding: 12px; }
    .lightbox--teatro .lightbox img, .lightbox--teatro .lightbox video { max-height: calc(45vh - 24px); }
    .lightbox__panel { width: 100%; flex: 1; border-top: 1px solid var(--border); }
}

/* Detalle de reacciones */
.reaccion-detalle__tabs { display: flex; gap: 6px; padding: 0 0 12px; flex-wrap: wrap; }
.reaccion-detalle__tab {
    border: none;
    background: var(--surface-2);
    border-radius: 980px;
    padding: 6px 14px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
}
.reaccion-detalle__tab.is-activo { background: var(--accent-soft); color: var(--accent); }
.reaccion-detalle__fila { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.reaccion-detalle__fila .emoji { font-size: 20px; margin-left: auto; }
.reaccion-detalle__fila strong { font-size: 14px; display: block; }
.reaccion-detalle__fila span { font-size: 12px; color: var(--text-2); display: block; }

/* Buscador de GIFs */
.gif-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 12px; }
.gif-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); cursor: pointer; display: block; background: var(--surface-2); }
.gif-grid img:hover { opacity: 0.85; }

/* Toast */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: var(--surface);
    border-radius: 980px;
    padding: 11px 22px;
    font-size: 14px;
    font-weight: 500;
    z-index: 600;
    box-shadow: var(--shadow-pop);
    animation: toast-in 0.22s var(--ease);
    max-width: calc(100vw - 40px);
    text-align: center;
}
@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* Skeletons */
.skeleton { pointer-events: none; }
.skeleton__linea, .skeleton__circulo, .skeleton__bloque {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
    background-size: 400% 100%;
    animation: brillo 1.4s ease infinite;
    border-radius: 8px;
}
@keyframes brillo { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.skeleton__circulo { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.skeleton__bloque { height: 220px; border-radius: 0; margin-top: 12px; }

.fin-feed { text-align: center; color: var(--text-muted); font-size: 14px; padding: 28px 0 8px; }

/* ============================================================
   DIRECTORIO Y PERFIL
   ============================================================ */

.pagina-titulo { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 4px; }
.pagina-sub { color: var(--text-2); font-size: 15px; margin: 0 0 22px; }

.directorio-buscar { margin-bottom: 20px; max-width: 420px; }
.directorio-buscar input {
    width: 100%;
    font-family: var(--font);
    font-size: 15px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 980px;
    padding: 12px 20px;
    outline: none;
    transition: border-color 0.15s var(--ease);
}
.directorio-buscar input:focus { border-color: var(--accent); }

/* Directorio: una columna con selector A-Z a la izquierda. */
.dir-layout { display: flex; gap: 20px; align-items: flex-start; }

.alfabeto {
    position: sticky;
    top: calc(var(--topbar-h) + 24px);
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex-shrink: 0;
    padding-top: 4px;
}
.alfabeto__letra {
    border: none;
    background: none;
    color: var(--text-2);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    width: 24px;
    height: 21px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s var(--ease), color 0.12s var(--ease);
    line-height: 1;
}
.alfabeto__letra:hover { background: var(--surface-2); color: var(--text); }
.alfabeto__letra.is-vacia { color: var(--text-3); opacity: 0.4; cursor: default; pointer-events: none; }

.dir-lista { flex: 1; min-width: 0; }
.dir-seccion { margin-bottom: 8px; scroll-margin-top: 80px; }
.dir-letra-titulo {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.04em;
    margin: 8px 0 4px;
    padding: 0 8px;
    position: sticky;
    top: var(--topbar-h);
    background: var(--bg);
    z-index: 1;
    padding-top: 8px;
}

.persona {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 12px 14px;
    color: var(--text);
    border-radius: var(--radius);
    transition: background 0.13s var(--ease);
}
.persona:hover { background: var(--surface); box-shadow: var(--shadow-card); }
.persona:not(:last-child) { border-bottom: 1px solid var(--border); border-radius: 0; }
.persona:hover:not(:last-child) { border-bottom-color: transparent; border-radius: var(--radius); }
.persona__texto { min-width: 0; flex: 1; }
.persona__texto strong { display: block; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.persona__texto span { display: block; color: var(--text-muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.persona__flecha { color: var(--text-3); flex-shrink: 0; opacity: 0; transition: opacity 0.13s var(--ease); }
.persona:hover .persona__flecha { opacity: 1; }

/* Panel de administración */
.admin-encabezado { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.admin-stats { display: flex; gap: 12px; margin-bottom: 20px; }
.admin-stat {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
}
.admin-stat strong { display: block; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.admin-stat span { color: var(--text-muted); font-size: 13px; }

.admin-tabla-cont { padding: 6px 6px; overflow: hidden; }
.admin-tabla { width: 100%; border-collapse: collapse; }
.admin-tabla th {
    text-align: left;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
.admin-tabla td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.admin-tabla tbody tr:last-child td { border-bottom: none; }
.admin-tabla tbody tr:hover { background: var(--surface-2); }
.admin-fila--inactiva { opacity: 0.5; }
.admin-persona { display: flex; align-items: center; gap: 12px; }
.admin-persona__txt { min-width: 0; }
.admin-persona__txt strong { display: block; font-size: 14px; font-weight: 600; }
.admin-persona__txt span { display: block; color: var(--text-muted); font-size: 12.5px; }

.admin-chip {
    display: inline-block;
    background: var(--surface-3);
    color: var(--text-2);
    border-radius: 980px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
}
.admin-chip--admin { background: var(--accent-soft); color: var(--accent); }
.admin-chip--root { background: rgba(255, 159, 10, 0.15); color: #c77700; font-size: 10px; padding: 2px 7px; vertical-align: middle; }
[data-theme="dark"] .admin-chip--root { color: #ffb340; }
.admin-estado--activo { color: var(--ok-text); font-size: 13px; font-weight: 600; }
.admin-estado--inactivo { color: var(--text-3); font-size: 13px; font-weight: 600; }
.admin-estado--smartship { color: #c77700; font-size: 12.5px; font-weight: 600; }
[data-theme="dark"] .admin-estado--smartship { color: #ffb340; }
.admin-menu-btn {
    width: 32px; height: 32px;
    border: none; background: none; border-radius: 50%;
    color: var(--text-2); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.admin-menu-btn:hover { background: var(--surface-3); }
.col-acciones { text-align: right; width: 44px; }

.admin-form-error {
    background: var(--danger-soft);
    color: var(--danger-text);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 14px;
}
.admin-check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); cursor: pointer; margin-top: 4px; }
.admin-check input { width: 16px; height: 16px; }
.menu-contextual button:disabled { opacity: 0.5; cursor: default; }

@media (max-width: 640px) {
    .admin-tabla .col-puesto, .admin-tabla .col-estado { display: none; }
    .admin-encabezado { flex-direction: column; align-items: stretch; }
    .admin-encabezado .btn { width: 100%; }
}

.perfil-cabecera { padding: 0 0 0; overflow: hidden; margin-bottom: 16px; }
.perfil-cabecera__portada {
    height: 160px;
    background:
        radial-gradient(120% 160% at 10% 0%, #4338ca 0%, rgba(67, 56, 202, 0) 55%),
        radial-gradient(130% 130% at 95% 15%, #0ea5e9 0%, rgba(14, 165, 233, 0) 60%),
        radial-gradient(140% 140% at 80% 100%, #10b981 0%, rgba(16, 185, 129, 0) 55%),
        #101828;
}
.perfil-cabecera__cuerpo { padding: 0 24px 22px; }
.perfil-cabecera__foto {
    margin-top: -56px;
    display: inline-block;
    border-radius: 50%;
    border: 4px solid var(--surface);
    position: relative;
}
.perfil-cabecera__nombre { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 12px 0 2px; }
.perfil-cabecera__puesto { color: var(--text-2); font-size: 15px; margin: 0; }
.perfil-cabecera__bio { font-size: 14.5px; margin: 12px 0 0; line-height: 1.5; }
.perfil-cabecera__datos { display: flex; gap: 18px; margin-top: 14px; color: var(--text-2); font-size: 13.5px; flex-wrap: wrap; }
.perfil-cabecera__datos span { display: inline-flex; align-items: center; gap: 6px; }
.btn-foto {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid var(--surface);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-foto:hover { background: var(--surface-3); }

/* Panel de vacaciones (perfil propio) */
.vacaciones-dias { display: flex; align-items: baseline; gap: 8px; }
.vacaciones-dias strong { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; }
.vacaciones-dias span { color: var(--text-2); font-size: 14px; }
.tabla-simple { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tabla-simple th {
    text-align: left;
    color: var(--text-2);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
}
.tabla-simple td { padding: 10px; border-bottom: 1px solid var(--border); }
.tabla-simple tr:last-child td { border-bottom: none; }
.chip { display: inline-block; border-radius: 980px; padding: 3px 10px; font-size: 12px; font-weight: 600; }
.chip--pendiente { background: rgba(255, 159, 10, 0.15); color: #c77700; }
.chip--aprobado { background: rgba(52, 199, 89, 0.15); color: #1e9e4a; }
.chip--rechazado { background: var(--danger-soft); color: var(--danger); }
[data-theme="dark"] .chip--pendiente { color: #ffb340; }
[data-theme="dark"] .chip--aprobado { color: #4cd964; }

.campo { margin-bottom: 14px; }
.campo label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.campo input, .campo textarea {
    width: 100%;
    font-family: var(--font);
    font-size: 15px;
    color: var(--text);
    background: var(--surface-2);
    border: 1.5px solid transparent;
    border-radius: var(--radius);
    padding: 11px 14px;
    outline: none;
    resize: vertical;
    transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.campo input:focus, .campo textarea:focus { border-color: var(--accent); background: var(--surface); }

/* ============================================================
   RESPONSIVO
   ============================================================ */

@media (max-width: 1020px) {
    .app { grid-template-columns: minmax(0, 1fr); }
    .rail { display: none; }
}

@media (max-width: 760px) {
    .topbar__search { display: none; }
    .topbar__navlink { padding: 6px 16px; }
    .topbar__navlink span { display: none; }
    .topbar__navlink.is-active::after { bottom: -8px; }
    .app { padding: calc(var(--topbar-h) + 12px) 8px 40px; }
    .feed { gap: 10px; }
    .card { border-radius: var(--radius); }
    .post__contenido, .post__cabecera, .post__resumen { padding-left: 12px; padding-right: 12px; }
    .post__comentarios { padding-left: 12px; padding-right: 12px; }
    .modal { max-height: 94vh; }
    .modal-fondo { padding: 8px; align-items: flex-end; }
    .perfil-cabecera__cuerpo { padding: 0 16px 18px; }
    .pagina-titulo { font-size: 22px; }
}

/* Media sin archivo disponible */
.media-item--rota {
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
}
.media-item--rota::after {
    content: "";
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--surface-3);
    -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.6"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="M21 15l-5-5L5 21"/></svg>') center / contain no-repeat;
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.6"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="8.5" cy="8.5" r="1.5"/><path d="M21 15l-5-5L5 21"/></svg>') center / contain no-repeat;
}

/* ============================================================
   ADMIN — editar persona (pantalla completa)
   ============================================================ */

.volver-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.13s var(--ease), transform 0.13s var(--ease);
}
.volver-link:hover { color: var(--text); transform: translateX(-2px); }

.admin-form-ok {
    background: rgba(52, 199, 89, 0.14);
    color: var(--ok-text);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 16px;
}
.campo-nota { color: var(--text-muted); font-size: 12px; margin: 6px 0 0; }

.editar-foto-card { display: flex; align-items: center; gap: 18px; padding: 20px; margin-bottom: 14px; }
.editar-foto { position: relative; flex-shrink: 0; }
.editar-foto .avatar-wrap, .editar-foto .avatar { width: 84px; height: 84px; }
.editar-foto .avatar-wrap--fallback::before { font-size: 30px; }
.editar-foto .btn-foto { width: 30px; height: 30px; bottom: -2px; right: -2px; }
.editar-foto-txt strong { display: block; font-size: 15px; }
.editar-foto-txt span { color: var(--text-muted); font-size: 13px; }

.editar-campos { padding: 20px; margin-bottom: 14px; }
.editar-fila { display: flex; gap: 12px; }
.editar-fila .campo { flex: 1; }

.editar-permisos { padding: 20px; margin-bottom: 20px; }
.editar-toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.editar-toggle strong { display: block; font-size: 15px; }
.editar-toggle span { color: var(--text-muted); font-size: 13px; }
.editar-div { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* Interruptor tipo iOS */
.switch { position: relative; display: inline-block; width: 46px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__pista {
    position: absolute;
    inset: 0;
    background: var(--surface-3);
    border-radius: 980px;
    transition: background 0.25s var(--ease);
    cursor: pointer;
}
.switch__pista::before {
    content: "";
    position: absolute;
    width: 24px; height: 24px;
    left: 2px; top: 2px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.25s var(--ease);
}
.switch input:checked + .switch__pista { background: var(--ok); }
.switch input:checked + .switch__pista::before { transform: translateX(18px); }
.switch input:focus-visible + .switch__pista { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch--bloqueado { opacity: 0.6; }
.switch--bloqueado .switch__pista { cursor: default; }

.editar-acciones { display: flex; align-items: center; gap: 12px; }
.editar-acciones .btn--primary { min-width: 160px; }
.editar-eliminar { color: var(--danger); margin-left: auto; }
.editar-eliminar:hover { background: var(--danger-soft); color: var(--danger); }

/* Filas de la lista de admin: navegables */
.admin-fila { cursor: pointer; }
.admin-fila__chevron { color: var(--text-3); transition: transform 0.15s var(--ease); }
.admin-fila:hover .admin-fila__chevron { transform: translateX(3px); color: var(--text-2); }

@media (max-width: 560px) {
    .editar-fila { flex-direction: column; gap: 0; }
}

/* ============================================================
   MICROINTERACCIONES — pulido y detalle (Apple-restraint + delight)
   Todo con transform/opacity. El bloque prefers-reduced-motion las
   neutraliza para quien prefiere menos movimiento.
   ============================================================ */

:root { --spring: cubic-bezier(0.34, 1.4, 0.5, 1); }

/* Entrada suave (fade + subir). */
@keyframes entrar {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}
.entra { animation: entrar 0.42s var(--ease) both; }

/* Cascada de entrada para listas renderizadas en servidor. */
.persona, .admin-fila, .dir-seccion { animation: entrar 0.4s var(--ease) both; }
.persona:nth-child(2) { animation-delay: 0.03s; }
.persona:nth-child(3) { animation-delay: 0.06s; }
.persona:nth-child(4) { animation-delay: 0.09s; }
.persona:nth-child(5) { animation-delay: 0.12s; }
.persona:nth-child(6) { animation-delay: 0.15s; }
.persona:nth-child(n+7) { animation-delay: 0.18s; }
.admin-fila { animation-delay: calc(min(var(--i, 0), 12) * 0.025s); }

/* Botones: rebote sutil al soltar (spring). */
.btn:active { transform: scale(0.96); }
.btn { transition: background 0.18s var(--ease), transform 0.2s var(--spring), opacity 0.18s, box-shadow 0.2s var(--ease); }
.btn--primary:hover:not(:disabled) { box-shadow: 0 4px 14px var(--accent-soft); }

/* Iconos de la barra: micro-escala. */
.topbar__icono, .topbar__avatar { transition: transform 0.2s var(--spring), background 0.15s var(--ease); }
.topbar__icono:active, .topbar__avatar:active { transform: scale(0.9); }
.topbar__avatar:hover { transform: scale(1.06); }

/* Indicador activo del nav: crece desde el centro. */
.topbar__navlink.is-active::after { animation: crecer-nav 0.3s var(--spring) both; transform-origin: center; }
@keyframes crecer-nav { from { transform: scaleX(0); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }

/* Avatares dentro de contenido: leve realce al pasar el cursor sobre enlaces. */
.post__cabecera a .avatar-wrap, .comentario > a .avatar-wrap {
    transition: transform 0.22s var(--spring);
    display: inline-flex;
}
.post__cabecera a:hover .avatar-wrap, .comentario > a:hover .avatar-wrap { transform: scale(1.06); }

/* Botón de acción del post: el emoji rebota al reaccionar. */
.post__accion.is-reaccionado .emoji { animation: rebote-emoji 0.45s var(--spring); }
@keyframes rebote-emoji {
    0% { transform: scale(0.4); }
    60% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* Ráfaga de reacción: el emoji flota y se desvanece. */
.reaccion-burst {
    position: fixed;
    z-index: 700;
    font-size: 30px;
    pointer-events: none;
    animation: flotar-burst 0.9s var(--ease) forwards;
    will-change: transform, opacity;
}
@keyframes flotar-burst {
    0% { opacity: 0; transform: translate(-50%, 0) scale(0.5); }
    25% { opacity: 1; transform: translate(-50%, -18px) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -68px) scale(1); }
}

/* Contador de reacciones/comentarios: latido al cambiar. */
.late { animation: latir 0.4s var(--spring); }
@keyframes latir {
    0% { transform: scale(1); }
    45% { transform: scale(1.22); }
    100% { transform: scale(1); }
}

/* Selector de reacciones: cada emoji entra escalonado. */
.picker button { animation: entrar-emoji 0.28s var(--spring) both; }
.picker button:nth-child(1) { animation-delay: 0.00s; }
.picker button:nth-child(2) { animation-delay: 0.03s; }
.picker button:nth-child(3) { animation-delay: 0.06s; }
.picker button:nth-child(4) { animation-delay: 0.09s; }
.picker button:nth-child(5) { animation-delay: 0.12s; }
.picker button:nth-child(6) { animation-delay: 0.15s; }
.picker button:nth-child(7) { animation-delay: 0.18s; }
.picker button:nth-child(8) { animation-delay: 0.21s; }
@keyframes entrar-emoji {
    from { opacity: 0; transform: translateY(8px) scale(0.6); }
    to { opacity: 1; transform: none; }
}
.picker button:hover { transform: scale(1.4) translateY(-6px); }

/* Modales y paneles con un toque de resorte. */
@keyframes modal-in {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to { opacity: 1; transform: none; }
}
.modal { animation: modal-in 0.28s var(--spring); }
.panel { animation: panel-in 0.2s var(--spring); }

/* Badge de notificaciones: pulso al llegar algo nuevo. */
.badge.pulso { animation: pulso-badge 0.5s var(--spring); }
@keyframes pulso-badge {
    0% { transform: scale(0); }
    60% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Toast con icono y entrada elástica. */
.toast { display: inline-flex; align-items: center; gap: 9px; animation: toast-in 0.34s var(--spring); }
.toast__icono { width: 16px; height: 16px; flex-shrink: 0; }

/* Enlaces de texto: subrayado que se desliza. */
.link-anim { position: relative; }
.link-anim::after {
    content: "";
    position: absolute;
    left: 0; bottom: -1px;
    width: 100%; height: 1.5px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s var(--ease);
}
.link-anim:hover::after { transform: scaleX(1); }

/* Chevron del selector A-Z activo. */
.alfabeto__letra.is-activa { color: var(--accent); background: var(--accent-soft); }

/* Imagenes de media: aparecen con un fundido (animación, sin riesgo de
   quedarse invisibles si el evento load no dispara). */
.media-item img { animation: aparecer-media 0.5s var(--ease); }
@keyframes aparecer-media { from { opacity: 0; } to { opacity: 1; } }

/* Tarjeta de publicación: realce muy sutil al pasar el cursor. */
.post { transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease); }
.post:hover { box-shadow: 0 2px 4px rgba(0,0,0,0.04), 0 8px 28px rgba(0,0,0,0.07); }
[data-theme="dark"] .post:hover { box-shadow: 0 2px 4px rgba(0,0,0,0.3), 0 8px 28px rgba(0,0,0,0.45); }

/* Composer: el disparador reacciona al foco/hover. */
.composer__disparador { transition: background 0.15s var(--ease), transform 0.15s var(--spring); }
.composer__disparador:active { transform: scale(0.99); }

/* Vacío con carácter. */
.estado-vacio { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.estado-vacio svg { width: 44px; height: 44px; color: var(--text-3); margin-bottom: 12px; }
.estado-vacio strong { display: block; font-size: 16px; color: var(--text); margin-bottom: 4px; font-weight: 600; }
.estado-vacio span { font-size: 14px; }
