.ptab-admin, .ptab-public {
    color: #1f2937;
    font-family: Arial, Helvetica, sans-serif;
}
.ptab-toolbar {
    display: flex;
    gap: 16px;
    align-items: center;
}
.ptab-toolbar--between {
    justify-content: space-between;
}
.ptab-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.ptab-actions--wrap { flex-wrap: wrap; }
.ptab-btn, .ptab-btn-light, .ptab-btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 10px;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.1;
}
.ptab-btn {
    background: #2563eb;
    color: #fff;
}
.ptab-btn-light {
    background: #fff;
    color: #1f2937;
    border-color: #d1d5db;
}
.ptab-btn-light.is-active { border-color: #2563eb; color: #2563eb; }
.ptab-btn-danger {
    background: #b91c1c;
    color: #fff;
}
.ptab-btn-danger--sm { padding: 8px 10px; font-size: 12px; }
.ptab-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 18px 0;
}
.ptab-tab {
    padding: 10px 14px;
    border-radius: 999px;
    background: #e5e7eb;
    color: #111827;
    text-decoration: none;
}
.ptab-tab.is-active {
    background: #1d4ed8;
    color: #fff;
}
.ptab-alert {
    border-radius: 12px;
    padding: 12px 16px;
    margin: 16px 0;
}
.ptab-alert--success { background: #dcfce7; color: #166534; }
.ptab-alert--error { background: #fee2e2; color: #991b1b; }
.ptab-grid {
    display: grid;
    gap: 18px;
}
.ptab-grid--2 { grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); }
.ptab-grid--cards { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 18px; }
.ptab-grid--stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-top: 18px; }
.ptab-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}
.ptab-card--hero { padding: 22px; }
.ptab-card--table { margin-top: 18px; }
.ptab-card__section { padding: 20px; }
.ptab-card > h2, .ptab-card > h3, .ptab-card > form, .ptab-card > .ptab-help-list, .ptab-card > .ptab-url-box, .ptab-card > p {
    margin-left: 20px;
    margin-right: 20px;
}
.ptab-card > h2:first-child, .ptab-card > h3:first-child { margin-top: 20px; }
.ptab-badge, .ptab-kicker {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
}
.ptab-summary-card {
    background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid #e5e7eb;
}
.ptab-summary-card__label { display: block; color: #64748b; font-size: 12px; margin-bottom: 6px; }
.ptab-summary-card__value { font-size: 28px; font-weight: 700; }
.ptab-form-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px;
    margin: 20px;
}
.ptab-field--12 { grid-column: span 12; }
.ptab-field--8 { grid-column: span 8; }
.ptab-field--6 { grid-column: span 6; }
.ptab-field--4 { grid-column: span 4; }
.ptab-field--3 { grid-column: span 3; }
.ptab-label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
}
.ptab-input, .ptab-select, .ptab-textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
}
.ptab-input--sm { padding: 8px 10px; font-size: 13px; }
.ptab-textarea { min-height: 96px; resize: vertical; }
.ptab-checkbox { display: inline-flex; gap: 8px; align-items: center; margin-top: 10px; }
.ptab-table-wrapper { width: 100%; overflow-x: auto; }
.ptab-table {
    width: 100%;
    border-collapse: collapse;
}
.ptab-table th, .ptab-table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 14px;
    vertical-align: top;
    text-align: left;
}
.ptab-table th {
    background: #f8fafc;
    font-weight: 700;
}
.ptab-table-public tbody tr:nth-child(odd) { background: #fcfcfd; }
.ptab-empty-state, .ptab-empty-inline {
    padding: 24px;
    text-align: center;
    color: #64748b;
}
.ptab-help-list {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}
.ptab-help-item {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    padding: 12px 14px;
    border-radius: 12px;
}
.ptab-breadcrumb {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 14px;
    margin-bottom: 14px;
    color: #64748b;
}
.ptab-breadcrumb a { color: #1d4ed8; text-decoration: none; }
.ptab-editor-box { margin: 0 20px 20px; padding: 18px; background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 16px; }
.ptab-table-editor-wrap { overflow-x: auto; }
.ptab-col-head {
    display: flex;
    gap: 8px;
    align-items: center;
}
.ptab-icon-btn {
    border: none;
    background: #fee2e2;
    color: #991b1b;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    cursor: pointer;
}
.ptab-meta-row {
    display: flex;
    gap: 14px;
    margin: 12px 0 14px;
    color: #64748b;
    font-size: 14px;
    flex-wrap: wrap;
}
.ptab-url-box {
    background: #0f172a;
    color: #e2e8f0;
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 12px;
    overflow-x: auto;
}
.ptab-public-tools { margin-top: 16px; }
.ptab-hero-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ptab-table-public th { position: sticky; top: 0; z-index: 1; }
.ptab-table-public thead tr:nth-child(2) th { background: #fff; }
.ptab-public .ptab-card--table { overflow: hidden; }
small { color: #64748b; }
.ptabs-subcard { margin: 20px; }
@media (max-width: 980px) {
    .ptab-grid--2 { grid-template-columns: 1fr; }
    .ptab-field--8, .ptab-field--6, .ptab-field--4, .ptab-field--3 { grid-column: span 12; }
    .ptab-toolbar, .ptab-toolbar--between { flex-direction: column; align-items: stretch; }
}


/* Ajuste da tabela principal para ocupar 100% da largura útil da página */
.ptab-public,
.ptab-public--fullwidth {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}
.ptab-public,
.ptab-public * {
    box-sizing: border-box;
}
.ptab-public .ptab-card,
.ptab-public .ptab-card--hero,
.ptab-public .ptab-card--table,
.ptab-public .ptab-card__section {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}
.ptab-public .ptab-card--table {
    overflow: hidden;
}
.ptab-public .ptab-table-wrapper {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: hidden;
}
.ptab-public .ptab-table-public {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    table-layout: fixed;
}
.ptab-public .ptab-table-public th,
.ptab-public .ptab-table-public td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    vertical-align: top;
}
.ptab-public .ptab-table-public th:not(.ptab-col-more),
.ptab-public .ptab-table-public td:not(.ptab-expand-cell) {
    width: auto;
}
.ptab-public .ptab-table-public thead tr:nth-child(2) input {
    width: 100%;
    min-width: 0;
}
@media (max-width: 980px) {
    .ptab-public .ptab-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .ptab-public .ptab-table-public {
        min-width: 980px;
    }
}

.ptab-col-more {
    width: 82px;
    min-width: 82px;
    text-align: center;
}
.ptab-expand-cell {
    width: 82px;
    min-width: 82px;
    text-align: center;
}
.ptab-expand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}
.ptab-expand-btn:hover {
    background: #dbeafe;
}
.ptab-expand-btn.is-open {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}
.ptab-details-row td {
    background: #f8fafc;
    white-space: normal !important;
    padding: 0;
}
.ptab-details-box {
    padding: 18px;
}
.ptab-details-title {
    font-weight: 700;
    margin-bottom: 12px;
    color: #0f172a;
}
.ptab-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
.ptab-detail-item {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 14px;
}
.ptab-detail-item__label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.ptab-detail-item__value {
    color: #111827;
    white-space: normal;
    word-break: break-word;
}


/* Subtabela das colunas ocultas */
.ptab-expand-cell {
    width: 72px;
    min-width: 72px !important;
    text-align: center;
}
.ptab-expand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #ffffff;
    color: #1d4ed8;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.ptab-expand-btn.is-open {
    background: #1d4ed8;
    color: #ffffff;
    border-color: #1d4ed8;
}
.ptab-details-row td {
    background: #f8fafc;
    padding: 0;
}
.ptab-details-box {
    padding: 16px;
    border-top: 1px solid #e5e7eb;
}
.ptab-details-title {
    font-weight: 700;
    color: #334155;
    margin-bottom: 10px;
}
.ptab-subtable-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    background: #ffffff;
}
.ptab-subtable {
    width: 100%;
    min-width: max-content;
    border-collapse: collapse;
}
.ptab-subtable th,
.ptab-subtable td {
    padding: 12px 14px;
    border-bottom: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
    white-space: nowrap;
    text-align: left;
    vertical-align: top;
}
.ptab-subtable th:last-child,
.ptab-subtable td:last-child {
    border-right: none;
}
.ptab-subtable thead th {
    background: #eff6ff;
    color: #1e3a8a;
    font-weight: 700;
}
.ptab-subtable tbody tr:last-child td {
    border-bottom: none;
}


.ptab-subtables-stack {
    display: grid;
    gap: 12px;
}
.ptab-subtable-group {
    display: grid;
    gap: 8px;
}
.ptab-subtable-label {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}


.ptab-export-actions {
    justify-content: flex-end;
    gap: 8px;
}
.ptab-export-actions .ptab-badge {
    margin-right: 4px;
}
@media (max-width: 980px) {
    .ptab-export-actions {
        justify-content: flex-start;
    }
}


.ptab-export-actions--block {
    justify-content: flex-start;
    margin-top: 12px;
    margin-bottom: 12px;
}

.ptab-export-actions--block .ptab-btn-light {
    margin-right: 0;
}


/* Distribuição das 10 colunas visíveis + coluna Mais */
.ptab-public .ptab-table-public th,
.ptab-public .ptab-table-public td {
    padding: 12px 10px;
}
.ptab-public .ptab-table-public th:not(.ptab-col-more):not(.ptab-expand-cell),
.ptab-public .ptab-table-public td:not(.ptab-expand-cell) {
    width: calc((100% - 72px) / 10);
}
.ptab-col-more,
.ptab-expand-cell {
    width: 72px !important;
    min-width: 72px !important;
    max-width: 72px !important;
}

/* Subtabelas também ocupando 100% do bloco interno */
.ptab-subtable-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}
.ptab-subtable {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    table-layout: fixed;
}
.ptab-subtable th,
.ptab-subtable td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}
@media (max-width: 980px) {
    .ptab-subtable-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .ptab-subtable {
        min-width: 980px;
    }
}


/* Página pública ocupando 100% da largura útil */
.ptab-public--fullwidth,
#ptab-public-table-app,
.ptab-public--fullwidth > .ptab-breadcrumb,
.ptab-public--fullwidth > .ptab-card {
    display: block;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
}
.ptab-public--fullwidth {
    margin-left: 0 !important;
    margin-right: 0 !important;
}
.ptab-public--fullwidth .ptab-toolbar,
.ptab-public--fullwidth .ptab-grid,
.ptab-public--fullwidth .ptab-meta-row,
.ptab-public--fullwidth .ptab-actions,
.ptab-public--fullwidth .ptab-public-tools {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}


@media print {
    .ptab-hero-actions,
    .ptab-export-actions,
    .ptab-public-tools,
    #ptab-pagination,
    .ptab-expand-cell,
    .ptab-col-more { display: none !important; }
    .ptab-public .ptab-card,
    .ptab-public .ptab-summary-card { box-shadow: none !important; }
    .ptab-public .ptab-table-wrapper { overflow: visible !important; }
    .ptab-public .ptab-table-public { table-layout: auto !important; }
    .ptab-public .ptab-table-public th,
    .ptab-public .ptab-table-public td { width: auto !important; white-space: normal !important; }
}

.ptab-specific-filters {
    margin-top: 18px;
    padding: 18px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
}

.ptab-details-sections {
    display: grid;
    gap: 14px;
}

.ptab-details-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px;
}

.ptab-details-section__title {
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 10px;
}

.ptab-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.ptab-details-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
}

.ptab-details-item strong {
    font-size: 13px;
    color: #334155;
}

.ptab-details-item span {
    font-size: 14px;
    color: #0f172a;
    word-break: break-word;
}

.ptab-details-box {
    background: #eef2ff;
    border-radius: 16px;
    padding: 14px;
}

@media (max-width: 980px) {
    .ptab-specific-filters {
        padding: 14px;
    }
    .ptab-details-grid {
        grid-template-columns: 1fr;
    }
}
