* {
    box-sizing: border-box;
}
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f5f7fb;
    color: #07162f;
}
.layout {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 245px;
    background: linear-gradient(180deg, #061b3a, #021025);
    color: white;
    padding: 22px;
}
.brand {
    font-weight: 800;
    font-size: 24px;
    margin-bottom: 30px;
}
.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sidebar a {
    padding: 12px 14px;
    border-radius: 10px;
    color: #d8e5ff;
    text-decoration: none;
    cursor: pointer;
}
.sidebar a.active, .sidebar a:hover {
    background: #1267f1;
    color: #fff;
}
.content {
    flex: 1;
    padding: 28px;
}
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
h1 {
    margin: 0;
    font-size: 28px;
}
p {
    margin: 6px 0 0;
    color: #62708a;
}
.filters {
    display: flex;
    gap: 10px;
}
input, button {
    height: 42px;
    padding: 0 12px;
    border: 1px solid #d7deea;
    border-radius: 10px;
    background: white;
}
button {
    background: #1267f1;
    color: white;
    border: none;
    font-weight: 700;
    cursor: pointer;
}
.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}
.card {
    background: white;
    border: 1px solid #e1e7f0;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(9, 30, 66, 0.06);
}
.card span {
    display: block;
    color: #62708a;
    font-size: 13px;
    margin-bottom: 10px;
}
.card strong {
    font-size: 24px;
}
.card.warning strong {
    color: #f59e0b;
}
.card.danger strong {
    color: #e11d48;
}
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 18px;
}
.panel {
    background: white;
    border: 1px solid #e1e7f0;
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 8px 24px rgba(9, 30, 66, 0.06);
    min-height: 330px;
}
h2 {
    margin: 0 0 14px;
    font-size: 18px;
}
.table-wrap {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
th, td {
    padding: 12px 10px;
    border-bottom: 1px solid #edf1f7;
    text-align: left;
    white-space: nowrap;
}
th {
    color: #62708a;
    font-size: 12px;
}
.badge {
    padding: 5px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    background: #fee2e2;
    color: #b91c1c;
}
@media (max-width: 1100px) {
    .sidebar {
        display: none;
    }
    .cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-2 {
        grid-template-columns: 1fr;
    }
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}
.page {
    display: none;
}
.page.active {
    display: block;
}
.sidebar nav a {
    cursor: pointer;
}
.filters input[type="text"] {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px;
    background: #fff;
}
.badge.warning {
    background: #f59e0b;
    color: #fff;
}
.badge.danger {
    background: #ef4444;
    color: #fff;
}
.badge.success {
    background: #16a34a;
    color: #fff;
}
.actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.actions button {
    border: 0;
    background: #1e293b;
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
}
pre {
    background: #0f172a;
    color: #e5e7eb;
    padding: 16px;
    border-radius: 10px;
    overflow: auto;
}
.live-row {
    margin-top: 8px;
    display: flex;
    gap: 12px;
    align-items: center;
    color: #64748b;
    font-size: 13px;
}
.live-dot {
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 999px;
    display: inline-block;
    box-shadow: 0 0 0 rgba(34, 197, 94, .8);
    animation: pulseLive 1.5s infinite;
}
@keyframes pulseLive {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, .8);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}
.tv-page {
    min-height: 100vh;
}
.tv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    background: #0f172a;
    color: white;
    padding: 24px;
    border-radius: 18px;
}
.tv-header h2 {
    font-size: 32px;
    margin: 0;
}
.tv-header p {
    margin: 6px 0 0;
    color: #cbd5e1;
}
.tv-clock {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 18px;
}
.tv-cards {
    grid-template-columns: repeat(6, 1fr);
}
.tv-cards .card strong {
    font-size: 28px;
}
.tv-panel h2 {
    font-size: 22px;
}
.tv-table {
    max-height: 360px;
    overflow: auto;
}
@media (min-width:1600px) {
    .content {
        padding: 32px;
    }
    .tv-header h2 {
        font-size: 40px;
    }
    .tv-cards .card {
        padding: 26px;
    }
    .tv-cards .card strong {
        font-size: 34px;
    }
    table th, table td {
        font-size: 15px;
        padding: 12px;
    }
}
/* ===== MODO TV SEM SCROLL GERAL ===== */
html, body {
    height: 100%;
    overflow: hidden;
}
.layout {
    height: 100vh;
    overflow: hidden;
}
.sidebar {
    height: 100vh;
    overflow: hidden;
}
.content {
    height: 100vh;
    overflow: hidden;
    padding: 14px 18px;
    box-sizing: border-box;
}
.topbar {
    margin-bottom: 10px;
    padding-bottom: 8px;
}
.topbar h1 {
    font-size: 22px;
    margin: 0;
}
.topbar p {
    margin: 3px 0;
    font-size: 13px;
}
.live-row {
    margin-top: 4px;
    font-size: 12px;
}
.filters {
    gap: 6px;
}
.filters input, .filters button {
    padding: 7px 9px;
    font-size: 12px;
}
.tv-page {
    height: calc(100vh - 20px);
    overflow: hidden;
}
.tv-header {
    padding: 12px 16px;
    margin-bottom: 10px;
    border-radius: 14px;
}
.tv-header h2 {
    font-size: 22px;
}
.tv-header p {
    font-size: 12px;
    margin-top: 2px;
}
.tv-clock {
    font-size: 14px;
}
.cards {
    gap: 10px;
    margin-bottom: 10px;
}
.tv-cards {
    grid-template-columns: repeat(6, 1fr);
}
.card {
    padding: 12px 14px;
    border-radius: 12px;
}
.card span {
    font-size: 12px;
}
.card strong {
    font-size: 22px;
    margin-top: 4px;
}
.tv-cards .card strong {
    font-size: 22px;
}
.grid-2 {
    gap: 10px;
    margin-bottom: 10px;
}
.panel {
    padding: 12px;
    border-radius: 14px;
}
.panel h2 {
    font-size: 15px;
    margin: 0 0 8px;
}
.tv-panel h2 {
    font-size: 15px;
}
#tvChartDia, #tvChartStatus {
    height: 220px;
}
.tv-table {
    max-height: 205px;
    overflow: hidden;
}
table th, table td {
    font-size: 11px;
    padding: 7px 8px;
    line-height: 1.15;
    white-space: nowrap;
}
table th {
    position: sticky;
    top: 0;
    z-index: 2;
}
.badge {
    padding: 4px 7px;
    font-size: 10px;
}
.page.active:not(.tv-page) {
    height: calc(100vh - 95px);
    overflow: hidden;
}
.page.active:not(.tv-page) .table-wrap {
    max-height: calc(100vh - 230px);
    overflow: auto;
}
@media (min-width:1600px) and (min-height:850px) {
    .content {
        padding: 18px 22px;
    }
    .tv-header {
        padding: 16px 20px;
    }
    .tv-header h2 {
        font-size: 28px;
    }
    .card {
        padding: 16px;
    }
    .tv-cards .card strong {
        font-size: 28px;
    }
    #tvChartDia, #tvChartStatus {
        height: 260px;
    }
    .tv-table {
        max-height: 245px;
    }
    table th, table td {
        font-size: 13px;
        padding: 8px 9px;
    }
}
@media (max-height:760px) {
    .sidebar nav a {
        padding: 8px 12px;
        font-size: 13px;
    }
    .brand {
        font-size: 18px;
        margin-bottom: 12px;
    }
    .topbar {
        display: none;
    }
    .tv-page {
        height: 100vh;
    }
    .tv-header {
        padding: 10px 14px;
    }
    .tv-header h2 {
        font-size: 18px;
    }
    .tv-cards .card strong {
        font-size: 18px;
    }
    #tvChartDia, #tvChartStatus {
        height: 190px;
    }
    .tv-table {
        max-height: 170px;
    }
    table th, table td {
        font-size: 10px;
        padding: 5px 6px;
    }
}
body.tv-compact .sidebar {
    display: none;
}
body.tv-compact .content {
    margin-left: 0;
    width: 100vw;
}
body.tv-compact .topbar {
    display: none;
}
body.tv-compact .tv-page {
    height: 100vh;
}
/* ===== AJUSTE: SCROLL VERTICAL HABILITADO ===== */
html, body {
    height: 100%;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}
.layout {
    min-height: 100vh !important;
    height: auto !important;
    overflow-y: visible !important;
    overflow-x: hidden !important;
}
.sidebar {
    height: 100vh;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}
.content {
    min-height: 100vh !important;
    height: auto !important;
    overflow-y: visible !important;
    overflow-x: hidden !important;
}
.page, .page.active, .page.active:not(.tv-page), .tv-page, body.tv-compact .tv-page {
    height: auto !important;
    min-height: calc(100vh - 20px) !important;
    overflow-y: visible !important;
    overflow-x: hidden !important;
}
.table-wrap, .tv-table, .page.active:not(.tv-page) .table-wrap {
    overflow-y: auto !important;
    overflow-x: auto !important;
}
.tv-table {
    max-height: none !important;
}
body.tv-compact .content {
    min-height: 100vh !important;
    height: auto !important;
    overflow-y: visible !important;
}
body.tv-compact {
    overflow-y: auto !important;
    overflow-x: hidden !important;
}
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 10px;
}
::-webkit-scrollbar-track {
    background: #e5e7eb;
}

/* ===== AJUSTE SOLICITADO: NOTAS FISCAIS E PENDÊNCIAS SEM SCROLL INTERNO ===== */
/* A página pode crescer verticalmente; as tabelas dessas duas telas mostram todos os registros. */

#page-notas,
#page-pendencias{
    height:auto !important;
    min-height:auto !important;
    overflow:visible !important;
}

#page-notas .panel,
#page-pendencias .panel{
    height:auto !important;
    max-height:none !important;
    overflow:visible !important;
}

#page-notas .table-wrap,
#page-pendencias .table-wrap{
    height:auto !important;
    max-height:none !important;
    overflow-y:visible !important;
    overflow-x:auto !important;
}

#page-notas table,
#page-pendencias table{
    height:auto !important;
    max-height:none !important;
}

/* Remove limitação genérica aplicada nas páginas normais */
.page.active#page-notas .table-wrap,
.page.active#page-pendencias .table-wrap,
.page.active:not(.tv-page)#page-notas .table-wrap,
.page.active:not(.tv-page)#page-pendencias .table-wrap{
    height:auto !important;
    max-height:none !important;
    overflow-y:visible !important;
    overflow-x:auto !important;
}

/* Mantém cabeçalho da tabela visível quando a página rolar */
#page-notas table thead th,
#page-pendencias table thead th{
    position:sticky;
    top:0;
    z-index:5;
}



/* ===== NAVBAR SUPERIOR ===== */

.app-navbar{
    position:sticky;
    top:0;
    z-index:50;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    background:#ffffff;
    border:1px solid #e5e7eb;
    border-radius:16px;
    padding:12px 16px;
    margin-bottom:14px;
    box-shadow:0 8px 24px rgba(15,23,42,.06);
}

.navbar-left,
.navbar-center,
.navbar-right{
    display:flex;
    align-items:center;
    gap:12px;
}

.navbar-title{
    font-size:18px;
    font-weight:800;
    color:#0f172a;
    line-height:1.1;
}

.navbar-subtitle{
    font-size:12px;
    color:#64748b;
    margin-top:2px;
}

.navbar-toggle{
    width:40px;
    height:40px;
    border:0;
    border-radius:12px;
    background:#0f172a;
    color:white;
    font-size:20px;
    cursor:pointer;
}

.navbar-live-dot{
    width:10px;
    height:10px;
    background:#22c55e;
    border-radius:999px;
    display:inline-block;
    animation:pulseNavbar 1.5s infinite;
}

.navbar-live-text{
    font-weight:800;
    color:#16a34a;
    font-size:12px;
}

#navbarLastUpdate{
    font-size:12px;
    color:#64748b;
}

.navbar-clock{
    font-weight:700;
    color:#0f172a;
    font-size:14px;
    white-space:nowrap;
}

.navbar-btn{
    border:0;
    border-radius:10px;
    background:#e2e8f0;
    color:#0f172a;
    font-weight:700;
    padding:9px 12px;
    cursor:pointer;
}

.navbar-btn:hover{
    background:#cbd5e1;
}

.navbar-btn.primary{
    background:#2563eb;
    color:white;
}

.navbar-btn.primary:hover{
    background:#1d4ed8;
}

@keyframes pulseNavbar{
    0%{ box-shadow:0 0 0 0 rgba(34,197,94,.75); }
    70%{ box-shadow:0 0 0 9px rgba(34,197,94,0); }
    100%{ box-shadow:0 0 0 0 rgba(34,197,94,0); }
}

body.sidebar-collapsed .sidebar{
    display:none;
}

body.sidebar-collapsed .content{
    margin-left:0 !important;
    width:100% !important;
}

body.tv-compact .app-navbar{
    display:none;
}

@media(max-width:1100px){
    .app-navbar{
        flex-wrap:wrap;
    }

    .navbar-center{
        order:3;
        width:100%;
        justify-content:flex-start;
    }
}

@media(max-width:700px){
    .navbar-right{
        width:100%;
        justify-content:space-between;
    }

    .navbar-subtitle{
        display:none;
    }

    .navbar-btn{
        padding:8px 10px;
        font-size:12px;
    }
}
