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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 28px;
    margin-bottom: 5px;
}

.logo p {
    font-size: 14px;
    opacity: 0.8;
}

.user-info {
    font-size: 16px;
}

/* Cards */
.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 30px;
}

.card {
    padding: 25px;
    border-radius: 12px;
    color: white;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-5px);
}

.card-blue { background: linear-gradient(135deg, #3b5998 0%, #2d4373 100%); }
.card-green { background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%); }
.card-orange { background: linear-gradient(135deg, #fd7e14 0%, #dc6502 100%); }
.card-red { background: linear-gradient(135deg, #dc3545 0%, #bd2130 100%); }

.card-icon {
    font-size: 40px;
}

.card-content h3 {
    font-size: 14px;
    margin-bottom: 8px;
    opacity: 0.9;
}

.card-number {
    font-size: 28px;
    font-weight: bold;
}

/* Toolbar */
.toolbar {
    padding: 20px 30px;
    display: flex;
    gap: 15px;
    align-items: center;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
}

.search-box {
    flex: 1;
}

.search-box input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #2d4373;
    color: white;
}

.btn-help {
    background: #17a2b8;
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(45, 67, 115, 0.4);
    background: #3b5998;
}

.btn-help:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(23, 162, 184, 0.4);
    background: #138496;
}

/* Tabela */
.table-container {
    padding: 30px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f8f9fa;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    cursor: pointer;
    user-select: none;
    transition: background 0.3s;
}

th:hover {
    background: #e9ecef;
}

.sort-icon {
    margin-left: 5px;
    opacity: 0.5;
}

tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: background 0.3s;
}

tbody tr:hover {
    background: #f8f9fa;
}

td {
    padding: 15px;
    color: #495057;
}

/* Status */
.status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    display: inline-block;
}

.status-em-dia {
    background: #d4edda;
    color: #155724;
}

.status-vence-hoje {
    background: #fff3cd;
    color: #856404;
}

.status-atrasado {
    background: #f8d7da;
    color: #721c24;
}

/* Botões de Ação */
.action-btn {
    padding: 6px 12px;
    margin: 0 3px;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-view {
    background: #2d4373;
    color: white;
}

.btn-edit {
    background: #28a745;
    color: white;
}

.btn-view:hover, .btn-edit:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* Footer */
.footer {
    background: #f8f9fa;
    padding: 20px 30px;
    text-align: center;
    color: #6c757d;
    border-top: 1px solid #e9ecef;
}

.footer strong {
    color: #2d4373;
}

/* Responsivo */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 10px;
    }

    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 20px 15px;
    }

    .logo h1 {
        font-size: 22px;
    }

    .logo p {
        font-size: 13px;
    }

    /* Cards menores e mais compactos */
    .cards-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 15px;
    }

    .card {
        padding: 15px;
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .card-icon {
        font-size: 28px;
    }

    .card-content h3 {
        font-size: 12px;
    }

    .card-number {
        font-size: 20px;
    }

    /* Toolbar em coluna com botões maiores */
    .toolbar {
        flex-direction: column;
        padding: 15px;
        gap: 10px;
    }

    .search-box input {
        font-size: 16px; /* Evita zoom no iOS */
        padding: 14px 18px;
    }

    .btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 16px;
    }

    /* Tabela vira cards em mobile */
    .table-container {
        padding: 15px;
    }

    table {
        border-collapse: collapse;
    }

    thead {
        display: none; /* Esconde cabeçalho em mobile */
    }

    /* Cards de clientes para mobile */
    #tableBody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    #tableBody tr {
        display: flex;
        flex-direction: column;
        background: white;
        border: 1px solid #e9ecef;
        border-radius: 10px;
        padding: 15px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }

    #tableBody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid #f8f9fa;
    }

    #tableBody td:last-child {
        border-bottom: none;
        flex-direction: column;
        gap: 8px;
        margin-top: 10px;
    }

    #tableBody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6c757d;
        font-size: 13px;
    }

    #tableBody td:last-child::before {
        content: 'Ações';
        margin-bottom: 8px;
    }

    .action-btn {
        width: 100%;
        padding: 10px;
        font-size: 14px;
        margin: 0;
    }

    /* Modal responsivo */
    .modal-content {
        margin: 5% auto;
        padding: 20px;
        width: 95%;
        max-height: 90vh;
    }

    .modal-content h2 {
        font-size: 20px;
    }

    .help-section {
        padding: 15px;
    }

    .help-section h3 {
        font-size: 16px;
    }

    .help-section p,
    .help-section li {
        font-size: 14px;
    }

    .close {
        font-size: 28px;
    }

    /* Footer */
    .footer {
        padding: 15px;
        font-size: 13px;
    }
}

/* Mobile pequeno (iPhone SE, etc) */
@media (max-width: 375px) {
    .cards-container {
        grid-template-columns: 1fr;
    }

    .card-number {
        font-size: 18px;
    }

    .logo h1 {
        font-size: 20px;
    }
}

/* Modal de Ajuda */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 3% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideDown 0.3s;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    color: #2d4373;
    margin-bottom: 25px;
    font-size: 26px;
    border-bottom: 3px solid #2d4373;
    padding-bottom: 10px;
}

.help-section {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #2d4373;
}

.help-section h3 {
    color: #2d4373;
    margin-bottom: 12px;
    font-size: 18px;
}

.help-section p {
    color: #495057;
    line-height: 1.6;
    margin-bottom: 10px;
}

.help-section ul {
    margin-left: 20px;
    color: #495057;
}

.help-section li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.help-section strong {
    color: #2d4373;
}

.tip {
    background: #fff3cd;
    padding: 10px 15px;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
    margin-top: 10px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover,
.close:focus {
    color: #2d4373;
}

.modal-content .btn {
    width: 100%;
    margin-top: 20px;
    font-size: 16px;
    padding: 15px;
}

/* Melhorias de acessibilidade e UX */

/* Foco visível para navegação por teclado */
button:focus,
input:focus,
th:focus {
    outline: 3px solid #2d4373;
    outline-offset: 2px;
}

/* Área de toque mínima (44px) */
.btn,
.action-btn,
th {
    min-height: 44px;
    min-width: 44px;
}

/* Transições suaves */
* {
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

/* Melhor contraste para textos */
.info-value {
    color: #212529;
}

/* Scroll suave */
html {
    scroll-behavior: smooth;
}

/* Evitar zoom indesejado no iOS */
input[type="text"],
input[type="search"] {
    font-size: 16px;
}

/* Loading state para botões */
.btn:active {
    transform: scale(0.98);
}

/* Melhor feedback visual */
.card:active {
    transform: translateY(-3px);
}

tbody tr:active {
    background: #e9ecef;
}
