.sistema-pncd-painel {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: 100dvh;
    max-height: 100dvh;
    background: var(--bg, #061a3f);
    color: var(--text, #eef4ff);
}

@supports (-webkit-touch-callout: none) {
    .sistema-pncd-painel {
        height: -webkit-fill-available;
        max-height: -webkit-fill-available;
    }
}

.sistema-pncd-painel .botao.compact {
    min-width: 0;
    max-width: 100%;
}

.sistema-pncd-painel.oculta {
    display: none;
}

.sistema-pncd-topo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.18);
    flex-shrink: 0;
}

.sistema-pncd-topo h2 {
    margin: 0;
    font-size: 1.05rem;
}

.sistema-pncd-topo p {
    margin: 4px 0 0;
    font-size: 0.82rem;
    color: var(--muted, #9fb3d9);
}

.sistema-pncd-acoes-topo {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1 1 auto;
    justify-content: flex-end;
}

.sistema-pncd-acoes-topo .botao {
    flex: 1 1 auto;
    min-height: 40px;
}

.sistema-pncd-corpo {
    overflow: auto;
    min-height: 0;
    padding: 14px 16px 24px;
    -webkit-overflow-scrolling: touch;
}

.sistema-pncd-ficha {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: #f8fafc;
    color: #0f172a;
}

.sistema-pncd-titulo {
    text-align: center;
    margin-bottom: 12px;
}

.sistema-pncd-titulo h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.sistema-pncd-titulo p {
    margin: 4px 0 0;
    font-size: 0.82rem;
    font-weight: 600;
}

.sistema-pncd-secao {
    margin-bottom: 14px;
}

.sistema-pncd-secao > h4 {
    margin: 0 0 8px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #334155;
}

.sistema-pncd-legenda-atividade {
    margin: 0 0 8px;
    font-size: 0.68rem;
    line-height: 1.35;
    color: #475569;
}

.sistema-pncd-scroll-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #94a3b8;
    border-radius: 4px;
    background: #fff;
}

.sistema-pncd-tabela {
    width: 100%;
    min-width: 2200px;
    border-collapse: collapse;
    font-size: 0.68rem;
}

.sistema-pncd-tabela th,
.sistema-pncd-tabela td {
    border: 1px solid #64748b;
    padding: 2px 3px;
    vertical-align: middle;
    text-align: center;
}

.sistema-pncd-tabela th {
    background: #e2e8f0;
    font-weight: 600;
    font-size: 0.62rem;
    line-height: 1.2;
    position: sticky;
    top: 0;
    z-index: 1;
}

.sistema-pncd-tabela thead tr:first-child th {
    top: 0;
}

.sistema-pncd-tabela thead tr:nth-child(2) th {
    top: 22px;
}

.sistema-pncd-tabela input,
.sistema-pncd-tabela select {
    width: 100%;
    min-width: 0;
    min-height: 26px;
    padding: 2px 4px;
    border: 1px solid #cbd5e1;
    border-radius: 2px;
    font: inherit;
    font-size: 0.68rem;
    color: #0f172a;
    background: #fff;
}

.sistema-pncd-tabela input[type="time"] {
    min-height: 28px;
}

.sistema-pncd-tabela .col-logradouro input {
    min-width: 120px;
    text-align: left;
}

.sistema-pncd-tabela .col-texto input {
    text-align: left;
}

.sistema-pncd-cab-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0;
    border: 1px solid #64748b;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}

.sistema-pncd-cab-grid label {
    display: grid;
    gap: 2px;
    padding: 6px 8px;
    border-right: 1px solid #94a3b8;
    border-bottom: 1px solid #94a3b8;
    font-size: 0.68rem;
    font-weight: 600;
}

.sistema-pncd-cab-grid label:nth-child(6n) {
    border-right: none;
}

.sistema-pncd-cab-grid label span {
    font-size: 0.62rem;
    color: #475569;
    line-height: 1.2;
}

.sistema-pncd-cab-grid input,
.sistema-pncd-cab-grid select {
    min-height: 28px;
    padding: 4px 6px;
    border: 1px solid #cbd5e1;
    border-radius: 2px;
    font: inherit;
    font-size: 0.72rem;
    color: #0f172a;
    background: #fff;
}

.sistema-pncd-cab-grid .full {
    grid-column: 1 / -1;
}

.sistema-pncd-cab-grid label.wide {
    grid-column: span 2;
}

/* Abas (mobile / tablet) */
.sistema-pncd-abas {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    margin-bottom: 12px;
    scrollbar-width: none;
}

.sistema-pncd-abas::-webkit-scrollbar {
    display: none;
}

.sistema-pncd-aba {
    flex: 0 0 auto;
    padding: 8px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #e2e8f0;
    color: #475569;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.sistema-pncd-aba.ativa {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.sistema-pncd-dica-tabela {
    margin: 0 0 8px;
    font-size: 0.72rem;
    color: #64748b;
}

.sistema-pncd-subtitulo {
    margin: 16px 0 8px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #334155;
}

/* Cards de visita (mobile) */
.sistema-pncd-visitas-cards {
    display: none;
    flex-direction: column;
    gap: 10px;
}

.sistema-pncd-linha-card {
    border: 1px solid #94a3b8;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.sistema-pncd-linha-card-topo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #e2e8f0;
    font-size: 0.78rem;
}

.sistema-pncd-linha-card-topo strong {
    flex-shrink: 0;
}

.sistema-pncd-linha-card-topo span {
    flex: 1;
    color: #475569;
    font-size: 0.72rem;
}

.sistema-pncd-linha-card-topo .botao {
    flex-shrink: 0;
    min-width: 32px;
    padding: 4px 8px;
}

.sistema-pncd-linha-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
}

.sistema-pncd-linha-grid label.wide {
    grid-column: 1 / -1;
}

.sistema-pncd-linha-grid label {
    display: grid;
    gap: 3px;
    font-size: 0.68rem;
    font-weight: 600;
    color: #475569;
}

.sistema-pncd-linha-grid input,
.sistema-pncd-linha-grid select {
    min-height: 36px;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font: inherit;
    font-size: 0.82rem;
    color: #0f172a;
    background: #fff;
}

.sistema-pncd-linha-detalhe {
    border-top: 1px solid #e2e8f0;
    padding: 0 10px 10px;
}

.sistema-pncd-linha-detalhe summary {
    padding: 8px 0;
    font-size: 0.72rem;
    font-weight: 600;
    color: #2563eb;
    cursor: pointer;
}

.sistema-pncd-depositos-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-top: 8px;
}

.sistema-pncd-mini-campo {
    display: grid;
    gap: 2px;
    font-size: 0.62rem;
    font-weight: 600;
    color: #64748b;
    text-align: center;
}

.sistema-pncd-mini-campo input {
    min-height: 32px;
    padding: 4px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font: inherit;
    font-size: 0.78rem;
    text-align: center;
}

/* Resumo em cards (mobile) */
.sistema-pncd-resumo-cards {
    display: none;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.sistema-pncd-resumo-card {
    padding: 10px 12px;
    border: 1px solid #94a3b8;
    border-radius: 8px;
    background: #fff;
    font-size: 0.78rem;
}

.sistema-pncd-resumo-card strong {
    display: block;
    margin-bottom: 4px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #334155;
}

.sistema-pncd-resumo-card p {
    margin: 0 0 4px;
    color: #475569;
    line-height: 1.4;
}

.sistema-pncd-resumo-card p:last-child {
    margin-bottom: 0;
}

.sistema-pncd-resumo-tabelas {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.sistema-pncd-resumo-tabela {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.68rem;
    background: #fff;
    border: 1px solid #64748b;
}

.sistema-pncd-resumo-tabela th,
.sistema-pncd-resumo-tabela td {
    border: 1px solid #94a3b8;
    padding: 4px 6px;
    text-align: center;
}

.sistema-pncd-resumo-tabela th {
    background: #e2e8f0;
    font-weight: 600;
    font-size: 0.62rem;
}

.sistema-pncd-resumo-tabela input {
    width: 100%;
    min-height: 26px;
    padding: 2px 4px;
    border: 1px solid #cbd5e1;
    border-radius: 2px;
    font: inherit;
    font-size: 0.68rem;
    text-align: center;
    color: #0f172a;
    background: #fff;
}

.sistema-pncd-resumo-tabela input[readonly] {
    background: #f1f5f9;
}

.sistema-pncd-resumo-tabela .texto input {
    text-align: left;
}

.sistema-pncd-legenda {
    margin-top: 8px;
    font-size: 0.62rem;
    line-height: 1.35;
    color: #475569;
}

.sistema-pncd-legenda p {
    margin: 0 0 4px;
}

.sistema-pncd-visitas-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.sistema-pncd-assinaturas-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.sistema-pncd-assinatura-bloco {
    padding: 10px;
    border: 1px solid #64748b;
    border-radius: 4px;
    background: #fff;
    min-height: 72px;
}

.sistema-pncd-assinatura-bloco strong {
    display: block;
    font-size: 0.72rem;
    margin-bottom: 6px;
}

.sistema-pncd-assinatura-bloco p {
    margin: 2px 0;
    font-size: 0.72rem;
}

.sistema-pncd-assinatura-hint {
    font-size: 0.62rem !important;
    color: #64748b;
}

.sistema-pncd-assinatura-bloco input {
    width: 100%;
    margin-top: 8px;
    min-height: 28px;
    padding: 4px 6px;
    border: 1px solid #cbd5e1;
    border-radius: 2px;
    font: inherit;
    font-size: 0.72rem;
}

.sistema-pncd-rodape {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.92);
    flex-shrink: 0;
    z-index: 2;
}

.sistema-pncd-rodape .botao {
    flex: 1 1 calc(50% - 4px);
    min-height: 48px;
    justify-content: center;
    touch-action: manipulation;
}

.sistema-pncd-status {
    flex: 1 1 100%;
    min-width: 0;
    font-size: 0.82rem;
    color: var(--muted, #9fb3d9);
    line-height: 1.35;
}

@media (max-width: 900px) {
    .sistema-pncd-secao-oculta {
        display: none;
    }

    .sistema-pncd-scroll-x,
    .sistema-pncd-legenda {
        display: none;
    }

    .sistema-pncd-visitas-cards {
        display: flex;
    }

    .sistema-pncd-resumo-cards {
        display: flex;
    }

    .sistema-pncd-resumo-tabelas:not(.sistema-pncd-resumo-lab) {
        display: none;
    }

    .sistema-pncd-resumo-lab .sistema-pncd-resumo-tabela {
        min-width: 640px;
    }

    .sistema-pncd-dica-tabela {
        display: none;
    }

    .sistema-pncd-ficha {
        padding: 12px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .sistema-pncd-visitas-toolbar .botao {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
        justify-content: center;
        min-height: 44px;
    }

    .sistema-pncd-rodape {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .sistema-pncd-status {
        grid-column: 1 / -1;
    }

    .sistema-pncd-rodape .botao {
        width: 100%;
        flex: unset;
    }

    .sistema-pncd-acoes-topo {
        width: 100%;
        justify-content: stretch;
    }

    .sistema-pncd-acoes-topo .botao {
        flex: 1 1 calc(50% - 4px);
    }
}

@media (min-width: 901px) {
    .sistema-pncd-abas {
        display: none;
    }

    .sistema-pncd-secao-oculta {
        display: block;
    }

    .sistema-pncd-visitas-cards {
        display: none;
    }

    .sistema-pncd-resumo-cards {
        display: none;
    }
}

@media (max-width: 720px) {
    .sistema-pncd-cab-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sistema-pncd-cab-grid label.wide {
        grid-column: 1 / -1;
    }

    .sistema-pncd-cab-grid label:nth-child(6n) {
        border-right: 1px solid #94a3b8;
    }

    .sistema-pncd-cab-grid label:nth-child(2n) {
        border-right: none;
    }

    .sistema-pncd-assinaturas-grid {
        grid-template-columns: 1fr;
    }

    .sistema-pncd-depositos-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

