/* ========================================
   FRETE MASTER - CSS ORGANIZADO
   ======================================== */

/* ========================================
   1. RESET E VARIÁVEIS CSS
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Cores principais */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Cores de fundo */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-card: #ffffff;
    --bg-muted: #f3f4f6;

    /* Cores de texto */
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-white: #ffffff;

    /* Bordas */
    --border-color: #e5e7eb;
    --border-radius: 8px;

    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-bg: #1f2937;
    --sidebar-text: #d1d5db;
    --sidebar-active: #3b82f6;
}

/* ========================================
   2. LAYOUT GERAL
   ======================================== */

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    line-height: 1.6;
}

.clear {
    clear: both;
}

/* ========================================
   3. LANDING PAGE
   ======================================== */

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
}

.logo:hover,
.logo:focus {
    color: var(--primary);
    text-decoration: none;
}

.logo i {
    font-size: 1.75rem;
}

.nav-menu {
    display: none;
    gap: 2rem;
}

.nav-menu a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.nav-menu a:hover {
    color: var(--primary);
}

/* Reset para links: sem underline em todo o site */
a {
    text-decoration: none;
    color: inherit;
}

a:hover,
a:focus {
    text-decoration: none;
    color: inherit;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

.menu-toggle {
    display: block;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

@media (min-width: 1024px) {
    .nav-menu {
        display: flex;
    }

    .menu-toggle {
        display: none;
    }
}

/* Diminuir logo levemente em telas menores para melhor encaixe */
@media (max-width: 768px) {
    .header .logo {
        font-size: 1.15rem;
    }

    .header .logo i {
        font-size: 1.25rem;
    }

    /* header mobile do painel */
    .mobile-header .logo {
        font-size: 1rem;
    }

    .mobile-header .logo i {
        font-size: 1.15rem;
    }

    /* Se o logo for uma imagem, reduzir um pouco para caber melhor no layout */
    .header .logo img {
        width: 36px;
        max-width: 36px;
        height: auto;
        max-height: 36px;
        display: inline-block;
        object-fit: contain;
        vertical-align: middle;
    }

    .mobile-header .logo img {
        width: 30px;
        max-width: 30px;
        height: auto;
        max-height: 30px;
        display: inline-block;
        object-fit: contain;
        vertical-align: middle;
    }

    /* Diminuir botões Login / Cadastrar no cabeçalho da landing */
    .header .header-actions {
        gap: 0.5rem;
    }

    .header .header-actions .btn {
        padding: 0.35rem 0.6rem;
        font-size: 0.85rem;
        line-height: 1;
        min-height: 36px;
        border-radius: 6px;
    }

    .header .header-actions .btn .fas,
    .header .header-actions .btn i {
        font-size: 0.9rem;
    }

    /* Ajuste específico para o botão principal (Cadastrar) para manter destaque mas menor */
    .header .header-actions .btn-primary {
        padding: 0.4rem 0.75rem;
        font-size: 0.9rem;
    }
}

/* Correção: exibir menu mobile quando houver a classe .active
   e posicionar corretamente abaixo do header no layout responsivo */
.header .header-content {
    position: relative;
}

.nav-menu.active {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    background: var(--bg-card);
    padding: 0.5rem 1rem;
    gap: 0.5rem;
    box-shadow: var(--shadow-md);
    z-index: 9999;
    /* evita extrapolar a viewport verticalmente e horizontalmente */
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
    word-break: break-word;
}

.nav-menu.active a {
    color: var(--text-primary);
    padding: 0.5rem 0;
    display: block;
    border-radius: 6px;
}

.nav-menu.active a:hover,
.nav-menu.active a:focus {
    background: var(--bg-muted);
    color: var(--primary);
}

/* Garantir que links quebrem linha em telas pequenas */
.nav-menu.active a {
    white-space: normal;
    word-break: break-word;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--border-color);
}

.btn-outline:hover {
    background: var(--bg-muted);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.btn-icon:hover {
    color: var(--primary);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 4rem 1rem;
    text-align: center;
}

.hero-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero-content p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

@media (min-width: 768px) {
    .hero-content h1 {
        font-size: 3.5rem;
    }
}

/* Hero layout with image */
.hero-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.hero-image img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    max-width: 520px;
}

@media (min-width: 768px) {
    .hero-layout {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .hero-content {
        flex: 1 1 50%;
        text-align: left;
        padding-right: 1.5rem;
    }

    .hero-image {
        flex: 1 1 45%;
        display: flex;
        justify-content: center;
        align-items: center;
    }
}

/* Sections */
.section {
    padding: 4rem 1rem;
}

.section-alt {
    background: var(--bg-card);
}

.section-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 3rem;
}

/* Grid */
.grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-2 {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
}

.grid-3 {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin: 1rem 0;
}

.card-header {
    margin-bottom: 0.5rem;
}

/* Danger card header: position relative so danger button can be top-right */
.card.card-danger .card-header {
    position: relative;
}

.card.card-danger .card-header .danger-btn {
    position: absolute;
    right: 1rem;
    top: 0;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.card-body {
    color: var(--text-secondary);
}

.feature-icon {
    color: var(--primary);
    margin-bottom: 1rem;
}

/* Aumentar e centralizar ícone e textos na seção de funcionalidades */
#funcionalidades .grid .card {
    text-align: center;
}

#funcionalidades .feature-icon {
    font-size: 4rem;
    margin: 0 auto 1rem;
    display: block;
    line-height: 1;
}

#funcionalidades .grid .card h3,
#funcionalidades .grid .card p {
    text-align: center;
}

/* Pricing */
.pricing-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(3, minmax(280px, 1fr));
    max-width: 1000px;
    margin: 0 auto;
}

@media (max-width: 1024px) {
    .pricing-grid {
        grid-template-columns: repeat(2, minmax(260px, 1fr));
        max-width: 900px;
    }
}

@media (max-width: 768px) {
    .pricing-grid {
        grid-template-columns: 1fr;
        max-width: 480px;
    }
}

.pricing-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    position: relative;
    margin: 0;
    min-height: 240px;
    max-width: none;
    justify-self: stretch;
}

/* Individual plan heading style */
.plan h3 {
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 700;
}

/* Toggle styles */
.pricing-toggle-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.pricing-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 6px;
    border-radius: 999px;
    display: inline-flex;
}

.pricing-toggle .toggle-option {
    background: transparent;
    border: none;
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--text-secondary);
    cursor: pointer;
}

.pricing-toggle .toggle-option.active {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.status-toggle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.25rem;
    justify-content: center;
}

.status-toggle .switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.status-toggle .switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.status-toggle .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--border-color);
    border-radius: 24px;
    transition: background 0.2s ease;
}

.status-toggle .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.status-toggle input:checked+.slider {
    background: var(--success);
}

.status-toggle input:checked+.slider:before {
    transform: translateX(20px);
}

.slider-toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 3px;
    border-radius: 999px;
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
    overflow: hidden;
    width: 100%;
    min-width: 0;
    margin-top: 0.5rem;
}

.slider-toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc((100% - 6px) / 3);
    border-radius: 999px;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1), background-color 0.3s;
    z-index: 1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.slider-toggle--status-1::after {
    transform: translateX(0%);
    background-color: var(--success);
}

.slider-toggle--status-2::after {
    transform: translateX(100%);
    background-color: var(--warning);
}

.slider-toggle--status-3::after {
    transform: translateX(200%);
    background-color: var(--danger);
}

.slider-toggle-two {
    min-width: 160px;
}

.slider-toggle-two::after {
    width: calc((100% - 6px) / 2);
    left: 3px;
}

.slider-toggle-two.slider-toggle--status-1::after {
    transform: translateX(0%);
    background-color: var(--warning);
}

.slider-toggle-two.slider-toggle--status-2::after {
    transform: translateX(100%);
    background-color: var(--success);
}

.slider-toggle button {
    position: relative;
    z-index: 2;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: none;
    cursor: pointer;
    transition: color 0.2s;
    padding: 4px 6px;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    outline: none;
    min-height: 36px;
    /* garante espaço vertical para centralização */
}

.slider-toggle button::after {
    content: none;
}

/* safety: ensure buttons don't add extra markers on some browsers */

/* Responsive fixes for slider-toggle on small screens:
   - remove fixed min-width that caused overflow on narrow viewports
   - reduce internal padding and font-size so the three options fit
   - ensure the sliding indicator (::after) width is calculated correctly and remains visible
*/
@media (max-width: 576px) {
    .slider-toggle {
        min-width: 0;
        width: 100%;
        padding: 3px;
    }

    .slider-toggle::after {
        /* recompute the indicator width using available width, keep small gaps */
        width: calc((100% - 6px) / 3);
        left: 3px;
        top: 3px;
        bottom: 3px;
        border-radius: 999px;
    }

    .slider-toggle button {
        font-size: 0.65rem;
        padding: 6px 4px;
    }

    /* When table stacks on very small screens, keep the toggle full width */
    .table tbody tr td .slider-toggle {
        width: 100%;
        min-width: 0;
    }
}

/* Ensure slider gets a minimum sensible width on larger screens */
@media (min-width: 768px) {
    .slider-toggle {
        min-width: 210px;
    }

    .slider-toggle-two {
        min-width: 160px;
    }
}

/* Slightly adjust intermediate breakpoint for tablets */
@media (max-width: 768px) and (min-width: 577px) {
    .slider-toggle {
        padding: 3px;
    }

    .slider-toggle button {
        font-size: 0.69rem;
        padding: 5px 6px;
        min-height: 34px;
    }
}

.slider-toggle button:hover:not(:disabled) {
    color: var(--primary);
}

.slider-toggle button:disabled {
    color: #fff;
    cursor: default;
}

/* Price visibility by period */
.pricing-grid[data-period="yearly"] .price-monthly {
    display: none;
}

.pricing-grid[data-period="yearly"] .price-yearly {
    display: block;
}

.pricing-grid[data-period="monthly"] .price-yearly {
    display: none;
}

.pricing-grid[data-period="monthly"] .price-monthly {
    display: block;
}

.price-row {
    display: block;
    margin-bottom: 0.75rem;
}

.featured-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.session-timer {
    text-align: center;
    padding: 0.5rem 0;
}

.session-timer .small-text {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.1;
}

.session-timer #sessionTimer {
    display: inline-block;
    margin-left: 0.35rem;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-white);
}

@media (max-width: 480px) {
    .session-timer .small-text {
        font-size: 0.7rem;
    }

    .session-timer #sessionTimer {
        font-size: 1rem;
    }
}

.pricing-featured {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.featured-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: 0.25rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.price {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary);
    margin: 1rem 0;
}

.price span {
    font-size: 1rem;
    color: var(--text-secondary);
}

.pricing-features {
    list-style: none;
    margin: 2rem 0;
    text-align: left;
}

.pricing-features li {
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pricing-features i {
    color: var(--success);
}

.floating-support {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    left: auto;
    top: auto;
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
}

.support-toggle {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 0.65rem 1.35rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.support-toggle:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.support-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.5rem);
    width: 320px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    box-shadow: var(--shadow-xl);
    transition: opacity 0.2s ease, transform 0.2s ease;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}

.support-panel.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.support-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.support-header h4 {
    margin: 0;
    font-size: 1rem;
}

.support-header p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.support-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
}

.support-panel form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.support-panel label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.support-panel input,
.support-panel textarea {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    background: var(--bg-secondary);
    color: var(--text-default);
    transition: border 0.2s ease;
}

.support-panel input:focus,
.support-panel textarea:focus {
    border-color: var(--primary);
    outline: none;
}

.btn-block {
    width: 100%;
    text-align: center;
}

@media (max-width: 768px) {
    .floating-support {
        right: 1rem;
        bottom: 1rem;
    }

    .support-panel {
        width: 280px;
    }
}

/* Advantages */
.advantages-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    max-width: 900px;
    margin: 0 auto;
}

.advantage-item {
    text-align: center;
}

.advantage-item i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.advantage-item h4 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

/* Footer */
.footer,
.site-footer {
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
}

.footer {
    padding: 3rem 1rem 1rem;
}

.footer-content {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    margin-bottom: 1rem;
}

.footer-section h4 {
    color: white;
    margin-bottom: 1rem;
}

.footer-section a {
    display: block;
    color: var(--sidebar-text);
    text-decoration: none;
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}

.footer-section a:hover {
    color: white;
}

/* Forçar links do rodapé brancos e sem underline */
.footer a,
.footer-section a,
.footer-bottom a,
.site-footer a {
    color: white !important;
    text-decoration: none !important;
}

.footer a:hover,
.footer-section a:hover,
.footer-bottom a:hover,
.site-footer a:hover {
    color: white !important;
    text-decoration: none !important;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.site-footer {
    padding: 1.5rem 1rem;
}

.site-footer .container {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.site-footer p {
    margin: 0;
    color: var(--sidebar-text);
}

.painel-body .site-footer {
    width: 100%;
    margin-top: auto;
}

.painel-body>.site-footer {
    flex-basis: 100%;
}

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow-md);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 1.75rem;
    margin: 1rem 0 0.5rem;
}

.auth-header p {
    color: var(--text-secondary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-secondary);
}

.link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.link:hover {
    text-decoration: none;
}

/* ========================================
   4. AUTH PAGES
   ======================================== */

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.25rem 0;
}

.form-group label {
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    padding: 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

/* Make select text slightly smaller for better fit */
select.form-control,
select.form-control option {
    font-size: 0.9rem;
}

.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.form-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Enhanced 6-column form grid - fully responsive */
.form-grid-6 {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
}

/* Mobile medium and up */
@media (min-width: 577px) {
    .form-grid-6 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

/* Tablets */
@media (min-width: 768px) {
    .form-grid-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Small desktops */
@media (min-width: 992px) {
    .form-grid-6 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Medium desktops */
@media (min-width: 1100px) {
    .form-grid-6 {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Large desktops */
@media (min-width: 1200px) {
    .form-grid-6 {
        grid-template-columns: repeat(6, 1fr);
        gap: 1.25rem;
    }
}

/* Ensure each form-group occupies one column inside the 6-column grid */
.form-grid-6 .form-group {
    grid-column: span 1;
}

/* Enhanced 5-column form grid - fully responsive */
.form-grid-5 {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
}

/* Mobile medium and up */
@media (min-width: 577px) {
    .form-grid-5 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

/* Tablets */
@media (min-width: 768px) {
    .form-grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Small desktops */
@media (min-width: 992px) {
    .form-grid-5 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Large desktops */
@media (min-width: 1200px) {
    .form-grid-5 {
        grid-template-columns: repeat(5, 1fr);
        gap: 1.25rem;
    }
}

/* Ensure individual form groups inside a 5-column grid occupy one column each,
   while `.full-width` still spans all columns. This forces 5 campos por linha. */
.form-grid-5 .form-group {
    grid-column: span 1;
}


.form-grid-3 {
    display: grid;
    gap: 1rem;
    /* Fixed 3-column layout on desktop, collapses on narrower screens */
    grid-template-columns: repeat(3, 1fr);
}

.form-grid-tarefas {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr 3fr;
}

@media (max-width: 768px) {
    .form-grid-tarefas {
        grid-template-columns: 1fr;
    }
}

.form-grid-compras {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: 1fr 1fr 3fr 1fr;
}

.form-grid-compras .form-group {
    grid-column: span 1;
}

@media (max-width: 992px) {
    .form-grid-compras {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 576px) {
    .form-grid-compras {
        grid-template-columns: 1fr;
    }
}

/* Enhanced 4-column form grid - fully responsive */
.form-grid-4 {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
}

/* Mobile medium and up */
@media (min-width: 577px) {
    .form-grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

/* Tablets and small desktops */
@media (min-width: 768px) {
    .form-grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Large tablets and desktops */
@media (min-width: 992px) {
    .form-grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Extra large screens - maintain 4 columns but with better spacing */
@media (min-width: 1200px) {
    .form-grid-4 {
        gap: 1.25rem;
    }
}

/* Enhanced form-group rules for all grid systems */
.form-grid-4 .form-group,
.form-grid-5 .form-group,
.form-grid-6 .form-group,
.form-grid-7 .form-group {
    grid-column: span 1;
    min-width: 0;
    width: 100%;
}

/* Prevent form grids from exceeding container width */
.form-grid-4,
.form-grid-5,
.form-grid-6,
.form-grid-7 {
    box-sizing: border-box;
    overflow: hidden;
}

/* Ensure form controls inside grids are properly sized */
.form-grid-4 .form-control,
.form-grid-5 .form-control,
.form-grid-6 .form-control,
.form-grid-7 .form-control {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

@media (max-width: 992px) {
    .form-grid-3 {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.9rem;
    }
}

@media (max-width: 768px) {
    .form-grid-3 {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
}

.full-width,
.form-group.full-width {
    grid-column: 1 / -1 !important;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* ========================================
   6. SIDEBAR
   ======================================== */

.painel-body {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: calc(-1 * var(--sidebar-width));
    height: 100vh;
    transition: left 0.3s;
    z-index: 1000;
}

.sidebar.active {
    left: 0;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.sidebar-header .logo {
    color: white;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
    min-height: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--border-radius);
    margin-bottom: 0.25rem;
    transition: all 0.2s;
}

.sidebar-nav .nav-item i {
    min-width: 24px;
    text-align: center;
    font-size: 1.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar-nav .nav-item span {
    line-height: 1;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background: var(--sidebar-active);
    color: white;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

/* Reserve space so nav scroller never covers footer */
.sidebar-nav {
    padding-bottom: var(--sidebar-footer-height, 72px);
}

.sidebar-footer {
    height: var(--sidebar-footer-height, 72px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1104;
}

/* Make support footer content stack vertically and center */
.sidebar-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
}

.sidebar-footer .text-center {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    justify-content: center;
}

.sidebar-footer .support-toggle-form {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.sidebar-footer .support-toggle-form button {
    flex: 0 0 auto;
}

/* ========================================
   5. PAINEL LAYOUT
   ======================================== */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: 0;
}

.mobile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    min-height: 56px;
    /* Define altura consistente */
    border-bottom: 1px solid var(--border-color);
}

/* ========================================
   Visualizar Viagem & Documentos
   ======================================== */

.view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.view-grid-2-cols {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.view-section {
    background: var(--bg-muted);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.view-section.full-width {
    grid-column: 1 / -1;
}

.view-section h4 {
    margin-top: 0;
    margin-bottom: 1.25rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.view-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.view-list li {
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 0.5rem;
}

.view-list li:last-child {
    border-bottom: none;
}

.view-list li strong {
    color: var(--text-secondary);
    font-weight: 500;
}

.view-obs {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    line-height: 1.6;
    color: var(--text-primary);
}

.view-documents h4 {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Badge for Status */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--primary);
    color: white;
}

/* Responsividade para View Grid */
@media (max-width: 768px) {
    .view-grid,
    .view-grid-2-cols {
        grid-template-columns: 1fr;
    }

    .view-list li {
        flex-direction: column;
        justify-content: flex-start;
        gap: 0.25rem;
    }
}

/* Garantir que o header mobile e o botão hamburguer fiquem acima da sidebar e do overlay */
.mobile-header {
    position: relative;
    z-index: 1101;
}

.mobile-header .menu-toggle {
    position: relative;
    z-index: 1102;
}

/* Close button inside sidebar header (mobile only) */
.sidebar .sidebar-close {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    z-index: 1105;
}

.sidebar .sidebar-close i {
    pointer-events: none;
}

@media (max-width: 1023px) {
    .sidebar .sidebar-close {
        display: block;
    }
}

.content-wrapper {
    flex: 1;
    padding: 1.5rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 2rem;
}

.text-muted {
    color: var(--text-muted);
}

@media (min-width: 1024px) {
    .sidebar {
        left: 0;
    }

    .main-content {
        margin-left: var(--sidebar-width);
    }

    .mobile-header {
        display: none;
    }
}

/* Garantia extra: forçar sidebar oculto em telas menores que desktop para evitar mostrar por engano */
@media (max-width: 1023px) {

    /* Mobile: remove internal scrolling from sidebar — sidebar will scroll with page.
       Sidebar appears below fixed header and the whole page scrolls, not the nav. */
    .mobile-header {
        position: relative;
        z-index: 10;
        width: 100%;
        /* Remove fixed positioning to prevent content overlap */
    }

    /* Header is now relative positioned, so no special padding needed */
    .main-content {
        padding-top: 0;
    }

    .sidebar {
        position: absolute !important;
        left: calc(-1 * var(--sidebar-width)) !important;
        top: 0 !important;
        /* Changed from header height since header is no longer fixed */
        height: auto !important;
        max-height: none !important;
        transform: none !important;
        transition: left 0.25s ease !important;
        display: block;
        overflow: visible !important;
    }

    .sidebar.active {
        left: 0 !important;
    }

    /* Make nav non-scrollable so entire sidebar moves with document */
    .sidebar-nav {
        overflow: visible !important;
        padding: 1rem;
        max-height: none !important;
    }

    .sidebar-header,
    .sidebar-footer {
        display: block;
    }
}

/* Overlay que aparece quando a sidebar está aberta em mobile — captura clique fora para fechar */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    display: none;
    z-index: 999;
    cursor: default;
}

.sidebar-overlay.visible {
    display: block;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    margin-bottom: 2rem;
}

.card-stats {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    margin-bottom: 2rem;
}

/* ========================================
   7. CARDS (PAINEL)
   ======================================== */

/* Ensure the stats container (.card-stats) uses a single column so the inner
   .stats-grid can span the full card width; prevents the outer grid from
   constraining inner content to a single minmax column. */
.card.card-stats {
    grid-template-columns: 1fr !important;
}

.card.card-stats .card-body {
    width: 100%;
}

.card-stats .stat {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card-stats .stat h3 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.card-stats .stat p {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
}

.card-stats .stat-receber p {
    color: var(--success);
}

.card-stats .stat-pagar p {
    color: var(--danger);
}

.card-stats .stat-projetado p {
    color: var(--primary);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: bold;
    color: var(--text-primary);
}

.stat-icon {
    font-size: 3rem;
    opacity: 0.2;
}

.stat-success .stat-value {
    color: var(--success);
}

.stat-success .stat-icon {
    color: var(--success);
}

.stat-danger .stat-value {
    color: var(--danger);
}

.stat-danger .stat-icon {
    color: var(--danger);
}

/* Layout for stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    align-items: stretch;
}

.stats-grid .stat-card .text-muted {
    margin-top: 0.25rem;
    font-size: 0.9rem;
}

@media (max-width: 900px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {

    /* manter 2 colunas também em telas pequenas (responsive requirement) */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Mobile: empilhar conteúdo interno dos cards (label, value, currency) verticalmente */
@media (max-width: 480px) {
    .stats-grid>.stat-card {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem;
    }

    .stats-grid>.stat-card .stat-icon {
        align-self: flex-end;
        opacity: 0.12;
        font-size: 2.4rem;
    }

    .stats-grid>.stat-card .stat-content {
        width: 100%;
    }

    .stats-grid>.stat-card .stat-value {
        font-size: 1.6rem;
    }
}

/* Desktop: garantir 4 colunas no container de estatísticas */
@media (min-width: 901px) {
    .card-stats .stats-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
    }

    .card-stats .stats-grid>.stat-card {
        width: 100%;
        box-sizing: border-box;
    }
}

/* Ensure grid cells stretch to full height/width */
.stats-grid {
    justify-items: stretch;
    align-items: stretch;
}

.stats-grid>.stat-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

/* ========================================
   8. COMPONENTES GERAIS
   ======================================== */

/* Alerts */
.alert {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

/* Close button for server-rendered alerts */
.alert {
    position: relative;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.alert .alert-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem;
}

.alert .alert-close:hover {
    color: var(--text-primary);
}

.alert.fade-out {
    opacity: 0;
    transform: translateY(-8px);
}

/* Viagens: rota and cliente display responsive */
.route-cell,
.client-cell {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Legacy rules - now handled by the comprehensive spacing rules above */

.route-cell .route-left,
.client-cell .client-left {
    font-weight: 600;
}

.route-cell .route-right,
.client-cell .client-right {
    color: var(--text-secondary);
    font-size: 0.95rem;
}


/* Body wrapper for alert title + text */
.alert-body {
    display: block;
}

.alert-title {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.alert-text {
    display: block;
    color: var(--text-secondary);
}

/* Simple modal for messages */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 11000;
}

.modal {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    max-width: 520px;
    width: min(92vw, 520px);
    min-width: 300px;
    box-shadow: var(--shadow-lg);
}

.modal h3 {
    margin: 0 0 0.5rem 0;
}

.modal p {
    margin: 0 0 1rem 0;
    color: var(--text-secondary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.alert-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 0.5rem;
    flex-shrink: 0;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.alert-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-success .alert-icon {
    background: var(--success);
}

.alert-success .alert-title {
    color: var(--success);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-warning .alert-icon {
    background: var(--warning);
}

.alert-warning .alert-title {
    color: var(--warning);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-danger .alert-icon {
    background: var(--danger);
}

.alert-danger .alert-title {
    color: var(--danger);
}

.debug-panel {
    margin: 1.5rem auto;
    max-width: 1200px;
    padding: 1rem 1.25rem;
    background: rgba(254, 226, 226, 0.8);
    border: 1px solid rgba(239, 68, 68, 0.6);
    border-radius: var(--border-radius);
    color: var(--danger);
    font-size: 0.95rem;
    line-height: 1.4;
}

.debug-panel ul {
    margin: 0.5rem 0 0;
    padding-left: 1.25rem;
}

/* Progress */
.progress-item {
    margin-bottom: 1.5rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.progress-bar {
    height: 8px;
    background: var(--bg-muted);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    transition: width 0.3s;
}

.bg-success {
    background: var(--success);
}

.bg-danger {
    background: var(--danger);
}

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 0;
}

/* Shortcuts */
.shortcuts-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, 1fr);
}

.shortcut-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem;
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
}

.shortcut-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
    color: var(--primary);
}

.shortcut-btn i {
    font-size: 1.5rem;
}

.shortcut-btn span {
    font-size: 0.75rem;
    text-align: center;
}

#parcelasContainer {
    display: contents;
}

#parcelasContainer .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

#parcelasContainer .parcelas-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    align-items: flex-start;
}

#parcelasContainer .parcelas-row .form-control {
    width: 100%;
}

.parcelamento-field label {
    display: block;
    margin-bottom: 0.25rem;
}

/* ========================================
   9. TABLES
   ======================================== */

/* Tables */
.table-responsive {
    overflow-x: auto;
}

/* Zebra rows for tables and pagination container */
.table tbody tr:nth-child(odd) {
    background: #ffffff;
}

.table tbody tr:nth-child(even) {
    background: #fbfdfe;
}

.table-info {
    margin: 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.table-pagination {
    display: flex;
    justify-content: center;
    margin-top: 0.75rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.page-link {
    display: inline-block;
    padding: 0.4rem 0.65rem;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    text-decoration: none;
}

.page-link:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.page-link.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.page-link.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Enhanced stacked table layout on very small screens */
@media (max-width: 576px) {
    .table-responsive {
        overflow-x: visible;
        margin: 0 -0.5rem;
        padding: 0 0.5rem;
        width: calc(100% + 1rem);
    }

    .table {
        width: 100%;
        border-collapse: separate;
        border-spacing: 0 0.5rem;
    }

    .table thead {
        display: none;
    }

    .table tbody tr {
        display: block;
        border: 1px solid var(--border-color);
        border-radius: 12px;
        margin-bottom: 1rem;
        padding: 1rem;
        background: var(--bg-card);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        transition: all 0.2s ease;
    }

    .table tbody tr:hover {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
        transform: translateY(-1px);
    }

    .table tbody tr td {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.75rem 0.5rem;
        border: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        text-align: center;
    }

    .table tbody tr td:last-child {
        border-bottom: none;
    }

    .table tbody tr td:before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 0.85rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        width: 100%;
        display: block;
        margin: 0 0 0.5rem 0;
        padding-bottom: 0.25rem;
        border-bottom: 2px solid var(--primary);
        text-align: center;
    }

    .table tbody tr td>* {
        margin: 0 auto;
        width: auto;
        font-size: 0.95rem;
        line-height: 1.4;
        text-align: center;
        max-width: 100%;
    }

    /* Garantir centralização de todos os tipos de elementos */
    .table tbody tr td a,
    .table tbody tr td button,
    .table tbody tr td .btn,
    .table tbody tr td .btn-icon,
    .table tbody tr td .badge,
    .table tbody tr td .status-badge,
    .table tbody tr td span,
    .table tbody tr td div,
    .table tbody tr td p {
        display: inline-block;
        text-align: center;
        margin: 0 auto;
    }

    /* Exceções para elementos que devem manter alinhamento específico */
    .table tbody tr td .text-start,
    .table tbody tr td .text-left {
        text-align: left !important;
        margin: 0;
    }

    .table tbody tr td .text-end,
    .table tbody tr td .text-right {
        text-align: right !important;
        margin: 0;
    }

    /* Special handling for action buttons */
    .table tbody tr td .btn,
    .table tbody tr td .btn-icon {
        width: auto;
        margin: 0.25rem 0.25rem 0.25rem 0;
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }

    /* Form elements in stacked layout */
    .table tbody tr td .form-control {
        margin: 0.25rem auto;
        font-size: 0.95rem;
        text-align: center;
        max-width: 200px;
    }

    /* Status badges and indicators */
    .table tbody tr td .status-badge,
    .table tbody tr td .badge {
        margin: 0.25rem auto;
        font-size: 0.85rem;
        padding: 0.4rem 0.75rem;
        display: inline-block;
        text-align: center;
    }
}

/* Manter botões de ação em linha mesmo na tabela empilhada (mobile) */
@media (max-width: 576px) {

    .table tbody tr td.col-actions,
    .table tbody tr td.col-actions>* {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.35rem !important;
        width: 100% !important;
    }

    .table tbody tr td .btn-icon,
    .table tbody tr td .inline-form {
        display: inline-flex !important;
        width: auto !important;
        margin: 0 auto !important;
    }

    .table tbody tr td .inline-form button.btn-icon {
        padding: 0.35rem !important;
    }
}

/* Mobile/Tablet medium screens (577px - 767px) */
@media (min-width: 577px) and (max-width: 767px) {
    .table-responsive {
        overflow-x: visible;
        margin: 0;
        padding: 0;
        width: 100%;
    }

    .table {
        width: 100%;
        font-size: 0.85rem;
        table-layout: auto;
    }

    .table th,
    .table td {
        padding: 0.4rem 0.3rem;
        word-wrap: break-word;
        white-space: normal;
        font-size: 0.8rem;
    }

    /* Colunas flexíveis para telas médias */

    /* Garantir cabeçalhos centralizados no mobile/tablets médios */
    .table th {
        text-align: center !important;
    }

    .table th {
        font-size: 0.8rem;
        font-weight: 600;
    }

    /* Hide less important columns on smaller screens */
    .table .col-priority-low {
        display: none;
    }

    /* Optimize action buttons */
    .table .btn,
    .table .btn-icon {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    /* Form elements in tables */
    .table .form-control {
        font-size: 0.85rem;
        padding: 0.4rem 0.6rem;
    }

    /* Status indicators */
    .table .status-badge,
    .table .badge {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }
}

.table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    margin: 0;
}

/* Garantir que as tabelas dentro de containers responsivos funcionem corretamente */
.table-responsive .table {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    table-layout: auto !important;
}

/* Sistema de colunas responsivas flexíveis */
.table .col-xs {
    text-align: center;
}

/* Ícones, checkboxes */
.table .col-sm {
    text-align: center;
}

/* Botões pequenos */
.table .col-md {
    text-align: center;
}

/* Status, datas pequenas */
.table .col-lg {
    text-align: left;
}

/* Nomes, títulos */
.table .col-xl {
    text-align: left;
}

/* Descrições, endereços */
.table .col-auto {
    width: auto;
    text-align: left;
}

/* Ajusta automaticamente */

/* Regras específicas para cabeçalhos de colunas */
.table th.col-xs,
.table th.col-sm,
.table th.col-md,
.table th.col-lg,
.table th.col-xl,
.table th.col-auto {
    text-align: center !important;
}

/* Garantir que células sem classe específica herdem alinhamento correto */
.table td:not([class*="col-"]) {
    text-align: left;
}

/* Garantir que todas as tabelas ocupem 100% da largura */
.table-responsive {
    width: 100%;
    overflow-x: visible;
    margin: 0 -0.5rem;
    padding: 0 0.5rem;
    box-sizing: border-box;
}

.table-responsive .table {
    width: 100%;
    min-width: 100%;
    margin: 0;
}

/* Centralizar cabeçalhos - sempre e em qualquer situação */
.table th,
.table-responsive .table th,
.table-responsive table th,
.table thead th,
.table thead tr th {
    text-align: center !important;
    vertical-align: middle;
    justify-content: center;
}

/* Classe específica para cabeçalhos centralizados (fallback) */
.table th.text-center,
.table th.center {
    text-align: center !important;
}

/* Garantir centralização em todos os breakpoints responsivos */
@media (max-width: 767px) {
    .table th {
        text-align: center !important;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .table th {
        text-align: center !important;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .table th {
        text-align: center !important;
    }
}

@media (min-width: 1200px) {
    .table th {
        text-align: center !important;
    }
}

/* Centralizar dados das colunas apropriadas */
.table td.col-xs,
.table td.col-sm,
.table td.col-md {
    text-align: center;
}

.table td.col-lg,
.table td.col-xl,
.table td.col-auto {
    text-align: left;
}

/* Forçar centralização quando classe text-center é aplicada explicitamente */
.table td.text-center {
    text-align: center !important;
}

/* Centralizar conteúdo numérico e datas */
.table td[data-type="number"],
.table td[data-type="date"],
.table td[data-type="currency"] {
    text-align: center;
}

/* Alinhar texto à esquerda para conteúdo textual longo */
.table td[data-type="text"],
.table td[data-type="description"] {
    text-align: left;
    word-wrap: break-word;
    hyphens: auto;
}

/* Ações sempre centralizadas */
.table .col-actions,
.table .col-actions * {
    text-align: center !important;
}

/* Garantir que as linhas ocupem toda a largura */
.table tbody tr {
    width: 100%;
    display: table-row;
}

/* Melhorar espaçamento e legibilidade */
.table-responsive {
    margin: 0;
    padding: 0;
}

.table th,
.table td {
    vertical-align: middle;
}

.col-status {
    width: 15%;
}

.col-description {
    width: 35%;
}

.col-value {
    width: 10%;
}

.col-parcelas {
    width: 10%;
}

.col-date {
    width: 15%;
}

.col-actions {
    width: 15%;
}

.table .col-5 {
    width: 5%;
}

.table .col-10 {
    width: 10%;
}

.table .col-15 {
    width: 15%;
}

.table .col-20 {
    width: 20%;
}

.table .col-25 {
    width: 25%;
}

.table .col-30 {
    width: 30%;
}

.table .col-35 {
    width: 35%;
}

.table .col-40 {
    width: 40%;
}

.table .col-45 {
    width: 45%;
}

.table .col-50 {
    width: 50%;
}

.table .col-55 {
    width: 55%;
}

.table .col-60 {
    width: 60%;
}

.table .col-65 {
    width: 65%;
}

.table .col-70 {
    width: 70%;
}

.table .col-75 {
    width: 75%;
}

.table .col-80 {
    width: 80%;
}

.table .col-85 {
    width: 85%;
}

.table .col-90 {
    width: 90%;
}

.table .col-95 {
    width: 95%;
}

.table .col-100 {
    width: 100%;
}

.table thead {
    background: var(--bg-muted);
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.text-start {
    text-align: left;
}

.table th {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.table tbody tr:hover {
    background: var(--bg-muted);
}

/* Correção específica para toggle de status em tarefas.php */
.table tbody tr td .slider-toggle.slider-toggle-small.slider-toggle-two {
    /* Impedir que ocupe 100% da largura em telas pequenas */
    width: auto !important;
    max-width: 160px !important;
    margin: 0 auto !important;
    /* Centralizar o toggle */
}

/* Para telas acima de 576px, garantir que o texto caiba adequadamente */
@media (min-width: 577px) {
    .table tbody tr td .slider-toggle.slider-toggle-small.slider-toggle-two {
        min-width: 160px !important;
    }

    .table tbody tr td .slider-toggle.slider-toggle-small.slider-toggle-two button {
        /* Manter as propriedades originais mas garantir espaço adequado */
        padding: 4px 6px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
}

/* Em telas menores que 576px, ajustar especificamente */
@media (max-width: 576px) {
    .table tbody tr td .slider-toggle.slider-toggle-small.slider-toggle-two {
        max-width: 140px !important;
    }

    .table tbody tr td .slider-toggle.slider-toggle-small.slider-toggle-two button {
        /* Reduzir fonte e padding para telas pequenas */
        font-size: 0.65rem !important;
        padding: 3px 4px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
}

/* ========================================
   10. BADGES
   ======================================== */

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ========================================
   11. FILTROS
   ======================================== */

/* Filters */
.filters {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: stretch;
}

.filters .btn {
    align-self: stretch;
    height: 100%;
    justify-content: center;
}

@media (max-width: 1200px) {
    .filters {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

.align-end {
    align-self: end;
}

.page-header-actions {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
}

.filter-form {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-field {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
}

.filter-field label {
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.card-stats {
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.card-stats .stat {
    flex: 1;
    min-width: 180px;
    padding: 1rem;
    border-radius: var(--border-radius);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.card-stats .stat h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.card-stats .stat p {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tab-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tab-list {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s;
}

.tab-btn .tab-count {
    font-size: 0.85rem;
    background: var(--bg-muted);
    padding: 0.15rem 0.4rem;
    border-radius: 999px;
}

.tab-btn.active {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(37, 99, 235, 0.08);
}

.listing-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.table-row {
    transition: background 0.2s;
}

.row-even {
    background: var(--bg-primary);
}

.row-odd {
    background: #f7f7f7;
}

.table-row-empty td {
    text-align: center;
    color: var(--text-muted);
}

.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.page-link {
    background: var(--bg-muted);
    padding: 0.35rem 0.75rem;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    color: var(--text-secondary);
    transition: all 0.2s;
    text-decoration: none;
}

.page-link:hover {
    border-color: var(--border-color);
}

.page-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.inline-form {
    display: inline-flex;
    margin: 0 0.15rem;
    padding: 0;
}

.inline-form button {
    padding: 0.4rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: var(--bg-muted);
    color: var(--text-secondary);
}

.badge-warning {
    background: var(--warning);
    color: #fff;
}

.badge-success {
    background: var(--success);
    color: #fff;
}

.badge-info {
    background: #0ea5e9;
    color: #fff;
}

.badge-primary {
    background: var(--primary);
    color: #fff;
}

/* Chart Placeholder */
.chart-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background: var(--bg-muted);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
}

.chart-placeholder i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* ========================================
   12. UTILITÁRIOS
   ======================================== */

/* Utility Classes */
.text-center {
    text-align: center;
}

/* Column for names should be left-aligned */
.col-name {
    text-align: left;
}

.table tbody td.col-name {
    text-align: center;
}

.table tbody td.col-name .flex-with-icon {
    justify-content: center;
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

.text-primary {
    color: var(--primary);
}

.text-secondary {
    color: var(--text-secondary);
}

/* Utility for hiding elements (used instead of inline styles) */
.hidden {
    display: none !important;
}

/* Quando modal aberto: impedir scroll e touch-action na página de fundo */
.no-scroll {
    overflow: hidden !important;
    touch-action: none !important;
}

/* Link novo proprietário */
.link-new-owner {
    color: var(--danger);
    font-weight: 700;
}

/* Utility italic text */
.font-italic {
    font-style: italic;
}

/* Form section should span full width of parent form-grid */
.form-section {
    width: 100%;
    box-sizing: border-box;
    grid-column: 1 / -1;
    margin-bottom: 1rem;
}

/* Grid for showing many small form items in one row (mobile-first) */
.form-section {
    margin-bottom: 1rem;
}

/* Enhanced 7-column form grid - fully responsive */
.form-grid-7 {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
    align-items: start;
}

/* Mobile medium and up */
@media (min-width: 577px) {
    .form-grid-7 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

/* Tablets */
@media (min-width: 768px) {
    .form-grid-7 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Small desktops */
@media (min-width: 900px) {
    .form-grid-7 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Medium desktops */
@media (min-width: 1100px) {
    .form-grid-7 {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Large desktops */
@media (min-width: 1300px) {
    .form-grid-7 {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Extra large screens */
@media (min-width: 1400px) {
    .form-grid-7 {
        grid-template-columns: repeat(7, 1fr);
        gap: 1.25rem;
    }
}

/* Ensure each form-group inside a .form-grid-7 occupies one grid column and stretches */
.form-grid-7 .form-group {
    grid-column: span 1;
    min-width: 0;
    /* prevents overflow when contents are long */
    display: flex;
    flex-direction: column;
}

/* Force inputs/selects/textareas to fill the available column width */
.form-grid-7 .form-control,
.form-grid-7 select.form-control,
.form-grid-7 input.form-control,
.form-grid-7 textarea.form-control {
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    display: block;
}

.group-origem,
.group-destino,
.group-charges {
    display: block;
    padding: 0.25rem 0;
}

.group-origem .form-group,
.group-destino .form-group,
.group-charges .form-group {
    margin-bottom: 0.5rem;
}

/* Ensure uniform sizing for 6-column sections when used */
.form-section.form-grid-6 {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
    align-items: start;
}

.form-section.form-grid-6 .form-group {
    grid-column: span 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.form-section.form-grid-6 .form-control {
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 1200px) {
    .form-section.form-grid-6 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .form-section.form-grid-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .form-section.form-grid-6 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .form-section.form-grid-6 {
        grid-template-columns: 1fr;
    }
}

/* Autocomplete marca */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    z-index: 12000;
    background: #fff;
    max-height: 220px;
    overflow-y: auto;
    width: 100%;
    box-shadow: var(--shadow-md);
}

.autocomplete-item {
    padding: 8px;
    cursor: pointer;
}

.autocomplete-item:hover {
    background: var(--bg-muted);
}

.address-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    cursor: wait;
    z-index: 1050;
}

.address-loading-overlay.hidden {
    display: none;
}

.address-loading-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    font-weight: 600;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spinner 0.9s linear infinite;
}

@keyframes spinner {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Danger styles for cards and buttons */
.card-danger {
    border-color: var(--danger);
    margin: 1rem 0;
}

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.small-text {
    margin-top: 0.5rem;
    font-size: 0.6rem;
}

/* Helper de CEP inline */
.cep-helper-inline {
    margin: 0 !important;
    font-size: 0.7rem;
    font-style: italic;
    display: inline-block;
    vertical-align: baseline;
    line-height: 1.2;
}

/* Form check inputs (checkboxes / radios) */
.form-check-input {
    width: auto;
    margin: 0;
    vertical-align: middle;
}

/* Utility for flex items with icon/text */
.flex-with-icon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Utility width helpers (used instead of inline width styles) */
.w-75 {
    width: 75%;
}

.w-45 {
    width: 45%;
}

/* ========================================
   UPLOAD DE DOCUMENTOS
   ======================================== */

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    background: var(--bg-card);
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 1rem;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.upload-content p {
    margin: 0.5rem 0;
    color: var(--text-secondary);
}

.upload-content small {
    color: var(--text-muted);
}

/* File Counter */
.file-counter {
    margin-bottom: 1rem;
}

/* Uploaded Files Container */
.uploaded-files-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.uploaded-file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-card);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.file-preview {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius);
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.file-preview.pdf-preview {
    background: var(--bg-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--danger);
    font-size: 1.25rem;
}

.file-details {
    flex: 1;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    word-break: break-all;
}

.file-size {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Upload Overlay */
.upload-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.upload-overlay.show {
    opacity: 1;
    visibility: visible;
}

.upload-overlay-content {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.upload-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-muted);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.upload-progress {
    width: 100%;
    height: 8px;
    background: var(--bg-muted);
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

.upload-progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Error Modal */
.error-modal .modal-content {
    max-width: 500px;
}

.error-modal .modal-body {
    text-align: left;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .upload-area {
        padding: 1.5rem 1rem;
    }

    .uploaded-file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .file-info {
        width: 100%;
    }
}

/* ========================================
   VISUALIZAÇÃO DE DOCUMENTOS
   ======================================== */

.documentos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.documento-item {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    background: var(--bg-card);
    transition: box-shadow 0.2s ease;
}

.documento-item:hover {
    box-shadow: var(--shadow-md);
}

.documento-preview {
    text-align: center;
    margin-bottom: 0.75rem;
}

.documento-thumb {
    width: 100%;
    max-width: 120px;
    height: 90px;
    object-fit: cover;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.pdf-thumb {
    background: var(--bg-muted);
    display: flex !important;
    align-items: center;
    justify-content: center;
    color: var(--danger);
}

.documento-info {
    text-align: center;
}

.documento-nome {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    word-break: break-all;
    font-size: 0.9rem;
}

.documento-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.documento-acoes {
    display: flex;
    justify-content: center;
}

.documento-acoes .btn {
    font-size: 0.8rem;
    padding: 0.375rem 0.75rem;
}

/* Input with Icon Wrapper */
.input-with-icon {
    position: relative;
    display: block;
}

.input-with-icon input {
    width: 100%;
}


.input-with-icon .form-control {
    padding-right: 2.5rem;
}

.input-with-icon .btn-icon {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    background: transparent;
    border: none;
    color: var(--text-secondary);
}

.input-with-icon .btn-icon:hover {
    color: var(--primary);
}

/* Custom Stats Grid Styling */
.stat-card {
    align-items: center;
    /* Ensure vertical center */
}

.stat-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-label {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.stat-count {
    font-size: 1.8rem;
    font-weight: 700;
    color: #000000;
    /* Número preto */
    line-height: 1.2;
}

.stat-money {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.stat-icon {
    font-size: 2.5rem;
    color: #9ca3af !important;
    /* Ícone cinza */
    opacity: 0.4;
}

/* Cores específicas para o valor monetário */
.stat-card[data-target-tab="pagar"] .stat-money {
    color: #f97316;
    /* Laranja (A pagar) */
}

.stat-card[data-target-tab="pagas"] .stat-money {
    color: #dc2626;
    /* Vermelho (Pagas) */
}

.stat-card[data-target-tab="receber"] .stat-money {
    color: #2563eb;
    /* Azul (A receber) */
}

.stat-card[data-target-tab="recebidas"] .stat-money {
    color: #16a34a;
    /* Verde (Recebidas) */
}

/* Filters Header - Button positioned top right */
.filters-card .card-header {
    position: relative !important;
    display: block !important;
    padding: 0.5rem !important;
}

.filters-card .card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.filters-card .card-header #toggleFilters {
    position: absolute !important;
    top: 0.75rem !important;
    right: 1rem !important;
    display: inline-flex !important;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    background: var(--primary) !important;
    color: white !important;
    border: 1px solid var(--primary) !important;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filters-card .card-header #toggleFilters:hover {
    background: var(--primary-dark) !important;
    transform: translateY(-1px);
}

/* Filters Form - Compact Single Line Layout */
.filters-form {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: nowrap;
}

.filters-form .form-group {
    flex: 1;
    min-width: 0;
    margin: 0;
    max-width: 200px;
    /* Limit maximum width for better proportions */
}

.filters-form .form-group label {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filters-form .form-control {
    font-size: 0.85rem;
    padding: 0.4rem;
    width: 100%;
}

.filters-form .filter-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.filters-form .filter-actions .btn {
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
    white-space: nowrap;
}

/* Specific styling for inline filters */
.filters-inline {
    align-items: flex-start;
    gap: 1rem;
}

.filters-inline .form-group {
    flex: 1 1 calc(50% - 0.5rem);
    max-width: none;
    min-width: 140px;
}

.filters-inline .filter-actions {
    margin-left: auto;
}

/* Responsive: Stack on tablets and mobile */
@media (max-width: 991px) {
    .filters-form {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .filters-form .form-group {
        flex: 1 1 calc(50% - 0.375rem);
        min-width: 140px;
        max-width: none;
        /* Allow full width on smaller screens */
    }

    .filters-form .form-group label {
        font-size: 0.8rem;
    }

    .filters-form .form-control {
        font-size: 0.9rem;
        padding: 0.5rem;
    }

    .filters-form .filter-actions {
        flex: 1 1 100%;
        width: 100%;
        justify-content: center;
        gap: 0.5rem;
        margin-top: 0.5rem;
    }

    .filters-form .filter-actions .btn {
        flex: 1;
        max-width: 150px;
    }

    /* Specific mobile rules for inline filters */
    .filters-inline {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .filters-inline .form-group {
        flex: 1 1 calc(50% - 0.375rem);
        max-width: none;
        min-width: 140px;
    }

    .filters-inline .filter-actions {
        flex: 1 1 100%;
        margin-left: 0;
        margin-top: 0.5rem;
        justify-content: center;
    }
}

/* Desktop small and large - ensure filters are hidden by default */
@media (min-width: 992px) {
    .filters-form {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .filters-form .form-group {
        flex: 1 1 calc(50% - 0.375rem);
        min-width: 180px;
        max-width: none;
    }

    .filters-form .form-group label {
        font-size: 0.85rem;
    }

    .filters-form .form-control {
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem;
    }

    .filters-form .filter-actions {
        flex: 1 1 100%;
        width: 100%;
        justify-content: center;
        gap: 0.75rem;
        margin-top: 0.75rem;
    }

    .filters-form .filter-actions .btn {
        flex: 0 0 auto;
        min-width: 120px;
    }

    /* Specific desktop rules for inline filters */
    .filters-inline {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .filters-inline .form-group {
        flex: 1 1 calc(50% - 0.5rem);
        max-width: none;
        min-width: 180px;
    }

    .filters-inline .filter-actions {
        flex: 1 1 100%;
        margin-left: 0;
        margin-top: 0.75rem;
        justify-content: center;
    }
}

/* Mobile medium adjustments */
@media (max-width: 767px) {
    .filters-form {
        gap: 0.75rem;
    }

    .filters-form .form-group {
        flex: 1 1 calc(50% - 0.375rem);
        min-width: 140px;
    }

    .filters-form .filter-actions .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    /* Override form-grid when used with filters-form on mobile */
    .filters-form.form-grid,
    .filters-form.form-grid-4,
    .filters-form.form-grid-5,
    .filters-form.form-grid-6,
    .filters-form.form-grid-7 {
        display: flex !important;
        grid-template-columns: none !important;
    }

    .filters-form.form-grid .form-group,
    .filters-form.form-grid-4 .form-group,
    .filters-form.form-grid-5 .form-group,
    .filters-form.form-grid-6 .form-group,
    .filters-form.form-grid-7 .form-group {
        grid-column: auto !important;
    }

    /* Prevent filter container from closing when interacting with fields */
    #filtersContainer {
        position: relative;
        z-index: 1;
    }

    #filtersContainer.show {
        display: block !important;
    }
}

/* Mobile small adjustments - ensure 2 fields per row */
@media (max-width: 576px) {
    .filters-form {
        gap: 0.5rem;
    }

    .filters-form .form-group {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 120px;
    }

    .filters-form .form-group label {
        font-size: 0.75rem;
    }

    .filters-form .form-control {
        font-size: 0.85rem;
        padding: 0.4rem;
    }

    .filters-form .filter-actions .btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }

    /* Specific mobile small rules for inline filters */
    .filters-inline {
        gap: 0.5rem;
    }

    .filters-inline .form-group {
        flex: 1 1 calc(50% - 0.25rem);
        max-width: none;
        min-width: 120px;
    }

    .filters-inline .filter-actions {
        margin-top: 0.5rem;
    }
}

/* ========================================
   PAGINATION STYLES
   ======================================== */

.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem 0;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-item {
    display: inline-block;
}

.pagination-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    user-select: none;
}

.pagination-link:hover:not(.disabled):not(.active) {
    background-color: #f8f9fa;
    border-color: #007bff;
    color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pagination-link.active {
    background-color: #007bff;
    border-color: #007bff;
    color: #fff;
    cursor: default;
    font-weight: 600;
}

.pagination-link.disabled {
    background-color: #f8f9fa;
    border-color: #ddd;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.pagination-link i {
    font-size: 0.85rem;
}

.pagination-info {
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* ========================================
   13. RESPONSIVIDADE
   ======================================== */

/* Mobile pagination adjustments */
@media (max-width: 576px) {
    .pagination-container {
        margin: 1.5rem 0;
        gap: 0.25rem;
    }

    .pagination {
        gap: 0.25rem;
    }

    .pagination-link {
        min-width: 36px;
        height: 36px;
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }

    /* Hide some page numbers on mobile */
    .pagination-item.hide-mobile {
        display: none;
    }
}

/* ========================================
   MOBILE COMPATIBILITY IMPROVEMENTS
   ======================================== */

/* Prevent zoom on input focus (iOS) */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="search"],
select,
textarea {
    font-size: 16px !important;
    /* Prevents iOS zoom */
}

/* Better touch targets for mobile */
@media (max-width: 768px) {

    .btn,
    button,
    a.btn,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        /* iOS recommended touch target */
        min-width: 44px;
    }

    .form-control {
        min-height: 44px;
        font-size: 16px;
    }

    select.form-control {
        min-height: 44px;
    }
}

/* Improve form field visibility on mobile */
.form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Prevent keyboard from hiding on mobile */
input.form-control,
select.form-control,
textarea.form-control {
    -webkit-user-select: text;
    user-select: text;
}

/* Better date picker integration */

/* Flatpickr mobile improvements */
.flatpickr-calendar {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
}

@media (max-width: 576px) {
    .flatpickr-calendar {
        width: 100% !important;
        max-width: 320px;
    }

    .flatpickr-day {
        max-width: 40px;
        height: 40px;
        line-height: 40px;
    }
}

/* Loading state for better UX */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Legacy table rules removed - now handled by specific breakpoint rules above */


/* --- System Improvements --- */
.system-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex !important;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s;
}

.system-modal-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    display: none !important;
}

.system-modal {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.system-modal-header {
    padding: 1rem;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.system-modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.system-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.system-modal-body {
    padding: 1.5rem;
    line-height: 1.5;
}

.system-modal-footer {
    padding: 1rem;
    border-top: 1px solid #ddd;
    text-align: right;
}

.pagination-container {
    display: flex !important;
    justify-content: center !important;
    margin: 2rem 0;
    width: 100%;
}

.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    gap: 5px;
}

.pagination-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #555;
    background: #fff;
    text-decoration: none;
}

.pagination-link.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.pagination-link:hover:not(.active):not(.disabled) {
    background: #f0f0f0;
}


/* --- System Styles (Pagination, Modals, Mobile) --- */

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem 0;
    width: 100%;
}

.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0.5rem;
}

.pagination-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    background: var(--bg-card);
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
}

.pagination-link:hover:not(.active):not(.disabled) {
    background-color: var(--bg-secondary);
    border-color: var(--primary);
    color: var(--primary);
    text-decoration: none;
}

.pagination-link.active {
    background-color: var(--primary);
    color: var(--text-white);
    border-color: var(--primary);
}

.pagination-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--bg-muted);
}

@media (max-width: 768px) {
    .pagination-link.hide-mobile {
        display: none;
    }

    .pagination-container {
        margin-top: 1.5rem;
    }
}

/* Modals */
.modal-backdrop,
.system-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-backdrop.visible,
.modal-backdrop:not(.hidden),
.system-modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal,
.system-modal {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform 0.3s;
    animation: modalSlideIn 0.3s forwards;
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideIn {
    to {
        transform: translateY(0);
    }
}

.modal h3,
.system-modal-title {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.modal p,
.system-modal-body {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.modal-actions,
.system-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: auto;
}

/* Mobile Input Fix */
@media screen and (max-width: 768px) {

    input,
    select,
    textarea {
        font-size: 16px !important;
        /* Prevents iOS zoom */
    }
}

/* Date Picker Wrapper */
.flatpickr-input {
    background-color: var(--bg-card) !important;
}

.has-calendar {
    position: relative;
}

/* Fix Flatpickr Z-Index */
.flatpickr-calendar {
    z-index: 9999 !important;
}

/* Fix Mobile Input Focus Issues */
.form-control {
    appearance: none;
    -webkit-appearance: none;
    user-select: text;
    -webkit-user-select: text;
    -webkit-touch-callout: default;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

@media (max-width: 768px) {
    .form-control:focus {
        -webkit-user-select: text;
        user-select: text;
        -webkit-touch-callout: default;
        transform: none !important;
        z-index: auto !important;
    }

    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    textarea,
    select {
        appearance: none;
        -webkit-appearance: none;
        user-select: text;
        -webkit-user-select: text;
        transform: none !important;
        z-index: auto !important;
    }
}

/* Filters visibility controlled by JavaScript classes */
#filtersContainer {
    display: none;
}

#filtersContainer.show {
    display: block !important;
}

.form-grid-7 {
    grid-template-columns: repeat(7, 1fr);
    gap: 1rem;
    display: grid;
}

@media (max-width: 1200px) {
    .form-grid-7 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .form-grid-7 {
        grid-template-columns: 1fr;
    }
}

.slider-toggle {
    min-width: 80px !important;
}

.slider-toggle button {
    font-size: 0.65rem !important;
    padding: 1px !important;
}

@media (min-width: 768px) {
    .slider-toggle {
        min-width: 80px !important;
    }
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    align-items: center;
}

.action-buttons form {
    margin: 0;
}

/* Compact Toggle */
.slider-toggle.slider-toggle-small {
    font-size: 0.4rem;
    padding: 0px;
    min-width: 35px;
    height: 30px;
}

.slider-toggle.slider-toggle-small button {
    padding: 0rem 0.05rem;
    font-size: 0.4rem;
    min-height: 16px;
}

/* Action buttons always inline - prevent wrapping on mobile */
.action-buttons-inline {
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.action-buttons-inline .btn-icon,
.action-buttons-inline .inline-form {
    flex-shrink: 0;
}

/* Status Radio Buttons Vertical Layout */
.status-radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    align-items: center;
    width: 100%;
    max-width: 140px;
    margin: 0 auto;
}

.status-radio-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    width: 100%;
    max-width: 120px;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
}

.status-radio-item input[type="radio"] {
    margin: 0;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    cursor: pointer;
}

.status-radio-item label {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    flex: 1;
}

/* Status colors - unselected (gray) */
.status-radio-item.status-ativo {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #6c757d;
}

.status-radio-item.status-manutencao {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #6c757d;
}

.status-radio-item.status-inativo {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #6c757d;
}

/* Status colors - selected */
.status-radio-item.status-ativo.selected {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    font-weight: 600;
}

.status-radio-item.status-manutencao.selected {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    font-weight: 600;
}

.status-radio-item.status-inativo.selected {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    font-weight: 600;
}

.status-radio-item input[type="radio"]:checked+label {
    font-weight: 600;
}

/* ===========================================
   RESPONSIVE DESIGN - BREAKPOINTS COMPLETOS
   =========================================== */

/* Extra Small (XS): < 576px - Celulares pequenos */
@media (max-width: 575.98px) {
    * {
        box-sizing: border-box;
    }

    html,
    body {
        width: 100vw;
        margin: 0;
        padding: 0;
        overflow-x: hidden;
    }

    .container {
        width: 100%;
        padding-left: 8px;
        padding-right: 8px;
        margin: 0;
        max-width: none;
    }

    .main-content {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        padding: 0;
    }

    .content-wrapper {
        padding: 0.5rem;
        width: 100%;
    }

    .page-header {
        padding: 1rem 0.5rem;
        text-align: center;
        margin: 0;
    }

    .page-header h1 {
        font-size: 1.5rem;
        margin: 0;
    }

    .card {
        margin: 0.25rem 0;
        border-radius: 8px;
        width: 100%;
        box-sizing: border-box;
    }

    .card-body {
        padding: 1rem 0.75rem;
    }

    .form-grid {
        gap: 0.75rem;
        padding: 0;
    }

    .form-grid-4,
    .form-grid-5 {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .table-responsive {
        font-size: 0.75rem;
        margin: 0 -0.5rem;
        width: calc(100% + 1rem);
    }

    .table {
        min-width: 300px;
        font-size: 0.75rem;
    }

    .status-radio-group {
        min-width: 100px;
        gap: 0.1rem;
    }

    .status-radio-item {
        padding: 0.2rem 0.4rem;
        gap: 0.25rem;
        max-width: 100px;
    }

    .status-radio-item label {
        font-size: 0.75rem;
    }

    .status-radio-item input[type="radio"] {
        width: 12px;
        height: 12px;
    }

    /* Ensure full width usage */
    .action-buttons-inline {
        justify-content: space-between;
        width: 100%;
    }

    .action-buttons-inline .btn-icon {
        flex: 1;
        text-align: center;
    }
}

/* Small (SM): 576px - 767px - Celulares maiores */
@media (min-width: 576px) and (max-width: 767.98px) {
    .container {
        max-width: 540px;
        width: 100%;
    }

    .form-grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .form-grid-5 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .card-body {
        padding: 1.25rem;
    }

    .table-responsive {
        font-size: 0.85rem;
    }

    .btn {
        width: auto;
        margin-bottom: 0;
    }
}

/* Medium (MD): 768px - 991px - Tablets paisagem */
@media (min-width: 768px) and (max-width: 991.98px) {
    .container {
        max-width: 720px;
        width: 100%;
    }

    .sidebar {
        width: 200px;
    }

    .main-content {
        margin-left: 200px;
    }

    .form-grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    .form-grid-5 {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }

    .table-responsive {
        overflow-x: visible;
        font-size: 0.85rem;
        margin: 0;
        padding: 0;
        width: 100%;
    }

    .table {
        width: 100%;
        font-size: 0.85rem;
        table-layout: auto;
    }

    .table th,
    .table td {
        padding: 0.5rem 0.4rem;
        word-wrap: break-word;
        white-space: normal;
        font-size: 0.85rem;
    }

    /* Colunas flexíveis para tablets */

    /* Garantir cabeçalhos centralizados nos tablets */
    .table th {
        text-align: center !important;
    }

    .table th {
        font-size: 0.85rem;
        font-weight: 600;
    }

    /* Hide least important columns on tablets */
    .table .col-details,
    .table .col-notes,
    .table .col-created {
        display: none;
    }

    /* Optimize buttons for tablets */
    .table .btn,
    .table .btn-icon {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    /* Form elements */
    .table .form-control {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }

    /* Status indicators */
    .table .status-badge,
    .table .badge {
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
    }

    .card-body {
        padding: 1.5rem;
    }
}

/* Large (LG): 992px - 1199px - Desktops menores */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .container {
        max-width: 960px;
        width: 100%;
    }

    .sidebar {
        width: 220px;
    }

    .main-content {
        margin-left: 220px;
    }

    .form-grid-4 {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }

    .form-grid-5 {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }

    .table-responsive {
        overflow-x: visible;
        font-size: 0.9rem;
    }

    .table {
        width: 100%;
        font-size: 0.9rem;
        table-layout: auto;
    }

    .table th,
    .table td {
        padding: 0.6rem 0.7rem;
        word-wrap: break-word;
        white-space: normal;
    }

    /* Colunas flexíveis para desktop pequeno */

    /* Garantir cabeçalhos centralizados no desktop pequeno */
    .table th {
        text-align: center !important;
    }

    .table th {
        font-size: 0.9rem;
        font-weight: 600;
    }

    /* Show most columns but optimize spacing */
    .table .col-notes {
        max-width: 200px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Optimize buttons for small desktops */
    .table .btn,
    .table .btn-icon {
        padding: 0.5rem 0.8rem;
        font-size: 0.9rem;
    }

    /* Form elements */
    .table .form-control {
        font-size: 0.9rem;
        padding: 0.5rem 0.8rem;
    }

    /* Status indicators */
    .table .status-badge,
    .table .badge {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }

    .card-body {
        padding: 2rem;
    }
}

/* Extra Large (XL): >= 1200px - Desktops grandes */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
        width: 100%;
    }

    .sidebar {
        width: 240px;
    }

    .main-content {
        margin-left: 240px;
    }

    .form-grid-4 {
        grid-template-columns: repeat(4, 1fr);
        gap: 1rem;
    }

    .form-grid-5 {
        grid-template-columns: repeat(5, 1fr);
        gap: 1rem;
    }

    .page-header h1 {
        font-size: 2.5rem;
    }

    .card-body {
        padding: 0.5rem;
    }

    .table-responsive {
        overflow-x: visible;
        font-size: 0.95rem;
    }

    .table {
        width: 100%;
        font-size: 0.95rem;
        table-layout: auto;
    }

    .table th,
    .table td {
        padding: 0.8rem 1rem;
        word-wrap: break-word;
        white-space: normal;
    }

    /* Colunas totalmente flexíveis em telas grandes */

    /* Garantir cabeçalhos centralizados no desktop grande */
    .table th {
        text-align: center !important;
    }

    .table th {
        font-size: 0.95rem;
        font-weight: 600;
    }

    /* All columns visible on large screens */
    .table th,
    .table td {
        white-space: normal;
    }

    /* Optimize buttons for large screens */
    .table .btn,
    .table .btn-icon {
        padding: 0.6rem 1rem;
        font-size: 0.95rem;
    }

    /* Form elements */
    .table .form-control {
        font-size: 0.95rem;
        padding: 0.6rem 1rem;
    }

    /* Status indicators */
    .table .status-badge,
    .table .badge {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
}

/* ===========================================
   GENERAL TABLE RESPONSIVENESS RULES
   =========================================== */

/* Ensure table containers handle overflow properly */
.table-responsive {
    position: relative;
}

/* Scrollbar customizado removido - tabelas agora se adaptam à largura */

/* Text truncation for long content */
.table .text-truncate {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive images in tables */
.table img {
    max-width: 100%;
    height: auto;
}

/* Loading states for table rows */
.table tr.loading {
    opacity: 0.6;
    pointer-events: none;
}

.table tr.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Better focus states for table elements */
.table .btn:focus,
.table .btn-icon:focus,
.table .form-control:focus {
    box-shadow: 0 0 0 2px var(--primary-light);
    outline: none;
}

/* Empty state styling */
.table-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.table-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ===========================================
   MOBILE OPTIMIZATIONS - FOCUS & KEYBOARD
   =========================================== */

/* Date fields configuration for mobile */
.date-mask,
.datepicker,
input[type="date"] {
    /* Ensure date fields work properly on mobile */
    pointer-events: auto;
    touch-action: manipulation;
    /* Allow native mobile date picker */
    -webkit-user-select: text;
    user-select: text;
}

/* Ensure date inputs use native mobile picker when Flatpickr is disabled */
@media (max-width: 768px) {
    input[type="date"] {
        /* Use HTML5 date input for better mobile experience - Flatpickr disabled on mobile */
        -webkit-appearance: none;
        appearance: none;
        padding: 0.5rem;
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius);
    }
}

/* Improve form control behavior on mobile */
.form-control {
    /* Prevent zoom on iOS when focusing inputs */
    font-size: 16px;
    /* Better touch handling */
    -webkit-touch-callout: default;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    touch-action: manipulation;
}

/* Improve button tap targets on mobile */
@media (max-width: 768px) {
    .btn {
        min-height: 44px;
        /* Apple's recommended touch target size */
        min-width: 44px;
    }

    /* Better spacing for mobile forms */
    .form-group {
        margin-bottom: 1rem;
    }

    /* Prevent horizontal scroll on mobile */
    body {
        overflow-x: hidden;
        width: 100%;
    }

    /* Specific handling for date inputs on mobile */
    .date-mask,
    .datepicker {
        /* Let mobile browsers handle date inputs natively to avoid conflicts */
        /* Flatpickr is disabled on mobile to prevent focus stealing */
        font-size: 16px !important;
        /* Prevent zoom on iOS */
    }
}

/* Ajustes gerais para responsividade */
html,
body {
    width: 100%;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}

/* Tabelas responsivas sem scroll forçado */
.table-responsive {
    overflow-x: visible;
}

.table {
    width: 100%;
}

/* Botões responsivos */
.btn {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Formulários responsivos */
.form-control {
    width: 100%;
    box-sizing: border-box;
}

/* Ensure all form elements are clickable */
input,
select,
textarea,
.form-control,
button,
.btn {
    pointer-events: auto !important;
    touch-action: manipulation;
}

/* Ensure hidden overlays don't block interactions */
.address-loading-overlay.hidden,
.loading-overlay.hidden,
.system-modal-overlay.hidden,
.sidebar-overlay:not(.visible) {
    pointer-events: none !important;
    user-select: none;
}

/* Force all form controls to be interactive */
input:not([disabled]),
select:not([disabled]),
textarea:not([disabled]),
button:not([disabled]),
.form-control:not([disabled]) {
    pointer-events: auto !important;
    cursor: pointer;
}

/* Specific fixes for select elements on mobile */
select {
    -webkit-appearance: menulist !important;
    appearance: auto !important;
    background-image: none;
    /* Ensure select is clickable */
    touch-action: manipulation;
    -webkit-touch-callout: default;
    /* Ensure proper z-index */
    position: relative;
    z-index: 1;
}

/* Ensure select options are accessible */
select option {
    pointer-events: auto;
    touch-action: manipulation;
}

/* Ensure form groups don't interfere */
.form-group {
    position: relative;
    z-index: 1;
}

/* Ensure cards don't block form interactions */
.card {
    position: relative;
    z-index: 1;
}

/* Modal responsivo */
.modal {
    margin: 10px;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
}

/* Sidebar responsivo */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1000;
        transition: transform 0.3s ease;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-overlay {
        display: block;
    }
}

/* ===========================================
   RESPONSIVE UTILITIES & GLOBAL FIXES
   =========================================== */

/* Global responsive utilities */
.w-100 {
    width: 100% !important;
}

.text-center {
    text-align: center !important;
}

.d-flex {
    display: flex !important;
}

.justify-content-center {
    justify-content: center !important;
}

.align-items-center {
    align-items: center !important;
}

/* Viewport is handled by HTML meta tag - no CSS viewport rules needed */

/* Prevent horizontal scroll globally */
html {
    overflow-x: hidden;
    width: 100%;
}

body {
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Ensure images are responsive */
img {
    max-width: 100%;
    height: auto;
}

/* Better focus handling for accessibility */
.form-control:focus,
.btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .form-control {
        border: 2px solid #000;
    }

    .btn {
        border: 2px solid #000;
    }
}

/* "Não aplicável" text styling */
.text-muted {
    color: #6c757d !important;
    font-style: italic;
}

/* Route/Client unified cell styling */
.route-client-cell {
    text-align: center;
    vertical-align: middle;
}

.route-client-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: center;
    justify-content: center;
}

.route-section,
.client-section {
    width: 100%;
    text-align: center;
    font-size: 0.85rem;
    line-height: 1.3;
}

.route-section {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 0.25rem;
    margin-bottom: 0.125rem;
}

.client-section {
    padding-top: 0.125rem;
}

/* Mobile adjustments */
@media (max-width: 768px) {

    .route-section,
    .client-section {
        font-size: 0.75rem;
        line-height: 1.2;
    }

    .route-client-container {
        gap: 0.1rem;
    }

    .route-section {
        border-bottom: 1px solid #dee2e6;
        padding-bottom: 0.125rem;
        margin-bottom: 0.0625rem;
    }

    .client-section {
        padding-top: 0.0625rem;
    }
}

/* Arrow spacing in route and client sections - consistent across all breakpoints */
.route-sep,
.client-sep {
    margin: 0 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Desktop large (≥1200px) */
@media (min-width: 1200px) {

    .route-sep,
    .client-sep {
        margin: 0 0.625rem;
    }
}

/* Desktop medium (992px-1199px) */
@media (min-width: 992px) and (max-width: 1199px) {

    .route-sep,
    .client-sep {
        margin: 0 0.5rem;
    }
}

/* Tablets (768px-991px) */
@media (min-width: 768px) and (max-width: 991px) {

    .route-sep,
    .client-sep {
        margin: 0 0.4rem;
    }
}

/* Mobile medium (577px-767px) */
@media (min-width: 577px) and (max-width: 767px) {

    .route-sep,
    .client-sep {
        margin: 0 0.35rem;
    }
}

/* Mobile small - stacked layout (≤576px) */
@media (max-width: 576px) {

    .route-sep,
    .client-sep {
        margin: 0.25rem 0;
        display: block;
        text-align: center;
    }
}

/* Filter toggle button - ensure mobile compatibility */
#toggleFilters {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    z-index: 10;
}

#toggleFilters:active {
    transform: scale(0.98);
}

/* Mobile specific adjustments for filter toggle */
@media (max-width: 991px) {
    #toggleFilters {
        min-height: 36px;
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    #filtersContainer {
        display: none;
    }
}

/* Mobile Fix: Ensure inputs don't zoom or hide keyboard on focus */
@media (max-width: 768px) {

    input[type="text"],
    input[type="number"],
    select,
    textarea,
    input[type="date"],
    input[type="password"] {
        font-size: 16px !important;
        /* Prevents iOS zoom */
        pointer-events: auto !important;
        touch-action: manipulation;
        -webkit-touch-callout: default;
    }

    .form-control {
        pointer-events: auto !important;
        touch-action: manipulation;
    }
}

/* ========================================
   12. UPLOAD DE DOCUMENTOS
   ======================================== */

.upload-container {
    margin-bottom: 2rem;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-secondary);
    position: relative;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.upload-area i {
    font-size: 2.5rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: block;
}

.upload-area .upload-text {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.upload-area .upload-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.uploaded-files-container {
    margin-top: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.uploaded-file-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    animation: fadeIn 0.3s ease-out;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.file-preview {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    object-fit: cover;
    background: var(--bg-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-preview i {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.pdf-preview i {
    color: #ef4444;
}

.file-details {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Documentos Grid (Visualização) */
.documentos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.documento-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
}

.documento-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.documento-preview {
    height: 150px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.documento-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pdf-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ef4444;
}

.documento-info {
    padding: 1rem;
}

.documento-nome {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.documento-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.documento-acoes {
    display: flex;
    gap: 0.5rem;
}

/* Upload Overlay & Progress */
.upload-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.upload-overlay.show {
    opacity: 1;
    visibility: visible;
}

.upload-overlay-content {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: var(--border-radius);
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.upload-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-muted);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    animation: spin 1s linear infinite;
}

.upload-progress {
    width: 100%;
    height: 8px;
    background: var(--bg-muted);
    border-radius: 4px;
    margin: 1.5rem 0;
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

#upload-status {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   FIM DO CSS ORGANIZADO
   ======================================== */