/* Reset e configurações básicas */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --c-accent: #46d643;
    --c-brand: #14A449;
    --c-brand-2: #7AB340;
    --c-dark: #094720;
    --c-soft: #DAEFBE;
    --c-white: #FFFFFF;
    --c-bg: #f7fbf4;
    --c-border: #dce8d7;
    --c-muted: #3a5b46;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--c-soft) 0%, var(--c-white) 55%, var(--c-soft) 100%);
    min-height: 100vh;
    color: var(--c-dark);
}

/* Login Page Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.brand-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.brand-logos img {
    display: block;
    height: 44px;
    width: auto;
    max-width: 170px;
}

.brand-logos--login {
    margin-bottom: 18px;
}

.brand-logos--login img {
    height: 52px;
}

.brand-logos--dashboard img {
    height: 38px;
    max-width: 160px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: var(--c-dark);
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--c-muted);
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--c-dark);
    font-size: 14px;
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid var(--c-border);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--c-brand);
}

.login-btn {
    background: var(--c-brand);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-btn:hover {
    background: var(--c-brand-2);
}

.login-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.error-message {
    background: #fee;
    color: #c53030;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #fed7d7;
    font-size: 14px;
    margin-top: 16px;
}

/* Dashboard Styles */
.dashboard-container {
    background: var(--c-bg);
    min-height: 100vh;
    padding: 20px;
}

.app-footer {
    margin-top: 18px;
    padding: 14px 10px;
    text-align: center;
    color: var(--c-muted);
    font-size: 12px;
}

.dashboard-header {
    background: white;
    padding: 16px 18px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-brand .brand-logos {
    justify-content: flex-start;
}

.header-brand .brand-logos--dashboard {
    flex-wrap: nowrap;
}

.header-left h1 {
    color: var(--c-dark);
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.header-subtitle {
    margin-top: 6px;
    color: var(--c-muted);
    font-size: 14px;
}

.action-status {
    min-height: 18px;
    font-size: 13px;
    color: var(--c-muted);
}

.action-status.success {
    color: var(--c-brand);
}

.action-status.error {
    color: #b42318;
}

.header-right {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.header-actions-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-datetime {
    font-size: 12px;
    color: var(--c-muted);
    line-height: 1.2;
    white-space: nowrap;
}

.header-logo img {
    display: block;
    height: 38px;
    width: auto;
}

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

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

.btn-primary:hover {
    background: var(--c-brand-2);
}

.btn-secondary {
    background: var(--c-soft);
    color: var(--c-dark);
}

.btn-secondary:hover {
    background: rgba(218, 239, 190, 0.8);
}

/* KPI Cards */
.kpi-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.kpi-card h3 {
    color: var(--c-muted);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.kpi-value {
    color: var(--c-dark);
    font-size: 24px;
    font-weight: 600;
}

/* Filters */
.filters-container {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

.filters-container h3 {
    color: var(--c-dark);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

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

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-actions {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 100%;
}

.btn-sm {
    padding: 8px 10px;
    font-size: 13px;
    border-radius: 8px;
}

.btn-icon-only {
    justify-content: center;
    width: 40px;
    padding-left: 0;
    padding-right: 0;
}

.btn-icon-only .btn-icon {
    width: 18px;
    height: 18px;
}

.btn.filter-active {
    position: relative;
}

.btn.filter-active::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--c-accent);
    box-shadow: 0 0 0 2px var(--c-white);
}

.filter-group label {
    font-weight: 500;
    color: var(--c-dark);
    font-size: 14px;
}

.filter-select,
.filter-input {
    padding: 8px 12px;
    border: 2px solid var(--c-border);
    border-radius: 6px;
    font-size: 14px;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--c-brand);
}

/* Charts */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.chart-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    height: 360px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chart-card h3 {
    color: var(--c-dark);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.chart-card canvas {
    flex: 1;
    min-height: 0;
    width: 100% !important;
}

/* Table */
.table-container {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.table-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.list-controls {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.list-tabs {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.list-tab.is-active {
    background: var(--c-brand);
    color: white;
}

.view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.view-toggle .is-active {
    background: var(--c-brand);
    color: white;
}

.sort-select {
    min-width: 170px;
}

.table-header h3 {
    color: var(--c-dark);
    font-size: 18px;
    font-weight: 600;
}

.table-count {
    color: var(--c-muted);
    font-size: 14px;
}

.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--c-border);
    border-radius: 8px;
}

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

.request-card {
    background: white;
    border: 1px solid var(--c-border);
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    text-align: left;
    width: 100%;
    cursor: pointer;
}

.request-card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.10);
    border-color: rgba(20, 164, 73, 0.35);
}

.request-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.request-card-title {
    color: var(--c-dark);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid var(--c-border);
    color: var(--c-dark);
    background: rgba(218, 239, 190, 0.25);
    white-space: nowrap;
}

.status-finalizado {
    background: rgba(20, 164, 73, 0.12);
    border-color: rgba(20, 164, 73, 0.35);
    color: var(--c-brand);
}

.status-cancelado {
    background: rgba(9, 71, 32, 0.10);
    border-color: rgba(9, 71, 32, 0.30);
    color: var(--c-dark);
}

.status-em-andamento {
    background: rgba(122, 179, 64, 0.16);
    border-color: rgba(122, 179, 64, 0.35);
    color: #2f5a1f;
}

.request-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
}

.request-meta-wide {
    grid-column: 1 / -1;
}

.request-meta-label {
    font-size: 11px;
    color: var(--c-muted);
    margin-bottom: 2px;
}

.request-meta-value {
    font-size: 13px;
    color: var(--c-dark);
    line-height: 1.25;
    word-break: break-word;
}

.pin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--c-border);
    background: rgba(218, 239, 190, 0.18);
    color: var(--c-dark);
    cursor: pointer;
    flex: 0 0 34px;
}

.pin-btn:hover {
    border-color: rgba(20, 164, 73, 0.35);
}

.pin-btn svg {
    width: 18px;
    height: 18px;
    display: block;
}

.pin-btn.is-pinned {
    background: rgba(20, 164, 73, 0.12);
    border-color: rgba(20, 164, 73, 0.35);
    color: var(--c-brand);
}

.table-pin-cell {
    text-align: center;
    vertical-align: middle;
}

.table-pin-cell .pin-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.data-table th {
    background: rgba(218, 239, 190, 0.4);
    padding: 9px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--c-dark);
    border-bottom: 2px solid var(--c-border);
    white-space: nowrap;
}

.data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--c-border);
    white-space: nowrap;
}

.data-table tr:hover {
    background: rgba(218, 239, 190, 0.25);
    cursor: pointer;
}

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

.no-data {
    text-align: center;
    color: var(--c-muted);
    font-style: italic;
    padding: 40px !important;
}

.table-footer {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

/* 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);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-content-sm {
    max-width: 420px;
}

.sync-modal .modal-content-sm {
    border: 1px solid var(--c-border);
}

.sync-modal .modal-header {
    padding: 16px 18px;
}

.sync-modal .modal-body {
    padding: 18px;
}

.sync-modal .modal-detail-group {
    margin-bottom: 0;
}

.sync-modal p {
    color: var(--c-dark);
    font-size: 14px;
    line-height: 1.4;
    margin: 0;
}

.sync-modal strong {
    color: var(--c-brand);
}

.export-config-modal .modal-content {
    max-width: 720px;
}

.export-config-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.export-format {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border: 1px solid var(--c-border);
    border-radius: 10px;
    background: rgba(218, 239, 190, 0.18);
}

.export-format-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--c-dark);
    cursor: pointer;
    user-select: none;
}

.export-columns {
    border: 1px solid var(--c-border);
    border-radius: 12px;
    overflow: hidden;
}

.export-columns-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: rgba(218, 239, 190, 0.35);
    border-bottom: 1px solid var(--c-border);
    color: var(--c-dark);
    font-size: 14px;
    font-weight: 600;
}

.export-columns-hint {
    font-weight: 500;
    color: var(--c-muted);
    font-size: 12px;
}

.export-columns-list {
    max-height: 300px;
    overflow: auto;
    background: white;
}

.export-col-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--c-border);
}

.export-col-item:last-child {
    border-bottom: none;
}

.export-col-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.export-col-label {
    font-size: 13px;
    color: var(--c-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.export-col-controls {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-mini {
    padding: 6px 8px;
    border-radius: 8px;
    font-size: 12px;
}

.btn-mini .btn-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

.export-config-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}

.modal-header {
    background: rgba(218, 239, 190, 0.35);
    padding: 20px 24px;
    border-bottom: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    color: var(--c-dark);
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-detail-group {
    margin-bottom: 16px;
}

.modal-detail-group h4 {
    color: #333;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.modal-detail-group p {
    color: #666;
    font-size: 14px;
    margin: 0;
}

/* Loader */
.global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loader-content {
    text-align: center;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--c-brand);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

/* Responsividade */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .header-right {
        justify-content: center;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .table-header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 24px;
    }
    
    .dashboard-container {
        padding: 12px;
    }
    
    .kpi-container {
        grid-template-columns: 1fr;
    }
}
