:root {
    --bg: #0b1220;
    --bg-card: #121a2b;
    --border: #1e293b;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --accent: #3b82f6;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
}

* { box-sizing: border-box; }
html, body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, sans-serif;
    overflow: hidden;
}

.monitor-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: #0f172a;
    border-bottom: 1px solid var(--border);
}
.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 1.1rem;
}
.brand i { color: var(--accent); }
.meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--muted);
    flex-wrap: wrap;
    justify-content: flex-end;
}
.meta-filtro {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted);
}
.meta-filtro select {
    background: #111827;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.25rem 0.45rem;
    font-size: 0.85rem;
}
.meta-cargos {
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #93c5fd;
    font-weight: 600;
}
.meta-cargos.sem-filtro { color: var(--warning); }
.aviso-cargos {
    background: rgba(245,158,11,0.15);
    border-bottom: 1px solid rgba(245,158,11,0.35);
    color: #fcd34d;
    padding: 0.55rem 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.aviso-cargos[hidden] {
    display: none !important;
}
.aviso-cargos code {
    background: rgba(0,0,0,0.25);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}
.link-cockpit {
    color: var(--muted);
    text-decoration: none;
    font-size: 1.1rem;
}
.link-cockpit:hover { color: var(--accent); }

.slide-dots {
    display: flex;
    gap: 0.45rem;
}
.slide-dots button {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    background: #334155;
    cursor: pointer;
    padding: 0;
}
.slide-dots button.active { background: var(--accent); transform: scale(1.2); }

.slide-progress {
    height: 3px;
    background: #1e293b;
}
#slideProgressBar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), #60a5fa);
    transition: width 0.2s linear;
}

.slides {
    height: calc(100vh - 110px);
    padding: 1.25rem 1.75rem 0.5rem;
}
.slide { height: 100%; display: flex; flex-direction: column; }
.slide[hidden] { display: none !important; }
.slide-title {
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    margin: 0 0 0.35rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.slide-title i { color: var(--accent); }
.slide-hint {
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: clamp(0.9rem, 1.3vw, 1.1rem);
}
.meta-plano {
    color: #a5b4fc;
    font-weight: 600;
    font-size: 0.8rem;
}

/* Pulse */
.pulse-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    flex: 1;
}
.pulse-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.pulse-card .val {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 900;
    line-height: 1;
}
.pulse-card .lbl {
    margin-top: 0.75rem;
    font-size: clamp(0.9rem, 1.5vw, 1.25rem);
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: center;
}
.pulse-card.warn .val { color: var(--warning); }
.pulse-card.danger .val { color: var(--danger); }
.pulse-card.ok .val { color: var(--success); }
.pulse-card.info .val { color: var(--accent); }

/* Listas */
.lista-tv {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.lista-row {
    display: grid;
    grid-template-columns: 56px 1fr auto auto;
    gap: 1rem;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem 1.15rem;
    font-size: clamp(1rem, 1.8vw, 1.35rem);
}
.lista-row.cliente {
    grid-template-columns: 56px 1fr auto auto;
}
.lista-rank {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(59,130,246,0.2);
    color: #93c5fd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}
.lista-main { min-width: 0; }
.lista-main strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lista-main .sub { color: var(--muted); font-size: 0.85em; }
.lista-meta {
    font-weight: 700;
    white-space: nowrap;
}
.badge-prio {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
}
.prio-critica { background: rgba(239,68,68,0.25); color: #fca5a5; }
.prio-alta { background: rgba(245,158,11,0.25); color: #fcd34d; }
.prio-media { background: rgba(59,130,246,0.25); color: #93c5fd; }
.prio-baixa, .prio-normal { background: rgba(148,163,184,0.2); color: #94a3b8; }

.ticket-link {
    color: #60a5fa;
    text-decoration: none;
    font-weight: 700;
}
.ticket-link:hover { text-decoration: underline; }

/* Anomalias */
.anomalias-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    flex: 1;
    overflow: hidden;
}
.anomalia-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 5px solid var(--accent);
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
}
.anomalia-card.severidade-critica { border-left-color: var(--danger); }
.anomalia-card.severidade-alta { border-left-color: var(--warning); }
.anomalia-card .titulo {
    font-size: clamp(1.05rem, 1.8vw, 1.4rem);
    font-weight: 800;
    margin-bottom: 0.4rem;
}
.anomalia-card .resumo {
    color: var(--muted);
    font-size: clamp(0.95rem, 1.4vw, 1.15rem);
    line-height: 1.4;
}
.vazio {
    color: var(--success);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
}

/* IA */
.ia-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.ia-resumo {
    background: linear-gradient(135deg, rgba(16,185,129,0.12), rgba(59,130,246,0.08));
    border: 1px solid rgba(16,185,129,0.3);
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
    font-size: clamp(1.3rem, 2.5vw, 2rem);
    font-weight: 700;
    line-height: 1.35;
}
.ia-acoes {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.ia-acoes li {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.ia-acoes .num {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.monitor-footer {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 1.5rem;
    font-size: 0.8rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
}

/* Blink alerta */
.alerta-faixa {
    background: var(--danger);
    color: #fff;
    text-align: center;
    padding: 0.55rem 1rem;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.03em;
}
.alerta-faixa.blink {
    animation: blinkAlerta 1.2s ease-in-out infinite;
}
@keyframes blinkAlerta {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

body.has-alerta .pulse-card.danger {
    animation: blinkCard 1.4s ease-in-out infinite;
}
@keyframes blinkCard {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
    50% { box-shadow: 0 0 24px 2px rgba(239,68,68,0.45); }
}

/* ── Slide Reflexão / Tipografia cinética ── */
.slide-frase {
    padding: 0 !important;
    margin: -1.25rem -1.75rem -0.5rem;
    height: calc(100% + 1.75rem);
    position: relative;
    overflow: hidden;
}
.frase-stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #05070c;
    --frase-accent: #f87171;
}
.frase-stage.shake {
    animation: fraseShake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes fraseShake {
    0%, 100% { transform: translate(0, 0); }
    15% { transform: translate(-3px, 2px); }
    30% { transform: translate(4px, -2px); }
    45% { transform: translate(-2px, -3px); }
    60% { transform: translate(3px, 1px); }
    75% { transform: translate(-1px, 2px); }
}

.frase-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.frase-smoke {
    position: absolute;
    inset: -20%;
    background:
        radial-gradient(ellipse 60% 40% at 20% 80%, rgba(80, 60, 40, 0.35), transparent 55%),
        radial-gradient(ellipse 50% 45% at 75% 30%, rgba(40, 50, 80, 0.28), transparent 50%),
        radial-gradient(ellipse 70% 50% at 50% 100%, rgba(30, 20, 15, 0.5), transparent 60%);
    animation: smokeDrift 48s ease-in-out infinite alternate;
    filter: blur(2px);
}
@keyframes smokeDrift {
    0% { transform: translate(-2%, 1%) scale(1); opacity: 0.85; }
    100% { transform: translate(3%, -2%) scale(1.08); opacity: 1; }
}
.frase-embers {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(1.5px 1.5px at 12% 70%, rgba(251, 191, 36, 0.7), transparent),
        radial-gradient(1px 1px at 28% 55%, rgba(248, 113, 113, 0.55), transparent),
        radial-gradient(2px 2px at 45% 82%, rgba(251, 146, 60, 0.5), transparent),
        radial-gradient(1px 1px at 62% 48%, rgba(252, 211, 77, 0.45), transparent),
        radial-gradient(1.5px 1.5px at 78% 75%, rgba(248, 113, 113, 0.4), transparent),
        radial-gradient(1px 1px at 88% 60%, rgba(251, 191, 36, 0.5), transparent);
    animation: embersRise 22s linear infinite;
    opacity: 0.55;
}
@keyframes embersRise {
    0% { transform: translateY(8%); opacity: 0.35; }
    50% { opacity: 0.65; }
    100% { transform: translateY(-18%); opacity: 0.25; }
}
.frase-dust {
    position: absolute;
    inset: 0;
}
.dust-particle {
    position: absolute;
    width: var(--size, 2px);
    height: var(--size, 2px);
    border-radius: 50%;
    background: rgba(241, 245, 249, 0.35);
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.15);
    animation: dustFloat var(--dur, 24s) ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}
@keyframes dustFloat {
    0%, 100% { transform: translate(0, 0); opacity: 0.15; }
    50% { transform: translate(var(--drift, 20px), -30px); opacity: 0.55; }
}
.frase-vignette {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 60% at 50% 50%, transparent 30%, rgba(0, 0, 0, 0.72) 100%),
        linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, transparent 18%, transparent 82%, rgba(0, 0, 0, 0.45) 100%);
}

.frase-content {
    position: relative;
    z-index: 2;
    max-width: min(920px, 88vw);
    padding: 2rem 1.5rem;
    text-align: center;
}
.frase-cat {
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: clamp(0.75rem, 1.2vw, 0.95rem);
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--frase-accent);
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.55s ease, transform 0.55s ease;
}
.frase-cat.in {
    opacity: 1;
    transform: translateY(0);
}
.frase-cat i { margin-right: 0.4rem; }

.frase-quote {
    margin: 0;
    font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
    font-size: clamp(1.55rem, 3.6vw, 2.85rem);
    font-weight: 600;
    line-height: 1.35;
    color: #f8fafc;
    text-wrap: balance;
}
.frase-quote .kw {
    display: inline-block;
    opacity: 0;
    transform: translateY(0.55em) scale(0.92);
    filter: blur(4px);
    transition:
        opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
        filter 0.45s ease,
        color 0.3s ease,
        text-shadow 0.3s ease;
}
.frase-quote .kw.in {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
}
.frase-quote .kw.punch {
    font-family: "Bebas Neue", Impact, sans-serif;
    font-size: 1.35em;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--frase-accent);
    transform: translateY(-1.2em) scale(1.35);
    filter: blur(8px);
    transition:
        opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
        filter 0.5s ease,
        text-shadow 0.4s ease;
}
.frase-quote .kw.punch.in {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
    text-shadow:
        0 0 40px color-mix(in srgb, var(--frase-accent) 45%, transparent),
        0 4px 0 rgba(0, 0, 0, 0.35);
}

.frase-autor {
    margin-top: 1.75rem;
    font-family: "Segoe UI", system-ui, sans-serif;
    font-size: clamp(0.95rem, 1.5vw, 1.2rem);
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: 0.04em;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.frase-autor.in {
    opacity: 1;
    transform: translateY(0);
}

.frase-nota {
    margin: 1rem auto 0;
    max-width: 36em;
    font-family: "Source Serif 4", Georgia, serif;
    font-size: clamp(0.9rem, 1.3vw, 1.1rem);
    font-style: italic;
    color: #64748b;
    line-height: 1.45;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.65s ease, transform 0.65s ease;
}
.frase-nota.in {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 900px) {
    .pulse-grid { grid-template-columns: repeat(2, 1fr); }
    .anomalias-grid { grid-template-columns: 1fr; }
    .lista-row { grid-template-columns: 48px 1fr auto; }
    .lista-row .badge-prio { display: none; }
    .slide-frase { margin: -1.25rem -1rem -0.5rem; }
}
