:root {
    --bg-dark: #0f151e;
    --panel-bg: #161e2b;
    --border-color: #2a3441;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    
    --blue: #2563eb;
    --green: #10b981;
    --orange: #f59e0b;
    --purple: #8b5cf6;
    --red: #ef4444;
    --yellow: #eab308;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    padding: 1.2vh 1vw; /* Medidas relativas impedem corte da tela */
}

#dashboard-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 1.2vh;
}

/* --- HEADER --- */
.header {
    flex-shrink: 0;
    height: 10vh;
    min-height: 75px;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5vw;
}

.logo-section { display: flex; align-items: center; gap: 15px; }
.logo-placeholder { font-size: 2.2rem; font-weight: 800; color: var(--yellow); }
.titles h1 { font-size: 1.4rem; letter-spacing: 2px; }
.titles h2 { font-size: 0.75rem; color: var(--text-muted); }

.alerts-section { display: flex; gap: 1vw; }
.alert-badge {
    display: flex; align-items: center; padding: 0.8vh 1vw; border-radius: 6px; gap: 10px;
    border: 1px solid var(--border-color);
    background: rgba(0,0,0,0.2);
}
.alert-badge .icon-bg { font-size: 1.8rem; }
.alert-badge.red .icon-bg { color: var(--red); }
.alert-badge.orange .icon-bg { color: var(--orange); }
.alert-badge.blue .icon-bg { color: var(--blue); }
.alert-badge.green .icon-bg { color: var(--green); }
.alert-data .num { font-size: 1.3rem; font-weight: 700; display: block; line-height: 1; }
.alert-data .lbl { font-size: 0.6rem; text-transform: uppercase; color: var(--text-muted); }

.datetime-section { text-align: right; }
#current-time { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
#current-date { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; }
.status-footer { font-size: 0.7rem; color: var(--text-muted); margin-top: 5px; }
.dot { display: inline-block; width: 8px; height: 8px; background: var(--green); border-radius: 50%; margin: 0 5px; }

/* --- CORPO E GRID --- */
.content-wrapper {
    display: flex;
    flex: 1;
    gap: 1vw;
    min-height: 0; /* O segredo para não estourar 100vh */
}

.main-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.2vh;
    min-height: 0;
    position: relative; /* Base para o slide-overlay se prender aqui */
}

.top-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1vw;
    height: 14vh;
    min-height: 90px;
    flex-shrink: 0;
}

.big-card {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 0 1vw;
    gap: 1vw;
    position: relative;
    overflow: hidden;
}
.big-card::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px; }
.big-card.blue::before { background: var(--blue); }
.big-card.green::before { background: var(--green); }
.big-card.orange::before { background: var(--orange); }
.big-card.purple::before { background: var(--purple); }

.huge-icon { font-size: 3rem; opacity: 0.8; }
.big-card.blue .huge-icon { color: var(--blue); }
.big-card.green .huge-icon { color: var(--green); }
.big-card.orange .huge-icon { color: var(--orange); }
.big-card.purple .huge-icon { color: var(--purple); }

.big-data h3 { font-size: 2.5rem; font-weight: 800; line-height: 1; }
.big-data p { font-size: 0.7rem; text-transform: uppercase; color: var(--text-main); margin-top: 5px; }
.big-data small { font-size: 0.6rem; color: var(--text-muted); }

/* COLUNAS INFERIORES */
.content-columns {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    gap: 1vw;
    flex-grow: 1;
    min-height: 0;
}

.col { display: flex; flex-direction: column; gap: 1.2vh; min-height: 0; }
.panel-row { display: flex; gap: 1vw; flex-grow: 0.5; min-height: 0;}
.w-50 { width: 50%; }

.panel {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.2vh 1vw;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
}
.panel.mini { flex-grow: 0.5; }

.panel-header { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.8vh; flex-shrink: 0;}
.chart-box { flex-grow: 1; position: relative; min-height: 0; width: 100%; }
.text-box { display: flex; align-items: center; justify-content: center; height: 100%; }
.text-box h2 { font-size: 2.5rem; font-weight: 700; }
.text-box small { font-size: 1rem; color: var(--text-muted); }

/* --- SIDEBAR LATERAL DIREITA --- */
.sidebar {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 1.2vh;
    min-height: 0;
}

.side-panel {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5vh 1vw;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.data-list { list-style: none; display: flex; flex-direction: column; justify-content: space-evenly; flex-grow: 1; }
.data-list li { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 0.5vh;}
.data-list li span { font-weight: 700; font-size: 1rem; }
.text-blue { color: var(--blue); }
.text-green { color: var(--green); }
.text-orange { color: var(--orange); }
.text-purple { color: var(--purple); }
.text-yellow { color: var(--yellow); }

.donut-small { flex-grow: 1; position: relative; min-height: 0; }


/* --- OVERLAY DE SLIDES (APENAS NA MAIN-GRID) --- */
#slide-overlay {
    position: absolute; /* Prende ao .main-grid */
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--bg-dark);
    border-radius: 8px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    border: 2px solid var(--border-color);
    overflow: hidden;
}
#slide-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
#slide-title { font-size: 3rem; color: var(--text-muted); margin-bottom: 2rem; letter-spacing: 2px; }
#slide-content { font-size: 10rem; font-weight: 800; color: var(--blue); line-height: 1; }
#slide-content span { font-size: 2.5rem; color: var(--text-main); display: block; margin-top: 1rem; }

.slide-progress { position: absolute; bottom: 0; left: 0; width: 100%; height: 6px; background: rgba(255,255,255,0.1); }
#slide-bar { height: 100%; background: var(--blue); width: 0%; transition: width linear; }

/* Tabela de Operações Dinâmica */
.styled-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; height: 100%; display: flex; flex-direction: column; }
.styled-table thead { flex-shrink: 0; }
.styled-table tbody { flex-grow: 1; display: flex; flex-direction: column; justify-content: space-evenly; }
.styled-table tr { display: flex; width: 100%; }
.styled-table th, .styled-table td { flex: 1; text-align: right; }
.styled-table th:first-child, .styled-table td:first-child { text-align: left; flex: 1.5; font-weight: 600; }
.styled-table th { color: var(--text-muted); border-bottom: 1px solid var(--border-color); padding-bottom: 5px; }