/* ============================
   NovaFrame - estilos
   ============================ */
:root {
    --violeta: #4527a0;
    --noche: #1d1440;
    --lila: #ede7f6;
    --fondo: #f5f2fc;
    --ambar: #ffb938;
    --texto: #2a2150;
    --verde: #2e7d32;
    --rojo: #c62828;
    --alto-nav: 62px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.5;
    background: var(--fondo);
    color: var(--texto);
}

h1, h2, h3 { color: var(--noche); letter-spacing: -0.01em; }
h2 { font-size: 1.6rem; margin: 0 0 10px; }
h3 { margin: 0 0 8px; }
p { margin: 0 0 12px; }
:focus-visible { outline: 3px solid var(--ambar); outline-offset: 2px; }

button {
    font: inherit;
    font-weight: 600;
    padding: 10px 18px;
    border: 2px solid var(--violeta);
    border-radius: 8px;
    background: var(--violeta);
    color: #fff;
    cursor: pointer;
}
button:hover { background: var(--noche); border-color: var(--noche); }
button.secundario { background: transparent; color: var(--violeta); }
button.secundario:hover { background: var(--lila); }
button[hidden] { display: none; }

input, select {
    font: inherit;
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #cfc5ea;
    border-radius: 8px;
    background: #fff;
    color: var(--texto);
}
input:focus, select:focus { border-color: var(--violeta); outline: none; }
label { display: block; margin: 14px 0 4px; font-weight: 600; font-size: .95rem; }

/* ============================
   Splash
   ============================ */
#splash {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px;
    text-align: center;
    background: var(--violeta);
    color: #fff;
}
#splash h1 { color: #fff; font-size: 2.4rem; margin: 10px 0 0; }
#splash p { opacity: .85; max-width: 22em; }
#splash img { border-radius: 26px; animation: latido 1.4s ease-in-out infinite; }
#splash::after {
    content: "";
    width: 120px;
    height: 4px;
    margin-top: 18px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--ambar) 50%, rgba(255,255,255,.25) 50%) 0 0 / 200% 100%;
    animation: carga 2s linear forwards;
}
#splash.oculto { display: none; }
@keyframes latido { 50% { transform: scale(1.06); } }
@keyframes carga { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ============================
   Shell: header, nav, footer
   ============================ */
#shell-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    background: var(--violeta);
    color: #fff;
}
.marca { display: flex; align-items: center; gap: 10px; }
.marca img { border-radius: 8px; }
#shell-header h1 { margin: 0; font-size: 1.25rem; color: #fff; }

#estado-red {
    font-size: .8rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 99px;
    background: var(--verde);
}
#estado-red.offline { background: var(--rojo); }

/* Menú: barra inferior en celular, pestañas arriba en pantallas grandes */
#shell-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    height: var(--alto-nav);
    background: var(--noche);
    padding-bottom: env(safe-area-inset-bottom);
}
#shell-nav button {
    flex: 1;
    border: 0;
    border-radius: 0;
    background: none;
    color: #cfc5ea;
    font-size: .95rem;
}
#shell-nav button:hover { background: rgba(255,255,255,.08); }
#shell-nav button.activo { color: #fff; box-shadow: inset 0 3px 0 var(--ambar); }

#contenido { max-width: 960px; margin: 0 auto; padding: 22px 18px 30px; }

#shell-footer {
    padding: 20px 18px calc(var(--alto-nav) + 20px);
    background: var(--noche);
    color: #cfc5ea;
    text-align: center;
    font-size: .85rem;
}
#shell-footer p { margin: 2px 0; }

/* ============================
   Home
   ============================ */
.resumen {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 20px 0;
}
.tarjeta {
    padding: 16px;
    border-radius: 12px;
    background: #fff;
    border-left: 6px solid var(--violeta);
}
.tarjeta span { display: block; font-size: 2.4rem; font-weight: 800; line-height: 1; color: var(--noche); }
.tarjeta p { margin: 6px 0 0; font-size: .9rem; }
.tarjeta:nth-child(3) { border-left-color: var(--ambar); }
.tarjeta:nth-child(4) { border-left-color: var(--verde); }

.botones { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }

.panel-avisos {
    margin-top: 8px;
    padding: 20px;
    border-radius: 12px;
    background: #fff;
}
.estado-avisos {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 99px;
    background: var(--lila);
    font-weight: 600;
    font-size: .9rem;
}
.estado-avisos.bien { background: #dcefdc; color: #1b5e20; }
.estado-avisos.mal { background: #fbe0e0; color: #8e1b1b; border-radius: 10px; }
.reglas { margin: 4px 0 10px; padding-left: 20px; }
.nota { font-size: .9rem; opacity: .8; }
#msg-push, #msg-form { min-height: 1.4em; font-size: .95rem; font-weight: 500; }

/* ============================
   Proyectos
   ============================ */
#form-proyecto {
    padding: 8px 20px 20px;
    margin-bottom: 14px;
    border-radius: 12px;
    background: #fff;
}
#form-proyecto button { margin-top: 18px; width: 100%; }

/* Tabla en pantallas grandes; en celular cada fila es una tarjeta */
table { width: 100%; border-collapse: collapse; }
thead { display: none; }
tr {
    display: block;
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #fff;
    border-left: 6px solid var(--lila);
}
tr.urgente { border-left-color: var(--ambar); background: #fffaf0; }
td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; }
td::before { content: attr(data-label); font-size: .8rem; font-weight: 700; color: var(--violeta); }
td select { width: auto; padding: 6px 8px; }
td button { padding: 6px 12px; background: transparent; color: var(--rojo); border-color: var(--rojo); }
td button:hover { background: var(--rojo); color: #fff; }
td[colspan] { display: block; text-align: center; padding: 18px 0; }
td[colspan]::before { content: none; }

/* ============================
   Pantallas grandes
   ============================ */
@media (min-width: 760px) {
    #shell-nav { position: sticky; top: 56px; bottom: auto; height: auto; justify-content: center; padding: 0; }
    #shell-nav button { flex: 0 1 200px; padding: 12px; }
    #shell-nav button.activo { box-shadow: inset 0 -3px 0 var(--ambar); }
    #shell-footer { padding-bottom: 20px; }
    .resumen { grid-template-columns: repeat(4, 1fr); }
    #form-proyecto { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
    #form-proyecto button { grid-column: 1 / -1; width: auto; justify-self: start; }
    table { background: #fff; border-radius: 12px; overflow: hidden; }
    thead { display: table-header-group; background: var(--lila); }
    th { padding: 12px 10px; text-align: left; font-size: .85rem; }
    tr { display: table-row; margin: 0; padding: 0; border-left: 0; border-radius: 0; background: none; }
    tr.urgente { background: #fffaf0; box-shadow: inset 5px 0 0 var(--ambar); }
    td { display: table-cell; padding: 12px 10px; border-top: 1px solid #ece7f7; }
    td::before { content: none; }
    td[colspan] { display: table-cell; }
}

@media (prefers-reduced-motion: reduce) {
    #splash img, #splash::after { animation: none; }
}
