* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: #111b21; color: #e9edef; min-height: 100vh; }

.navbar { background: #202c33; padding: 15px 30px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 5px rgba(0,0,0,0.3); }
.nav-brand { font-size: 24px; font-weight: bold; color: #00a884; }
.nav-links a { color: #e9edef; text-decoration: none; margin-left: 20px; font-size: 14px; transition: color 0.3s; }
.nav-links a:hover { color: #00a884; }

.container { max-width: 1200px; margin: 20px auto; padding: 0 20px; }

/* Dashboard: subir (izq.) + conversaciones (dcha.) */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}
.dashboard-col { min-width: 0; }
@media (max-width: 900px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}
.dashboard-upload-fileinfo { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.dashboard-upload-filename { color: #cfd5da; font-size: 13px; flex: 1; min-width: 0; word-break: break-all; }

.btn { padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer; font-size: 14px; transition: all 0.3s; }
.btn-primary { background: #00a884; color: white; }
.btn-primary:hover { background: #017c64; }
.btn-secondary { background: #3b4a54; color: white; }
.btn-secondary:hover { background: #4a5f6f; }

.card { background: #202c33; border-radius: 10px; padding: 20px; margin-bottom: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.3); }

.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; color: #8696a0; font-size: 14px; }
.form-group input, .form-group select, .form-group textarea { 
    width: 100%; padding: 10px; background: #2a3942; border: 1px solid #3b4a54; 
    color: #e9edef; border-radius: 5px; font-size: 14px; 
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: #00a884;
}

.alert { padding: 12px 15px; border-radius: 5px; margin-bottom: 15px; font-size: 14px; }
.alert-error { background: #a42828; border-left: 4px solid #ff4444; }
.alert-success { background: #005c4b; border-left: 4px solid #00a884; }
.alert-info { background: #2a3942; border-left: 4px solid #8696a0; }

.upload-area { border: 2px dashed #3b4a54; border-radius: 10px; padding: 40px; text-align: center; cursor: pointer; transition: all 0.3s; }
.upload-area:hover { border-color: #00a884; background: #2a3942; }

.chat-list { display: grid; gap: 15px; }
/* Texto de ayuda bajo títulos de tarjetas del dashboard (misma carga que “Exporta tu chat…”) */
.dashboard-card-lead { color: #8696a0; margin: 0 0 15px; }
/* Dashboard: tarjeta “Mis conversaciones” — título arriba, botones en renglón propio */
.card-dashboard-conv { display: block; }
.card-dashboard-conv__title {
    display: block;
    width: 100%;
    margin: 0 0 4px;
    padding: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #e9edef;
}
.card-dashboard-conv__empty { color: #8696a0; text-align: center; padding: 20px 0; margin: 0; }
.chat-item {
    background: #2a3942;
    padding: 14px 14px 12px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    transition: background 0.3s;
}
.chat-item:hover { background: #3b4a54; }
.chat-item-head { width: 100%; min-width: 0; }
/* Vista normal: título (fila) + contador (fila). Formulario de edición oculto en DOM hasta “Editar”. */
.chat-item-view--idle[hidden] { display: none !important; }
.chat-item-rename[hidden] { display: none !important; }
.chat-item-rename:not([hidden]) { display: flex; }
.chat-item-view { display: flex; flex-direction: column; align-items: stretch; gap: 4px; width: 100%; }
a.chat-item-title-line {
    display: block;
    width: 100%;
    min-width: 0;
    color: #e9edef;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    word-break: break-word;
    padding: 0;
    margin: 0;
}
a.chat-item-title-line:hover { text-decoration: none; }
a.chat-item-title-line:hover .chat-item-title-text { color: #00a884; }
.chat-meta-line {
    color: #8696a0;
    font-size: 12px;
    line-height: 1.3;
    margin: 0;
    padding: 0 0 2px;
}
.chat-item-bottom {
    display: block;
    width: 100%;
    margin: 0;
    padding-top: 10px;
    border-top: 1px solid #3b4a54;
}
/* Una fila: Editar, Guardar, Cancelar, Eliminar, Ver — solo los visibles comparten el ancho */
.chat-item-actions-bar {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: stretch;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}
.chat-item-actions-bar > * {
    flex: 1 1 0;
    min-width: 0;
    box-sizing: border-box;
}
.chat-item-actions-bar > [hidden] {
    display: none !important;
}
.dash-conv-form-del {
    display: flex;
    margin: 0;
    align-items: stretch;
}
.dash-conv-form-del .dash-conv-btn--fill { width: 100%; }
/* Dentro de la barra, cada control llena su columna flex */
.chat-item-actions-bar .dash-conv-btn--fill { width: 100%; max-width: 100%; }
.dash-conv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none;
    box-sizing: border-box;
    line-height: 1.2;
}
a.dash-conv-btn:hover { text-decoration: none; opacity: 0.95; }
.chat-meta { color: #8696a0; font-size: 13px; margin-top: 5px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin-bottom: 20px; }
.stat-card { background: #2a3942; padding: 20px; border-radius: 8px; text-align: center; }
.stat-number { font-size: 28px; font-weight: bold; color: #00a884; }

.message { position: relative; margin: 2px 0; }
.message-time { font-size: 11px; }

.date-nav { position: sticky; top: 0; background: #111b21; padding: 10px; z-index: 100; border-bottom: 1px solid #3b4a54; }

.bookmark-btn { background: none; border: none; color: #8696a0; cursor: pointer; font-size: 18px; padding: 5px; transition: color 0.3s; }
.bookmark-btn:hover { color: #f0c14b; }

/* #chatContainer: el chat claro aplica con .wa-bubbles-panel; no forzar fondo oscuro (rompía estilos) */

input[type="text"], input[type="password"], input[type="email"] {
    width: 100%; padding: 10px; background: #2a3942; border: 1px solid #3b4a54; 
    color: #e9edef; border-radius: 5px; font-size: 14px;
}

a { color: #00a884; text-decoration: none; }
a:hover { text-decoration: underline; }

small { font-size: 12px; }

/* Date separator estilo WhatsApp */
.date-separator {
    text-align: center;
    margin: 20px 0;
}

/* Vista chat: nav + main = viewport exacto (evita scroll residual del body por altura mal estimada del nav) */
html:has(main.main-full) {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
}
body:has(main.main-full) {
    min-height: 100%;
    min-height: 100dvh;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
body:has(main.main-full) > nav.navbar {
    flex-shrink: 0;
}

/* Main layout full width: el main crece en el flex del body; el scroll queda en #chatContainer / paneles */
main.main-full {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Dashboard: lista de conversaciones (detalle arriba) */
.chat-item-actions {
    width: 100%;
}
.form-inline-delete { margin: 0; }
.chat-item-rename {
    width: 100%;
    min-width: 0;
    align-items: center;
    margin: 0;
}
.dash-rename-input {
    width: 100%;
    max-width: 100%;
    padding: 10px 12px;
    min-height: 40px;
    background: #2a3942;
    border: 1px solid #3b4a54;
    color: #e9edef;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}
.dash-rename-input:focus {
    outline: none;
    border-color: #00a884;
    box-shadow: 0 0 0 1px rgba(0, 168, 132, 0.3);
}
.chat-item.is-editing .dash-rename-input { border-color: #00a884; }
.btn-danger { background: #a42828; color: #fff; }
.btn-danger:hover { background: #c42f2f; }
.wa-btn-block { display: block; width: 100%; text-align: center; box-sizing: border-box; }

/* Ventana de chat centrada (estilo WhatsApp Web) */
.wa-outer {
    width: 100%;
    flex: 1 1 0;
    min-height: 0;
    padding: 8px 12px 12px;
    box-sizing: border-box;
    background: #0b141a;
    display: flex;
    justify-content: center;
    align-items: stretch;
}
.wa-shell {
    width: 100%;
    max-width: 1320px;
    min-height: min(240px, 100%);
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    background: #f0f2f5;
    border-radius: 8px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.35);
    overflow: hidden;
    border: 1px solid #2a3942;
}

.wa-chat-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px 10px 14px;
    background: #f0f2f5;
    border-bottom: 1px solid #d1d7db;
    color: #111b21;
    flex-shrink: 0;
    flex-wrap: nowrap;
    overflow: hidden;
}
.wa-icon-btn[onclick],
.wa-icon-btn[href] { cursor: pointer; }
button.wa-icon-btn { cursor: pointer; }
.wa-toolbar-left { min-width: 0; flex: 0 1 40%; max-width: min(50vw, 420px); display:flex; flex-direction:column; }
.wa-toolbar-left .wa-toolbar-info { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-toolbar-left .wa-toolbar-info strong, .wa-toolbar-left .wa-msg-count {
    display: inline;
}
.wa-toolbar-end {
    display: flex;
    align-items: center;
    gap: 0;
    margin-left: auto;
    flex-shrink: 0;
    min-width: 0;
    flex: 0 1 auto;
    max-width: 58%;
    justify-content: flex-end;
}
.wa-toolbar-searchline {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 0 1 auto;
}
.wa-toolbar-search {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
}
.wa-sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); border: 0; white-space: nowrap;
}
.wa-toolbar-search-ico { color: #667781; font-size: 14px; flex-shrink: 0; }
.wa-toolbar-search-input {
    flex: 1 1 100px; min-width: 72px; padding: 6px 10px; font-size: 14px; border: 1px solid #d1d7db;
    border-radius: 8px; background: #fff; color: #111b21; box-sizing: border-box;
}
.wa-toolbar-search-input:focus { outline: none; border-color: #00a884; }
.wa-toolbar-search-meta { font-size: 11px; color: #008069; font-weight: 700; white-space: nowrap; flex-shrink: 0; min-width: 3em; text-align: center; }
.wa-toolbar-search-hint { font-size: 10px; color: #667781; white-space: nowrap; flex-shrink: 0; max-width: 6.5em; }
.wa-toolbar-search-nav { display: flex; flex-direction: column; flex-shrink: 0; margin-left: 2px; border: 1px solid #d1d7db; border-radius: 6px; overflow: hidden; background: #fff; }
.wa-search-nav {
    display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 20px; padding: 0;
    border: none; background: transparent; color: #54656f; cursor: pointer; font-size: 10px; line-height: 1;
}
.wa-search-nav + .wa-search-nav { border-top: 1px solid #d1d7db; }
.wa-search-nav:hover:not(:disabled) { background: #e9edef; color: #111b21; }
.wa-search-nav:disabled { opacity: 0.35; cursor: not-allowed; }
.wa-row--search-hit { position: relative; }
.wa-row--search-hit::before {
    content: '';
    position: absolute; left: 0; right: 0; top: 0; bottom: 0;
    border-radius: 8px; pointer-events: none;
    box-shadow: 0 0 0 1px rgba(0, 168, 132, 0.35) inset;
}
.wa-row--search-current::before { box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.65) inset; }
.wa-row.wa-search-flash .wa-bubble { animation: waSearchFlash 0.45s ease; }
@keyframes waSearchFlash { 0% { box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.85); } 100% { box-shadow: none; } }
/* Mismo “flash” al enfocar el día en el panel lateral vía búsqueda */
@keyframes waSearchFlashDate { 0% { background: rgba(0, 168, 132, 0.28); } 100% { background: transparent; } }
.wa-day-jump.wa-day-jump--search-flash { animation: waSearchFlashDate 0.45s ease; }
.wa-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.wa-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #d1d7db;
    color: #54656f;
    text-decoration: none;
    font-size: 15px;
    transition: background 0.15s;
}
.wa-icon-btn:hover { background: #e9edef; color: #111b21; }
.wa-toolbar-info strong { font-size: 16px; }
.wa-msg-count { font-size: 12px; font-weight: 600; color: #008069; margin-left: 8px; }
.wa-you-hint { display: block; font-size: 12px; color: #667781; margin-top: 2px; font-weight: normal; }
.wa-name-form { margin-top: 8px; max-width: 420px; }
.wa-name-label { display: block; font-size: 11px; color: #667781; margin-bottom: 4px; }
.wa-name-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wa-name-input {
    flex: 1; min-width: 160px; padding: 6px 10px; font-size: 14px; border: 1px solid #d1d7db;
    border-radius: 6px; background: #fff; color: #111;
}
.wa-name-input:focus { outline: none; border-color: #00a884; }
.wa-name-save {
    padding: 6px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
    background: #00a884; color: #fff; border: none; border-radius: 6px;
}
.wa-name-save:hover { background: #06cf9c; }
.wa-identity { font-size: 13px; color: #3b4a54; margin-top: 6px; line-height: 1.45; max-width: 560px; }
.wa-identity code { background: #e9edef; padding: 1px 5px; border-radius: 3px; font-size: 12px; }
.wa-identity-sub { color: #8696a0; font-size: 11px; }
.wa-identity--warn { color: #7a5c00; }
.wa-senders-hint { font-size: 11px; color: #54656f; line-height: 1.4; margin-top: 8px; max-width: 520px; word-break: break-word; }
.wa-senders-hint strong { color: #111; }
.wa-btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    color: #3b4a54;
    border: 1px solid #d1d7db;
    padding: 7px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s;
    flex-shrink: 0;
}
.wa-btn-back:hover { background: #f5f6f6; }

/* Chat: participantes + bookmarks (izq.) | conversación (centro) | fechas (dcha.) */
.wa-split {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    overflow: hidden;
    background: #e5ddd5;
}
.wa-panel-bm {
    width: 24%;
    min-width: 200px;
    max-width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #f0f2f5;
    border-right: 1px solid #d1d7db;
    box-sizing: border-box;
    padding: 10px 14px 12px;
}
/* Columna izq.: bloque fijo (participantes + form) + lista de bookmarks con scroll propio */
.wa-panel-bm-top {
    flex: 0 0 auto;
    padding: 0;
}
.wa-panel-bm-top .wa-sec:last-child {
    margin-bottom: 10px;
}
.wa-sec--bm-list {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    overflow: hidden;
}
.wa-sec--bm-list .wa-sec-title {
    flex: 0 0 auto;
    margin: 0 0 6px;
    padding: 6px 0 0;
    border-top: 1px solid #e1e4e6;
}
.wa-bm-list-scroll {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 4px 0;
}
.wa-bm-list-scroll .wa-range-item:last-of-type {
    margin-bottom: 0;
}
.wa-panel-chat {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #e5ddd5;
}
.wa-panel-dates {
    width: 12%;
    min-width: 108px;
    max-width: 152px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #f0f2f5;
    border-left: 1px solid #d1d7db;
}
.wa-panel-dates-scroll {
    overflow-y: auto;
    flex: 1;
    padding: 6px 4px 16px 6px;
    -webkit-overflow-scrolling: touch;
}
.wa-panel-dates .wa-date-link { font-size: 10px; padding: 4px 4px; }
.wa-panel-dates .wa-year-title { font-size: 0.7rem; padding: 1px 0 2px; }
.wa-panel-dates .wa-month-title { font-size: 10px; }
.wa-sec { margin-bottom: 18px; }
.wa-sec.wa-sec--bm-list { margin-bottom: 0; }
.wa-sec-title { font-size: 13px; font-weight: 700; color: #111; margin: 0 0 6px; }
.wa-sec-desc { font-size: 11px; color: #667781; margin: 0 0 8px; line-height: 1.35; }
.wa-identity-narrow { font-size: 12px; margin: 0 0 6px; word-break: break-word; }
.wa-senders-tiny { font-size: 10px; color: #667781; line-height: 1.3; word-break: break-word; margin: 0; }
.wa-bm-flash { font-size: 12px; padding: 8px; border-radius: 6px; margin-bottom: 10px; }
.wa-bm-flash-ok { background: #d9fdd3; color: #0a3d2a; }
.wa-bm-flash-err { background: #ffe5e5; color: #8a1f1f; }
.wa-range-form { display: flex; flex-direction: column; gap: 6px; }
.wa-f-label { font-size: 11px; color: #54656f; font-weight: 600; }
.wa-f-input, .wa-f-textarea {
    width: 100%; box-sizing: border-box; padding: 6px 8px; font-size: 13px;
    border: 1px solid #d1d7db; border-radius: 6px; background: #fff; color: #111;
}
.wa-f-label--bm-name { color: #008069; }
.wa-f-input.wa-f-input--bm-name {
    border-color: #7dd3c0;
    background: #f6fffc;
    color: #2a3942;
    -webkit-text-fill-color: #2a3942;
}
.wa-f-input.wa-f-input--bm-name::placeholder {
    color: #8696a0;
    opacity: 1;
}
.wa-f-input.wa-f-input--bm-name:focus {
    outline: none;
    border-color: #00a884;
    background: #fff;
    color: #111b21;
    -webkit-text-fill-color: #111b21;
    box-shadow: 0 0 0 1px rgba(0, 168, 132, 0.25);
}
.wa-f-textarea { resize: vertical; min-height: 44px; }
.wa-f-submit {
    margin-top: 4px; padding: 8px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
    background: #00a884; color: #fff; border: none; border-radius: 6px;
}
.wa-f-submit:hover { background: #06cf9c; }
.wa-empty-bm { font-size: 11px; color: #8696a0; margin: 0; }
.wa-range-item { background: #fff; border: 1px solid #d1d7db; border-radius: 8px; padding: 8px; margin-bottom: 8px; }
.wa-range-item-title { font-weight: 600; font-size: 12px; color: #111; }
.wa-range-item-dt { font-size: 10px; color: #667781; margin: 4px 0; }
/* Tarjeta de bookmark: fila 3 acciones (mismo ancho) + compartir a todo el ancho */
.wa-range-item-btns {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
    width: 100%;
    box-sizing: border-box;
}
.wa-range-item-btns-row {
    display: flex;
    flex-direction: row;
    gap: 6px;
    width: 100%;
    min-width: 0;
}
.wa-bm-action {
    box-sizing: border-box;
    min-height: 32px;
    padding: 5px 6px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px solid transparent;
}
.wa-range-item-btns-row .wa-bm-action {
    flex: 1 1 0;
    min-width: 0;
}
.wa-bm-edit {
    background: #fff;
    color: #111b21;
    border-color: #d1d7db;
}
.wa-bm-edit:hover { background: #e9edef; }
.wa-bm-pdf { background: #00a884; color: #fff; border-color: #00a884; }
.wa-bm-pdf:hover { background: #06cf9c; border-color: #06cf9c; }
.wa-bm-del { background: #a42828; color: #fff; border-color: #a42828; }
.wa-bm-del:hover { background: #c42f2f; border-color: #c42f2f; }
.wa-bm-share.wa-bm-share--full {
    width: 100%;
    gap: 6px;
    background: #fff;
    color: #54656f;
    border-color: #d1d7db;
    font-size: 11px;
}
.wa-bm-share.wa-bm-share--full:hover { background: #e9edef; color: #00a884; border-color: #b8c0c4; }
/* Días (columna derecha): igual que .wa-separator-pill (fecha en el hilo) */
.wa-day-btn {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    padding: 4px 10px;
    margin-bottom: 4px;
    background: #fff;
    color: #54656f;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.25;
    border: none;
    border-radius: 8px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    text-align: left;
}
a.wa-day-btn { text-decoration: none; color: #54656f; -webkit-tap-highlight-color: transparent; }
.wa-day-btn:hover { background: #f5f6f6; color: #3b4a54; }
.wa-day-btn.is-active { background: #d9fdd3; color: #0a3d2a; font-weight: 500; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); border: 1px solid #7eb98c; }
.wd-row1 {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: stretch;
    gap: 4px;
    width: 100%;
    font-size: 12px;
    font-weight: 500;
    color: inherit;
}
.wd-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    min-width: 0;
}
.wd-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    flex-shrink: 0;
}
.wd-d { font-weight: 500; color: inherit; font-size: 12px; }
.wd-c { font-weight: 500; color: inherit; font-size: 11px; white-space: nowrap; }
.wd-w {
    display: block;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.15;
    color: inherit;
    text-transform: lowercase;
    word-wrap: break-word;
}
.wa-day-btn.is-active .wd-d,
.wa-day-btn.is-active .wd-c,
.wa-day-btn.is-active .wd-w { color: #0a3d2a; }

.wa-modal { position: fixed; inset: 0; z-index: 10000; display: none; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; }
.wa-modal.is-open { display: flex; }
.wa-modal[hidden] { display: none !important; }
.wa-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); cursor: pointer; }
.wa-modal-box { position: relative; background: #f0f2f5; border-radius: 10px; max-width: 420px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 16px 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3); color: #111b21; }
.wa-modal-title { font-size: 16px; margin: 0 0 12px; color: #111; font-weight: 700; }
.wa-modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.wa-modal-cancel { padding: 8px 14px; background: #fff; border: 1px solid #d1d7db; border-radius: 6px; cursor: pointer; font-size: 14px; color: #3b4a54; }
.wa-modal-cancel:hover { background: #e9edef; }
.wa-modal-box .wa-f-submit { margin-top: 0; }

#chatContainer.wa-bubbles-panel,
.wa-bubbles-panel#chatContainer {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 12px 20px 12px;
    -webkit-overflow-scrolling: touch;
    background: #e5ddd5;
    background-image: none;
    outline: none;
    scroll-behavior: smooth;
    position: relative;
    direction: ltr;
}

/* Rail de fechas (derecha), compacto, como galería */
.wa-date-rail {
    width: 200px;
    min-width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #f0f2f5;
    border-left: 1px solid #d1d7db;
    color: #111b21;
    max-height: 100%;
    overflow: hidden;
}
.wa-date-rail-inner {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 8px 12px 10px;
    font-size: 12px;
}
.wa-dates-label {
    color: #667781;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    font-weight: 600;
}
.wa-dates-empty { color: #667781; font-size: 12px; margin: 0; }
.wa-date-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    color: #3b4a54;
    text-decoration: none;
    font-size: 12px;
    line-height: 1.2;
    margin-bottom: 1px;
    transition: background 0.12s, color 0.12s;
    border: 1px solid transparent;
}
.wa-date-link:hover { background: #e9edef; }
.wa-date-link.is-active { background: #d9fdd3; border-color: #b8e0b0; color: #0a3d2a; font-weight: 600; }
.wa-date-link-all { margin-bottom: 8px; background: #e9edef; color: #111; font-weight: 500; }
.wa-date-link-all.is-active { background: #d9fdd3; border: 1px solid #7eb98c; }
.wa-day-count { margin-left: auto; font-size: 10px; color: #8696a0; }
.wa-date-link.is-active .wa-day-count { color: #0a3d2a; }
.wa-day-dow { font-size: 9px; text-transform: lowercase; color: #8696a0; }
.wa-year { margin-bottom: 12px; }
.wa-year-title {
    color: #008069;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 4px;
    position: sticky;
    top: 0;
    background: #f0f2f5;
    padding: 2px 0 4px;
    z-index: 1;
}
.wa-month { margin-left: 0; margin-bottom: 6px; }
.wa-month-title { color: #3b4a54; font-size: 12px; font-weight: 600; margin: 0 0 2px; }
.wa-day-list { list-style: none; margin: 0; padding: 0; }

.wa-separator {
    text-align: center;
    margin: 16px 0 12px;
    scroll-margin-top: 12px;
}
.wa-separator-pill {
    display: inline-block;
    background: #fff;
    color: #54656f;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 8px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.08);
}

.wa-bubbles-panel .wa-row {
    display: flex;
    flex-direction: row;
    width: 100%;
    max-width: 100%;
    margin: 2px 0;
    clear: both;
    box-sizing: border-box;
}
.wa-bubbles-panel .wa-row-me {
    justify-content: flex-end;
    align-items: flex-start;
}
.wa-bubbles-panel .wa-row-them {
    justify-content: flex-start;
    align-items: flex-start;
}
.wa-bubble-col {
    max-width: min(78%, 420px);
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 0 1 auto;
}
/* Clave: alinear burbujas propias a la derecha aunque falle flex en el host */
.wa-bubbles-panel .wa-row-me .wa-bubble-col {
    align-items: flex-end;
    margin-left: auto;
    margin-right: 0;
}
.wa-bubbles-panel .wa-row-them .wa-bubble-col {
    margin-right: auto;
    margin-left: 0;
}

.wa-sender-name {
    font-size: 12px;
    color: #00a884;
    font-weight: 600;
    margin: 0 0 2px 4px;
}
.wa-row-me .wa-sender-name { display: none; }

.wa-bubble {
    position: relative;
    box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
    padding: 6px 8px 4px 10px;
    word-wrap: break-word;
}
.wa-bubble-them {
    background: #ffffff;
    color: #111b21;
    border-radius: 12px 12px 12px 4px;
}
.wa-bubble-me {
    background: #d9fdd3;
    color: #111b21;
    border-radius: 12px 12px 4px 12px;
}
.wa-bubble-text { font-size: 14px; line-height: 1.45; }
a.wa-msg-link {
    color: #53bdeb;
    text-decoration: underline;
    word-break: break-all;
}
.wa-bubble-text a.wa-msg-link { color: #0277bd; }
.wa-bubble-me .wa-bubble-text a.wa-msg-link { color: #026aa1; }
.wa-bubble-media { font-size: 12px; color: #667781; margin-top: 4px; }
.wa-bubble-them .wa-bubble-media { color: #667781; }
.wa-bubble-me .wa-bubble-media { color: #667781; }
.wa-bubble-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 2px;
    padding: 0 0 0 6px;
}
.wa-bubble-time { font-size: 11px; color: #667781; }
.wa-bubble-tick { font-size: 10px; color: #53bdeb; }
.wa-bm-wrap { text-align: right; width: 100%; }
.wa-row-them .wa-bm-wrap { text-align: left; }
.wa-bm {
    background: none;
    border: none;
    cursor: pointer;
    color: #aebac1;
    font-size: 16px;
    padding: 2px 4px;
    line-height: 1;
    vertical-align: middle;
}
.wa-bm:hover { color: #f0b90b; }
.wa-bm.wa-bm--on { color: #f0b90b; }

/* Scrollbars — vista chat tema claro (Firefox + WebKit) */
.wa-outer #chatContainer.wa-bubbles-panel,
.wa-outer .wa-bm-list-scroll,
.wa-outer .wa-panel-dates-scroll,
.wa-outer .wa-modal-box {
    scrollbar-width: thin;
    scrollbar-color: rgba(17, 27, 33, 0.35) rgba(0, 0, 0, 0.08);
}
.wa-outer #chatContainer.wa-bubbles-panel::-webkit-scrollbar,
.wa-outer .wa-bm-list-scroll::-webkit-scrollbar,
.wa-outer .wa-panel-dates-scroll::-webkit-scrollbar,
.wa-outer .wa-modal-box::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.wa-outer #chatContainer.wa-bubbles-panel::-webkit-scrollbar-track,
.wa-outer .wa-bm-list-scroll::-webkit-scrollbar-track,
.wa-outer .wa-panel-dates-scroll::-webkit-scrollbar-track,
.wa-outer .wa-modal-box::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.06);
    border-radius: 4px;
}
.wa-outer #chatContainer.wa-bubbles-panel::-webkit-scrollbar-thumb,
.wa-outer .wa-bm-list-scroll::-webkit-scrollbar-thumb,
.wa-outer .wa-panel-dates-scroll::-webkit-scrollbar-thumb,
.wa-outer .wa-modal-box::-webkit-scrollbar-thumb {
    background: rgba(17, 27, 33, 0.28);
    border-radius: 4px;
}
.wa-outer #chatContainer.wa-bubbles-panel::-webkit-scrollbar-thumb:hover,
.wa-outer .wa-bm-list-scroll::-webkit-scrollbar-thumb:hover,
.wa-outer .wa-panel-dates-scroll::-webkit-scrollbar-thumb:hover,
.wa-outer .wa-modal-box::-webkit-scrollbar-thumb:hover {
    background: rgba(17, 27, 33, 0.42);
}

/* Vista chat: tema oscuro (clase en #waChatThemeRoot, preferencia en localStorage) */
.wa-chat-theme-dark.wa-outer { background: #0a1014; }
.wa-chat-theme-dark .wa-shell {
    background: #111b21;
    border-color: #2a3942;
    box-shadow: 0 2px 24px rgba(0, 0, 0, 0.55);
}
.wa-chat-theme-dark .wa-chat-toolbar {
    background: #111b21;
    border-bottom-color: #2a3942;
    color: #e9edef;
}
.wa-chat-theme-dark .wa-toolbar-info strong { color: #e9edef; }
.wa-chat-theme-dark .wa-msg-count { color: #53bdeb; }
.wa-chat-theme-dark .wa-btn-back {
    background: #2a3942;
    color: #e9edef;
    border-color: #3b4a54;
}
.wa-chat-theme-dark .wa-btn-back:hover { background: #3b4a54; }
.wa-chat-theme-dark .wa-toolbar-search-ico { color: #8696a0; }
.wa-chat-theme-dark .wa-toolbar-search-input {
    background: #2a3942;
    border-color: #3b4a54;
    color: #e9edef;
}
.wa-chat-theme-dark .wa-toolbar-search-input:focus { border-color: #00a884; }
.wa-chat-theme-dark .wa-toolbar-search-meta { color: #53bdeb; }
.wa-chat-theme-dark .wa-toolbar-search-hint { color: #8696a0; }
.wa-chat-theme-dark .wa-toolbar-search-nav {
    background: #2a3942;
    border-color: #3b4a54;
}
.wa-chat-theme-dark .wa-search-nav { color: #aebac1; }
.wa-chat-theme-dark .wa-search-nav + .wa-search-nav { border-top-color: #3b4a54; }
.wa-chat-theme-dark .wa-search-nav:hover:not(:disabled) {
    background: #3b4a54;
    color: #e9edef;
}
.wa-chat-theme-dark .wa-icon-btn {
    background: #2a3942;
    border-color: #3b4a54;
    color: #aebac1;
}
.wa-chat-theme-dark .wa-icon-btn:hover {
    background: #3b4a54;
    color: #e9edef;
}
.wa-chat-theme-dark .wa-split { background: #0b141a; }
.wa-chat-theme-dark .wa-panel-bm,
.wa-chat-theme-dark .wa-panel-dates {
    background: #111b21;
    border-color: #2a3942;
}
.wa-chat-theme-dark .wa-panel-chat { background: #0b141a; }
.wa-chat-theme-dark .wa-sec--bm-list .wa-sec-title { border-top-color: #2a3942; }
.wa-chat-theme-dark .wa-sec-title { color: #e9edef; }
.wa-chat-theme-dark .wa-f-label { color: #8696a0; }
.wa-chat-theme-dark .wa-f-input,
.wa-chat-theme-dark .wa-f-textarea {
    background: #2a3942;
    border-color: #3b4a54;
    color: #e9edef;
}
.wa-chat-theme-dark .wa-f-label--bm-name { color: #53bdeb; }
.wa-chat-theme-dark .wa-f-input.wa-f-input--bm-name {
    border-color: #005c4b;
    background: #1a2428;
    color: #e9edef;
    -webkit-text-fill-color: #e9edef;
}
.wa-chat-theme-dark .wa-f-input.wa-f-input--bm-name:focus {
    background: #2a3942;
    color: #fff;
    -webkit-text-fill-color: #fff;
}
.wa-chat-theme-dark .wa-empty-bm { color: #8696a0; }
.wa-chat-theme-dark .wa-range-item {
    background: #2a3942;
    border-color: #3b4a54;
}
.wa-chat-theme-dark .wa-range-item-title { color: #e9edef; }
.wa-chat-theme-dark .wa-range-item-dt { color: #8696a0; }
.wa-chat-theme-dark .wa-bm-edit {
    background: #2a3942;
    color: #e9edef;
    border-color: #3b4a54;
}
.wa-chat-theme-dark .wa-bm-edit:hover { background: #3b4a54; }
.wa-chat-theme-dark .wa-bm-share.wa-bm-share--full {
    background: #2a3942;
    color: #aebac1;
    border-color: #3b4a54;
}
.wa-chat-theme-dark .wa-bm-share.wa-bm-share--full:hover {
    background: #3b4a54;
    color: #53bdeb;
}
.wa-chat-theme-dark .wa-day-btn {
    background: #2a3942;
    color: #e9edef;
    box-shadow: none;
}
.wa-chat-theme-dark a.wa-day-btn { color: #e9edef; }
.wa-chat-theme-dark .wa-day-btn:hover {
    background: #3b4a54;
    color: #fff;
}
.wa-chat-theme-dark .wa-day-btn.is-active {
    background: #1f3d32;
    color: #aaf5cb;
    border: 1px solid #00a884;
    box-shadow: none;
}
.wa-chat-theme-dark .wa-day-btn.is-active .wd-d,
.wa-chat-theme-dark .wa-day-btn.is-active .wd-c,
.wa-chat-theme-dark .wa-day-btn.is-active .wd-w { color: #aaf5cb; }
.wa-chat-theme-dark .wa-year-title {
    background: #111b21;
    color: #53bdeb;
}
.wa-chat-theme-dark .wa-month-title { color: #aebac1; }
.wa-chat-theme-dark .wa-date-link { color: #aebac1; }
.wa-chat-theme-dark .wa-date-link:hover { background: #2a3942; }
.wa-chat-theme-dark .wa-date-link-all {
    background: #2a3942;
    color: #e9edef;
}
.wa-chat-theme-dark .wa-date-link.is-active,
.wa-chat-theme-dark .wa-date-link-all.is-active {
    background: #1f3d32;
    border-color: #00a884;
    color: #d9fdd3;
}
.wa-chat-theme-dark #chatContainer.wa-bubbles-panel,
.wa-chat-theme-dark .wa-bubbles-panel#chatContainer {
    background: #0b141a;
    background-image: none;
}
.wa-chat-theme-dark .wa-separator-pill {
    background: #2a3942;
    color: #8696a0;
    box-shadow: none;
}
.wa-chat-theme-dark .wa-bubble-them {
    background: #202c33;
    color: #e9edef;
}
.wa-chat-theme-dark .wa-bubble-me {
    background: #005c4b;
    color: #e9edef;
}
.wa-chat-theme-dark .wa-sender-name { color: #53bdeb; }
.wa-chat-theme-dark .wa-bubble-time,
.wa-chat-theme-dark .wa-bubble-media { color: #8696a0; }
.wa-chat-theme-dark .wa-bubble-text a.wa-msg-link { color: #7dd3fc; }
.wa-chat-theme-dark .wa-bubble-me .wa-bubble-text a.wa-msg-link { color: #9de8f7; }
.wa-chat-theme-dark .wa-bubble-tick { color: #53bdeb; }
.wa-chat-theme-dark .wa-modal-box {
    background: #202c33;
    color: #e9edef;
    border: 1px solid #3b4a54;
}
.wa-chat-theme-dark .wa-modal-title { color: #e9edef; }
.wa-chat-theme-dark .wa-modal-cancel {
    background: #2a3942;
    color: #e9edef;
    border-color: #3b4a54;
}
.wa-chat-theme-dark .wa-modal-cancel:hover { background: #3b4a54; }
.wa-chat-theme-dark .wa-bm-flash-ok {
    background: #1f3d32;
    color: #aaf5cb;
}
.wa-chat-theme-dark .wa-bm-flash-err {
    background: #3d2020;
    color: #ffb4b4;
}

/* Scrollbars — tema oscuro (mismas zonas que arriba) */
.wa-chat-theme-dark.wa-outer #chatContainer.wa-bubbles-panel,
.wa-chat-theme-dark.wa-outer .wa-bm-list-scroll,
.wa-chat-theme-dark.wa-outer .wa-panel-dates-scroll,
.wa-chat-theme-dark.wa-outer .wa-modal-box {
    scrollbar-color: #3b4a54 #0b141a;
}
.wa-chat-theme-dark.wa-outer #chatContainer.wa-bubbles-panel::-webkit-scrollbar-track,
.wa-chat-theme-dark.wa-outer .wa-bm-list-scroll::-webkit-scrollbar-track,
.wa-chat-theme-dark.wa-outer .wa-panel-dates-scroll::-webkit-scrollbar-track,
.wa-chat-theme-dark.wa-outer .wa-modal-box::-webkit-scrollbar-track {
    background: #0b141a;
    border-radius: 4px;
}
.wa-chat-theme-dark.wa-outer #chatContainer.wa-bubbles-panel::-webkit-scrollbar-thumb,
.wa-chat-theme-dark.wa-outer .wa-bm-list-scroll::-webkit-scrollbar-thumb,
.wa-chat-theme-dark.wa-outer .wa-panel-dates-scroll::-webkit-scrollbar-thumb,
.wa-chat-theme-dark.wa-outer .wa-modal-box::-webkit-scrollbar-thumb {
    background: #3b4a54;
    border-radius: 4px;
    border: 2px solid #0b141a;
    background-clip: padding-box;
}
.wa-chat-theme-dark.wa-outer #chatContainer.wa-bubbles-panel::-webkit-scrollbar-thumb:hover,
.wa-chat-theme-dark.wa-outer .wa-bm-list-scroll::-webkit-scrollbar-thumb:hover,
.wa-chat-theme-dark.wa-outer .wa-panel-dates-scroll::-webkit-scrollbar-thumb:hover,
.wa-chat-theme-dark.wa-outer .wa-modal-box::-webkit-scrollbar-thumb:hover {
    background: #4a5f6f;
    background-clip: padding-box;
}

/* Responsive: tramos, chat, fechas en columna */
@media (max-width: 800px) {
    .wa-split { flex-direction: column; }
    .wa-panel-bm {
        width: 100%;
        max-width: none;
        max-height: 38vh;
        border-right: none;
        border-bottom: 1px solid #d1d7db;
    }
    .wa-chat-theme-dark .wa-panel-bm { border-bottom-color: #2a3942; }
    .wa-panel-dates {
        width: 100%;
        max-width: none;
        max-height: 32vh;
        border-left: none;
        border-top: 1px solid #d1d7db;
    }
    .wa-chat-theme-dark .wa-panel-dates { border-top-color: #2a3942; }
    .wa-panel-chat { min-height: 35vh; }
    .wa-chat-toolbar { flex-wrap: wrap; }
    .wa-toolbar-left { max-width: 100%; flex: 1 1 100%; }
    .wa-toolbar-end { max-width: 100%; width: 100%; margin-left: 0; justify-content: stretch; }
    .wa-toolbar-searchline { width: 100%; max-width: 100%; }
    .wa-toolbar-search { flex: 1 1 200px; min-width: 120px; }
    .wa-date-rail {
        width: 100%;
        min-width: 0;
        max-height: 32vh;
        border-left: none;
        border-top: 1px solid #d1d7db;
    }
    .wa-chat-theme-dark .wa-date-rail { border-top-color: #2a3942; }
    .wa-date-rail-inner { max-height: 28vh; }
    .wa-shell { max-height: none; }
}
@media (max-width: 768px) {
    .navbar { padding: 10px 15px; flex-direction: column; gap: 10px; }
    .nav-links a { margin: 0 10px; font-size: 12px; }
    .container { padding: 0 10px; }
}

/* ── Media stats en toolbar (chat) ── */
.wa-media-stats {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    font-size: 10px;
    color: #54656f;
    flex-wrap: wrap;
    min-width: 0;
}
.wa-media-stat {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
}
.wa-media-stat i {
    font-size: 10px;
}
.wa-chat-theme-dark .wa-media-stats { color: #8696a0; }

/* ── Badge "Reenviado" ── */
.wa-forward-badge {
    font-size: 10px;
    font-weight: 600;
    color: #8696a0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.wa-forward-badge i { font-size: 9px; }
.wa-chat-theme-dark .wa-forward-badge { color: #667781; }

/* ── Fila datetime + OK ── */
.wa-dt-row {
    display: flex;
    flex-direction: row;
    gap: 4px;
    align-items: center;
}
.wa-f-input.wa-f-input-dt {
    flex: 1;
    min-width: 0;
}
.wa-dt-ok {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #d1d7db;
    border-radius: 6px;
    background: #fff;
    color: #00a884;
    cursor: pointer;
    font-size: 12px;
    flex-shrink: 0;
    transition: background 0.15s;
}
.wa-dt-ok:hover { background: #e9edef; }
.wa-chat-theme-dark .wa-dt-ok {
    background: #2a3942;
    border-color: #3b4a54;
    color: #53bdeb;
}
.wa-chat-theme-dark .wa-dt-ok:hover { background: #3b4a54; }

/* ── Botón bookmark por día (inline en wd-row1) ── */
.wa-day-bookmark-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #aebac1;
    font-size: 10px;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.15s;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}
.wa-day-bookmark-btn:hover { color: #f0b90b; }
.wa-day-btn.is-active .wa-day-bookmark-btn { color: #0a3d2a; }
.wa-chat-theme-dark .wa-day-bookmark-btn { color: #667781; }
.wa-chat-theme-dark .wa-day-bookmark-btn:hover { color: #f0b90b; }
.wa-chat-theme-dark .wa-day-btn.is-active .wa-day-bookmark-btn { color: #aaf5cb; }
