/* ============================================================
   Asistente WhatsApp con Claude · Panel
   Tema oscuro. Para adaptar la identidad del negocio alcanza con
   cambiar las variables de :root (sobre todo --acento).
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;600;700&display=swap');

:root {
    --bg: #0a0a0a;
    --elev: #111111;
    --card: #181818;
    --card-hover: #1f1f1f;
    --border: #262626;
    --border-strong: #333;
    --text: #f5f5f5;
    --dim: #a3a3a3;
    --mute: #6b6b6b;
    --acento: #c39858;        /* dorado de matrimonio.pro */
    --acento-texto: #ffffff;  /* texto sobre el acento */
    --rojo: #ed6c84;
    --verde: #95c11f;
    --amarillo: #fdc41f;
    --radius: 16px;
    --sidebar-w: 240px;
    --topbar-h: 58px;
    --font-body: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
}
a { color: var(--acento); }
svg.icono { flex-shrink: 0; }
code { background: var(--card-hover); padding: 1px 6px; border-radius: 6px; font-size: .88em; }

/* ---------- Estructura: sidebar fija + contenido ---------- */
.app { display: flex; min-height: 100dvh; }
.main {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}
.main.sola { margin-left: 0; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    z-index: 40;
    display: flex;
    flex-direction: column;
    background: var(--elev);
    border-right: 1px solid var(--border);
    transition: transform .22s ease;
}
.sidebar-marca {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--border);
    min-height: var(--topbar-h);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: 1; min-width: 0; }
.brand-cuadro {
    width: 34px; height: 34px;
    flex-shrink: 0;
    background: var(--acento);
    color: var(--acento-texto);
    font-weight: 800;
    font-size: .9rem;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
}
.brand-cuadro.grande { width: 56px; height: 56px; border-radius: 14px; font-size: 1.35rem; }
.brand-texto {
    color: var(--text);
    font-weight: 800;
    font-size: .92rem;
    letter-spacing: .05em;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.brand-texto small {
    display: block;
    font-weight: 400;
    font-size: .66rem;
    letter-spacing: .02em;
    color: var(--mute);
}

.nav { flex: 1; overflow-y: auto; padding: 8px 0 12px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 1px 10px;
    padding: 9px 12px;
    border-radius: 10px;
    color: var(--dim);
    text-decoration: none;
    font-size: .93rem;
    font-weight: 600;
    white-space: nowrap;
}
.nav-item svg { color: var(--mute); }
.nav-item:hover { background: var(--card-hover); color: var(--text); }
.nav-item:hover svg { color: var(--acento); }
.nav-item.activo { background: var(--acento); color: var(--acento-texto); }
.nav-item.activo svg { color: var(--acento-texto); }
.nav-item .badge { margin-left: auto; }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid var(--border);
}
.sidebar-user-datos { flex: 1; min-width: 0; line-height: 1.25; }
.sidebar-user-datos strong { display: block; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-datos small { color: var(--mute); font-size: .74rem; display: block; }

.avatar {
    width: 36px; height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--acento);
    color: var(--acento-texto);
    font-weight: 700;
    font-size: .82rem;
    display: flex; align-items: center; justify-content: center;
}

.btn-icono {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    flex-shrink: 0;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--dim);
    cursor: pointer;
    padding: 0;
    margin: 0;
    text-decoration: none;
}
.btn-icono:hover { background: var(--card-hover); color: var(--acento); }
.btn-cerrar-menu { display: none; }

/* ---------- Barra superior ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--topbar-h);
    padding: 0 18px;
    background: rgba(10,10,10,.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.btn-menu { display: none; }
.topbar-titulo {
    flex: 1;
    min-width: 0;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: .95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Contenido ---------- */
.contenido { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 22px 22px 40px; }
h1 {
    font-weight: 800;
    text-transform: uppercase;
    font-size: 1.3rem;
    margin: 4px 0 18px;
    letter-spacing: .03em;
}
h2 {
    font-weight: 800;
    text-transform: uppercase;
    font-size: .95rem;
    margin: 26px 0 10px;
    letter-spacing: .04em;
}
.sub { color: var(--dim); font-size: .9rem; }

.flash {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 15px;
    border-radius: 12px;
    margin-bottom: 12px;
    border: 1px solid transparent;
    font-size: .93rem;
}
.flash svg { margin-top: 1px; }
.flash.ok { background: rgba(149,193,31,.12); color: var(--verde); border-color: rgba(149,193,31,.3); }
.flash.error { background: rgba(237,108,132,.12); color: var(--rojo); border-color: rgba(237,108,132,.3); }

/* ---------- Avisos internos ---------- */
.avisos-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 10px;
    padding: 12px 15px;
    border-radius: 12px;
    background: rgba(253,196,31,.1);
    border: 1px solid rgba(253,196,31,.35);
    color: var(--amarillo);
    font-size: .92rem;
}
.avisos-banner .avisos-lista { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.avisos-banner small { color: var(--dim); }

/* ---------- Tablas ---------- */
.tabla-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: .92rem; vertical-align: top; }
th { background: var(--card-hover); color: var(--dim); font-weight: 600; text-transform: uppercase; font-size: .74rem; letter-spacing: .07em; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
table tr:hover td { background: rgba(255,255,255,.02); }

/* ---------- Formularios ---------- */
form.panel, .panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 18px;
}
label { display: block; font-size: .88rem; margin: 12px 0 5px; color: var(--dim); }
input[type=text], input[type=number], input[type=password], input[type=tel],
input[type=email], input[type=search], select, textarea {
    width: 100%;
    padding: 11px;
    border: 1px solid var(--border-strong);
    border-radius: 11px;
    font-size: 1rem;
    font-family: var(--font-body);
    background: var(--elev);
    color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--acento); outline-offset: -1px; }
textarea { min-height: 70px; line-height: 1.4; }
input[readonly] { color: var(--dim); cursor: copy; }

.boton, button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--acento);
    color: var(--acento-texto);
    border: none;
    padding: 11px 20px;
    border-radius: 11px;
    font-size: .98rem;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    text-decoration: none;
    margin-top: 10px;
}
.boton:hover, button:hover { filter: brightness(1.08); }
.boton.secundario, button.secundario { background: var(--border-strong); color: var(--text); }
.boton.chico, button.chico { padding: 6px 13px; font-size: .86rem; margin-top: 0; border-radius: 9px; }
.boton.peligro, button.peligro { background: var(--rojo); color: #2b0a12; }

/* ---------- Pills y badges ---------- */
.badge {
    display: inline-block;
    background: var(--acento);
    color: var(--acento-texto);
    border-radius: 20px;
    padding: 1px 9px;
    font-size: .78rem;
    font-weight: 700;
}
.pill {
    display: inline-block;
    background: var(--card-hover);
    color: var(--dim);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px 11px;
    font-size: .8rem;
    white-space: nowrap;
}
.pill.verde { background: rgba(149,193,31,.15); color: var(--verde); border-color: rgba(149,193,31,.35); }
.pill.rojo { background: rgba(237,108,132,.15); color: var(--rojo); border-color: rgba(237,108,132,.35); }
.pill.amarillo { background: rgba(253,196,31,.14); color: var(--amarillo); border-color: rgba(253,196,31,.4); }
.rol-desc { font-size: .85rem; color: var(--dim); margin-top: 6px; }

/* ---------- Login ---------- */
.login-caja { max-width: 380px; margin: 9dvh auto 0; }
.login-marca { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 20px; text-align: center; }
.login-marca h1 { margin: 0; font-size: 1.5rem; }
.login-marca .sub { margin-top: -6px; }

.pie { text-align: center; color: var(--mute); font-size: .78rem; padding: 14px 0 20px; }

/* ============================================================
   Chat estilo WhatsApp Web (pantalla completa)
   ============================================================ */
body.pagina-chat .main { height: 100dvh; overflow: hidden; }
body.pagina-chat .contenido {
    flex: 1; min-height: 0;
    max-width: none; width: 100%;
    margin: 0; padding: 0;
    display: flex; flex-direction: column;
}
body.pagina-chat h1, body.pagina-chat .pie { display: none; }

.wa-app {
    flex: 1; min-height: 0;
    display: flex;
    background: #111b21;
    overflow: hidden;
}
.wa-lista {
    width: 340px; min-width: 260px;
    display: flex; flex-direction: column;
    background: #111b21;
    border-right: 1px solid #222d34;
}
.wa-lista-header {
    padding: 14px 16px 10px;
    color: #e9edef;
    display: flex; flex-direction: column; gap: 10px;
    border-bottom: 1px solid #222d34;
}
.wa-lista-header strong { font-size: 1.15rem; }
.wa-lista-header input {
    background: #202c33;
    border: none;
    border-radius: 8px;
    color: #e9edef;
    padding: 8px 12px;
    font-size: .88rem;
    width: 100%;
}
.wa-lista-header input:focus { outline: 1px solid #2a3942; }
.wa-lista-items { flex: 1; overflow-y: auto; }
.wa-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 11px 14px;
    text-decoration: none;
    color: #e9edef;
}
.wa-item:hover { background: #202c33; }
.wa-item.activo { background: #2a3942; }
.wa-item-info { min-width: 0; flex: 1; border-bottom: 1px solid #1a242b; padding-bottom: 10px; }
.wa-item:last-child .wa-item-info { border-bottom: none; }
.wa-item-fila { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.wa-item-fila strong { font-size: .98rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-item-fila time { color: #8696a0; font-size: .72rem; flex-shrink: 0; }
.wa-item-info small { color: #8696a0; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; margin-top: 2px; }
.wa-avatar {
    flex-shrink: 0;
    width: 46px; height: 46px;
    border-radius: 50%;
    color: #fff;
    font-weight: 600;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem;
}

.wa-chat { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #0b141a; position: relative; }
.wa-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    background: #202c33;
    color: #e9edef;
    z-index: 2;
}
.wa-chat-header .wa-avatar { width: 40px; height: 40px; font-size: 1rem; }
.wa-chat-header-info strong { display: block; font-size: .98rem; font-weight: 500; }
.wa-chat-header-info small { color: #8696a0; font-size: .78rem; }
.wa-volver { display: none; color: #aebac1; text-decoration: none; line-height: 1; padding: 4px 6px; }

.wa-mensajes {
    flex: 1;
    overflow-y: auto;
    padding: 16px 6% 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: linear-gradient(rgba(11,20,26,.96), rgba(11,20,26,.96));
    scrollbar-width: thin;
    scrollbar-color: #374045 transparent;
}
.wa-mensajes::-webkit-scrollbar { width: 6px; }
.wa-mensajes::-webkit-scrollbar-thumb { background: #374045; border-radius: 3px; }

.wa-fecha-chip { text-align: center; margin: 12px 0 8px; }
.wa-fecha-chip span {
    display: inline-block;
    background: #182229;
    color: #8696a0;
    font-size: .72rem;
    padding: 5px 12px;
    border-radius: 8px;
    box-shadow: 0 1px 1px rgba(0,0,0,.3);
    letter-spacing: .03em;
}

.wa-burbuja {
    position: relative;
    max-width: 65%;
    padding: 6px 9px 7px;
    border-radius: 8px;
    color: #e9edef;
    font-size: .9rem;
    line-height: 1.35;
    box-shadow: 0 1px 1px rgba(0,0,0,.25);
    margin-bottom: 2px;
}
.wa-burbuja .wa-texto { white-space: pre-wrap; word-wrap: break-word; padding-right: 60px; }
.wa-burbuja.entrada { background: #202c33; align-self: flex-start; border-top-left-radius: 2px; }
.wa-burbuja.salida { background: #005c4b; align-self: flex-end; border-top-right-radius: 2px; }
.wa-burbuja.entrada::before, .wa-burbuja.salida::before {
    content: '';
    position: absolute;
    top: 0;
    border: 6px solid transparent;
}
.wa-burbuja.entrada::before { left: -10px; border-top-color: #202c33; border-right-color: #202c33; }
.wa-burbuja.salida::before { right: -10px; border-top-color: #005c4b; border-left-color: #005c4b; }
.wa-hora {
    position: absolute;
    right: 9px;
    bottom: 5px;
    font-size: .66rem;
    color: rgba(233,237,239,.55);
    white-space: nowrap;
}
.wa-check { font-style: normal; color: #53bdeb; }

.wa-estado {
    display: none;
    padding: 6px 16px;
    color: var(--amarillo);
    font-size: .82rem;
    background: #182229;
}
.wa-composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 12px;
    background: #202c33;
}
.wa-composer textarea {
    flex: 1;
    min-height: 0;
    height: 44px;
    resize: none;
    border: none;
    border-radius: 22px;
    background: #2a3942;
    color: #e9edef;
    padding: 12px 18px;
    font-size: .95rem;
    max-height: 110px;
    line-height: 1.3;
}
.wa-composer textarea:focus { outline: none; }
.wa-composer textarea::placeholder { color: #8696a0; }
.wa-btn {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
    padding: 0;
}
.wa-btn.enviar { background: #00a884; color: #fff; }
.wa-btn.enviar svg { margin-left: 2px; }
.wa-btn.sugerir { background: var(--acento); color: var(--acento-texto); }
.wa-btn:disabled { opacity: .4; cursor: default; }

.wa-vacio {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #8696a0;
    border-bottom: 5px solid var(--acento);
}
.wa-vacio-logo { color: #374045; }
.wa-vacio h2 { color: #e9edef; text-transform: none; font-weight: 400; font-size: 1.4rem; }

/* ============================================================
   Responsive
   ============================================================ */
.cortina {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(2px);
    z-index: 39;
}

@media (max-width: 980px) {
    .sidebar { transform: translateX(-102%); width: min(300px, 86vw); box-shadow: 20px 0 60px rgba(0,0,0,.5); }
    body.menu-abierto .sidebar { transform: translateX(0); }
    body.menu-abierto .cortina { display: block; }
    body.menu-abierto { overflow: hidden; }
    .main { margin-left: 0; }
    .btn-cerrar-menu { display: inline-flex; }
    .btn-menu { display: inline-flex; }
    .topbar { padding: 0 12px; }
    .contenido { padding: 16px 14px 40px; }
    .contenido > h1 { display: none; }
}

@media (max-width: 700px) {
    .wa-lista { width: 100%; min-width: 0; border-right: none; }
    .wa-app:not(.chat-abierto) .wa-chat { display: none; }
    .wa-app.chat-abierto .wa-lista { display: none; }
    .wa-volver { display: block; }
    .wa-burbuja { max-width: 84%; }
    .wa-mensajes { padding: 12px 3% 8px; }
}
