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

/* Forçar modo claro em todos os elementos */
*:not(.btn):not(.history-btn):not(.tab-count):not(.status-badge) {
    color-scheme: light !important;
}

:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --success-hover: #059669;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --background: #f9fafb;
    --surface: #ffffff;
    --border-color: #e5e7eb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    
    color-scheme: light !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 15px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
    color: white;
    padding: 25px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-lg);
}

.header-content h1 {
    font-size: 24px;
    margin-bottom: 5px;
    font-weight: 700;
}

.header-content .subtitle {
    font-size: 13px;
    opacity: 0.9;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-secondary:hover:not(:disabled) {
    background-color: #4b5563;
}

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

.btn-success:hover:not(:disabled) {
    background-color: var(--success-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn .icon {
    font-size: 16px;
}

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

.stat-card {
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border-left: 4px solid #3b82f6;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card h3 {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #3b82f6;
}

/* Filters */
.filters-container {
    background: #ffffff;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
    box-shadow: var(--shadow);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ALTERADO: fundo claro */
.filter-group select,
.filter-group input {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background-color: #ffffff; /* claro */
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.3s ease;
    width: 100%;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Tabs */
.tabs-container {
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

/* ALTERADO: header claro */
.tabs-header {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    background-color: #f3f4f6; /* claro */
    overflow-x: auto;
}

.tab-btn {
    flex: 1;
    padding: 16px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
}

.tab-btn:hover {
    color: var(--primary-color);
    background-color: rgba(59, 130, 246, 0.05);
}

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

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary-color);
}

.tab-count {
    background-color: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 6px;
}

/* Tab Content */
.tabs-content {
    padding: 15px;
}

.tab-content {
    display: none;
}

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

/* Table */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

/* ALTERADO: fundo cabeça claro */
.data-table thead {
    background-color: #f3f4f6; /* claro */
    border-bottom: 2px solid var(--border-color);
}

.data-table th {
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 12px;
}

.data-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

/* ALTERADO hover claro */
.data-table tbody tr:hover {
    background-color: #e5e7eb;
}

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

.data-table a {
    color: #60a5fa;
    text-decoration: underline;
}

.data-table a:hover {
    color: #93c5fd;
}

/* Status badge – ajustado para clarear */
.status-badge {
    padding: 3px 10px;
    background-color: #dbeafe; /* azul bem claro */
    color: #1e3a8a;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.history-btn {
    padding: 4px 10px;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.history-btn-filled {
    background-color: var(--success-color);
}

.history-btn-filled:hover {
    background-color: var(--success-hover);
}

.history-btn-empty {
    background-color: var(--danger-color);
    animation: pulse 2s ease-in-out infinite;
}

.history-btn-empty:hover {
    background-color: #dc2626;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

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

.modal-content {
    background-color: var(--surface);
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 18px;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #6b7280;
    transition: color 0.3s ease;
    line-height: 1;
}

.close-btn:hover {
    color: #1f2937;
}

.modal-body {
    padding: 20px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* Histórico */
.historico-list {
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
}

/* Histórico */
.historico-item {
    padding: 12px;
    background-color: #f3f4f6; /* CLARO */
    border-radius: 6px;
    margin-bottom: 8px;
    border-left: 3px solid var(--primary-color);
}

.historico-item:last-child {
    margin-bottom: 0;
}

.historico-time {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 4px;
}

.historico-text {
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-word;
}

.add-historico {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Inputs do histórico */
.add-historico textarea,
.add-historico input {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    background-color: #ffffff; /* claro */
    color: var(--text-primary);
    resize: vertical;
}

.add-historico textarea:focus,
.add-historico input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.loading-overlay.show {
    display: flex;
}

.spinner-container {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 16px 20px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 2000;
    animation: slideInUp 0.3s ease;
}

.toast.show {
    display: block;
}

.toast.success {
    background-color: var(--success-color);
}

.toast.error {
    background-color: var(--danger-color);
}

.toast.info {
    background-color: var(--primary-color);
}

@keyframes slideInUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    background-color: #ffffff;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #1f2937;
}

.empty-state p {
    font-size: 14px;
    color: #6b7280;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
    }

    .filters-container {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .tabs-header {
        overflow-x: auto;
    }

    .tab-btn {
        min-width: 120px;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px;
    }

    .modal-content {
        width: 95%;
    }

    .stats-container {
        grid-template-columns: 1fr;
    }
}