/* =========================================================================
   Automatizador Social — hoja de estilos
   Concepto: "sala de emisión". La cola de publicaciones baja por un riel
   con las horas en tipografía monoespaciada, como una parrilla de TV.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,700;12..96,800&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
    --tinta:       #17153a;
    --tinta-suave: #2a2740;
    --papel:       #f7f6f2;
    --superficie:  #ffffff;
    --linea:       #e6e3da;
    --texto:       #2a2740;
    --tenue:       #6b6880;

    --accion:      #e0447a;  /* rosa/magenta: acción principal */
    --accion-osc:  #c22f63;
    --exito:       #0f9d8c;  /* teal: publicado */
    --pendiente:   #e8912a;  /* ámbar: programado */
    --error:       #d0402c;  /* rojo: error */

    --radio: 14px;
    --sombra: 0 1px 2px rgba(23,21,58,.06), 0 8px 24px rgba(23,21,58,.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--papel);
    color: var(--texto);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

h1, h2, h3 {
    font-family: 'Bricolage Grotesque', 'Inter', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
    color: var(--tinta);
}

a { color: var(--accion); }

.mono { font-family: 'JetBrains Mono', monospace; }

/* --- Barra superior ------------------------------------------------------ */
.barra {
    background: var(--tinta);
    color: #fff;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.barra .marca {
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.barra .marca strong {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 800;
    font-size: 19px;
    color: #fff;
    letter-spacing: -0.02em;
}
.barra .marca span { color: #b8b4d8; font-size: 13px; }
.barra .senal {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--exito);
    box-shadow: 0 0 0 0 rgba(15,157,140,.6);
    animation: latido 2.4s infinite;
    display: inline-block;
    margin-right: 4px;
}
@keyframes latido {
    0%   { box-shadow: 0 0 0 0 rgba(15,157,140,.5); }
    70%  { box-shadow: 0 0 0 7px rgba(15,157,140,0); }
    100% { box-shadow: 0 0 0 0 rgba(15,157,140,0); }
}
.barra a.salir {
    color: #cfcce8; text-decoration: none; font-size: 14px;
    border: 1px solid #3a3660; padding: 6px 12px; border-radius: 8px;
}
.barra a.salir:hover { background: #221f47; }

/* --- Contenedor ---------------------------------------------------------- */
.envoltura { max-width: 1120px; margin: 0 auto; padding: 24px; }

/* --- Franja de estadísticas --------------------------------------------- */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}
.stat {
    background: var(--superficie);
    border: 1px solid var(--linea);
    border-radius: var(--radio);
    padding: 16px 18px;
}
.stat .num {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-weight: 800; font-size: 30px; line-height: 1;
    color: var(--tinta);
}
.stat .et { font-size: 13px; color: var(--tenue); margin-top: 6px; }
.stat.programado .num { color: var(--pendiente); }
.stat.publicado .num  { color: var(--exito); }
.stat.error .num      { color: var(--error); }

/* --- Rejilla principal --------------------------------------------------- */
.rejilla {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: start;
}
@media (max-width: 900px) {
    .rejilla { grid-template-columns: 1fr; }
    .stats { grid-template-columns: repeat(2, 1fr); }
}

.tarjeta {
    background: var(--superficie);
    border: 1px solid var(--linea);
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    padding: 22px;
    margin-bottom: 24px;
}
.tarjeta > h2 {
    font-size: 18px;
    margin-bottom: 4px;
}
.tarjeta > .sub { color: var(--tenue); font-size: 13px; margin-bottom: 18px; }

/* --- Formularios --------------------------------------------------------- */
label { display: block; font-weight: 500; font-size: 13px; margin: 14px 0 6px; }
input[type=text], input[type=url], input[type=password],
input[type=datetime-local], textarea, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--linea);
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    background: #fff;
    color: var(--texto);
}
input:focus, textarea:focus, select:focus {
    outline: 2px solid var(--accion);
    outline-offset: 1px;
    border-color: transparent;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.55; }
.fila { display: flex; gap: 12px; }
.fila > * { flex: 1; }

/* --- Botones ------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    border: none; border-radius: 10px;
    padding: 11px 16px;
    font-family: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer; text-decoration: none;
    transition: transform .04s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primario  { background: var(--accion); color: #fff; }
.btn-primario:hover { background: var(--accion-osc); }
.btn-fantasma  { background: #f1eff6; color: var(--tinta); }
.btn-fantasma:hover { background: #e7e4f0; }
.btn-ia { background: var(--tinta); color: #fff; }
.btn-ia:hover { background: #221f47; }
.btn-peligro { background: transparent; color: var(--error); border: 1px solid #f0cfc9; }
.btn-peligro:hover { background: #fbeeeb; }
.acciones { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.btn[disabled] { opacity: .55; cursor: default; }

/* --- El riel de emisión (elemento distintivo) --------------------------- */
.riel { position: relative; padding-left: 8px; }
.riel::before {
    content: '';
    position: absolute; left: 62px; top: 6px; bottom: 6px;
    width: 2px; background: var(--linea);
}
.emision {
    position: relative;
    display: grid;
    grid-template-columns: 54px 1fr;
    gap: 14px;
    padding: 12px 0;
}
.emision .hora {
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700; font-size: 13px;
    color: var(--tinta);
    padding-top: 2px;
}
.emision .hora small { display: block; color: var(--tenue); font-weight: 500; font-size: 11px; }
.emision .punto {
    position: absolute; left: 58px; top: 15px;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--pendiente);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--pendiente);
}
.emision .cuerpo {
    background: #fbfaf7;
    border: 1px solid var(--linea);
    border-radius: 12px;
    padding: 12px 14px;
    margin-left: 14px;
}
.emision .cuerpo p { margin: 0 0 8px; font-size: 13.5px; white-space: pre-wrap; }
.emision .cuerpo .mini { display: flex; gap: 8px; }
.emision .cuerpo .mini a { font-size: 12px; color: var(--tenue); text-decoration: none; }
.emision .cuerpo .mini a:hover { color: var(--error); }
.vacio { color: var(--tenue); font-size: 14px; padding: 20px 4px; }

/* --- Pestañas del historial --------------------------------------------- */
.pestanas { display: flex; gap: 6px; border-bottom: 1px solid var(--linea); margin-bottom: 14px; }
.pestanas button {
    background: none; border: none; cursor: pointer;
    padding: 9px 12px; font-family: inherit; font-size: 14px; font-weight: 600;
    color: var(--tenue); border-bottom: 2px solid transparent;
}
.pestanas button.activa { color: var(--tinta); border-bottom-color: var(--accion); }
.panel-hist { display: none; }
.panel-hist.activa { display: block; }

.item {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
    padding: 12px 0; border-bottom: 1px solid var(--linea);
}
.item:last-child { border-bottom: none; }
.item .txt { font-size: 13.5px; white-space: pre-wrap; }
.item .meta { font-size: 12px; color: var(--tenue); margin-top: 4px; }
.etiqueta {
    display: inline-block; font-size: 11px; font-weight: 700;
    padding: 2px 8px; border-radius: 100px; white-space: nowrap;
}
.et-publicado { background: #e2f5f1; color: var(--exito); }
.et-error     { background: #fbe7e3; color: var(--error); }
.et-borrador  { background: #eeecf5; color: var(--tinta); }

/* --- Productos ----------------------------------------------------------- */
.productos { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.prod {
    border: 1px solid var(--linea); border-radius: 12px; overflow: hidden; background: #fff;
}
.prod .foto { aspect-ratio: 4/3; background: #f1eff6 center/cover no-repeat; }
.prod .info { padding: 10px 12px; }
.prod .info b { font-size: 14px; display: block; }
.prod .info .precio { color: var(--accion); font-weight: 700; font-size: 13px; }

/* --- Mensajes ------------------------------------------------------------ */
.aviso {
    border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; font-size: 14px;
}
.aviso-ok  { background: #e2f5f1; color: #0a6b5f; }
.aviso-err { background: #fbe7e3; color: #97281a; }

/* --- Login --------------------------------------------------------------- */
.login-fondo {
    min-height: 100vh; display: grid; place-items: center;
    background: radial-gradient(120% 120% at 50% 0%, #201d47 0%, #17153a 60%);
    padding: 20px;
}
.login-caja {
    background: #fff; border-radius: 18px; padding: 34px;
    width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-caja h1 { font-size: 22px; margin-bottom: 4px; }
.login-caja p { color: var(--tenue); font-size: 14px; margin: 0 0 20px; }
.login-caja .btn { width: 100%; justify-content: center; margin-top: 18px; }
