/* --- Estilos Globais e Reset --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    background-color: #f8f9fa; /* Um cinza muito claro */
    color: #343a40;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#root {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Estilos de Fonte --- */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: #1a202c; /* Um preto mais suave */
}

p {
    margin-top: 0;
    margin-bottom: 1rem;
    line-height: 1.6;
}

a {
    color: #0d6efd;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* --- Formulários --- */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: #4a5568;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 8px; /* Cantos mais arredondados */
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus,
.form-group input[type="number"]:focus,
.form-group input[type="date"]:focus,
.form-group select:focus {
    color: #212529;
    background-color: #fff;
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-group input[type="text"]:disabled {
    background-color: #e9ecef;
    opacity: 1;
}

/* Estilo customizado para o <select> */
.form-group select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px 12px;
}

/* --- Botões --- */
.btn-primary, .btn-secondary, .btn-danger {
    display: inline-block;
    font-weight: 500;
    line-height: 1.5;
    color: #fff;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    background-color: #0d6efd;
    border: 1px solid #0d6efd;
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    border-radius: 8px;
    transition: all 0.15s ease-in-out;
    box-shadow: 0 2px 4px rgba(0,0,0,0.07);
}
.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}
.btn-primary:disabled {
    background-color: #a0c7fa;
    border-color: #a0c7fa;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
}
.btn-secondary:hover {
    background-color: #5c636a;
    border-color: #565e64;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
}
.btn-danger:hover {
    background-color: #bb2d3b;
    border-color: #b02a37;
}


/* --- Tela de Login --- */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    background-color: #f0f2f5;
}

.login-form {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.login-form .form-header {
    text-align: center;
    margin-bottom: 2rem;
}
.login-form .form-header h2 {
    margin: 0;
    font-size: 1.8rem;
    color: #1a202c;
}
.login-form .form-header p {
    margin: 0.25rem 0 0;
    font-size: 1rem;
    color: #718096;
}

.btn-login {
    width: 100%;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    background-color: #0d6efd;
    border: 1px solid #0d6efd;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    margin-top: 1rem;
}
.btn-login:hover {
    background-color: #0b5ed7;
}
.btn-login:disabled {
    background-color: #a0c7fa;
    cursor: not-allowed;
}

/* --- Mensagens de Feedback --- */
.error-message, .success-message, .loading-message {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
}
.error-message {
    color: #842029;
    background-color: #f8d7da;
    border: 1px solid #f5c2c7;
}
.success-message {
    color: #0f5132;
    background-color: #d1e7dd;
    border: 1px solid #badbcc;
}
.loading-message {
    text-align: center;
    padding: 2rem;
    font-size: 1.1rem;
    color: #4a5568;
}

/* --- Layout do Dashboard --- */
.dashboard-screen {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: #1a202c; /* Azul escuro/preto */
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease-in-out;
}

.sidebar-header {
    padding: 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    color: #fff;
    border-bottom: 1px solid #2d3748; /* Linha sutil */
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    flex-grow: 1;
}
.sidebar-menu li {
    margin: 0;
}
.sidebar-menu li.menu-divider {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #718096; /* Cinza */
}
.sidebar-menu a {
    display: block;
    padding: 0.9rem 1.5rem;
    margin: 0.25rem 0.75rem;
    color: #cbd5e0; /* Cinza claro */
    text-decoration: none;
    font-weight: 500;
    border-radius: 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.sidebar-menu a:hover {
    background-color: #2d3748; /* Fundo mais escuro */
    color: #fff;
}
.sidebar-menu a.active {
    background-color: #0d6efd; /* Azul primário */
    color: #fff;
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #2d3748;
}
.sidebar-footer .user-info {
    font-size: 0.9rem;
    color: #a0aec0;
    margin-bottom: 0.75rem;
}
.sidebar-footer .user-info strong {
    display: block;
    color: #fff;
    font-weight: 600;
}
.btn-logout {
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    background-color: #4a5568;
    border: 1px solid #4a5568;
    color: #fff;
    cursor: pointer;
}
.btn-logout:hover {
    background-color: #718096;
}

.main-content {
    margin-left: 260px; /* Mesmo que a largura do sidebar */
    width: calc(100% - 260px);
    padding: 1.5rem 2rem;
    flex-grow: 1;
    background-color: #f8f9fa;
}

.mobile-header {
    display: none; /* Escondido por padrão */
}

/* --- Estrutura do Conteúdo (Header, Body) --- */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}
.content-header h1 {
    margin: 0;
    font-size: 1.8rem;
}

.content-body {
    background-color: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* --- CRUD: Formulário --- */
.crud-form {
    margin-bottom: 2rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 1.5rem;
}
.crud-form h3 {
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    color: #1a202c;
}

.form-grid {
    display: grid;
    gap: 1.5rem;
}
/* Layout para Produtos (4 colunas) */
.layout-produtos {
    grid-template-columns: 1fr 2fr 1fr 1fr;
    grid-template-rows: auto auto;
}
.layout-produtos .col-span-2 {
    grid-column: span 2;
}
.layout-produtos .form-actions {
    grid-column: 1 / -1; /* Ocupa todas as colunas */
    display: flex;
    gap: 0.75rem;
    justify-content: flex-start;
    margin-top: 0.5rem;
}

/* Layout para Clientes (3 colunas) */
.layout-clientes {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto auto;
}
.layout-clientes .col-span-1 {
    grid-column: span 1;
}
.layout-clientes .col-span-2 {
    grid-column: span 2;
}
.layout-clientes .form-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-start;
    margin-top: 0.5rem;
}


/* --- CRUD: Tabela de Dados --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}
.data-table th,
.data-table td {
    padding: 0.9rem 1rem;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid #e2e8f0;
}
.data-table th {
    font-size: 0.8rem;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    background-color: #f8f9fa;
}
.data-table td {
    color: #4a5568;
    font-size: 0.95rem;
}
.data-table tr:hover td {
    background-color: #fdfdfe;
}
.data-table .actions {
    text-align: right;
    white-space: nowrap;
    width: 1%;
}
.data-table .actions .btn-secondary,
.data-table .actions .btn-danger {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

/* --- Badges de Status (Pedidos) --- */
.status-badge {
    display: inline-block;
    padding: 0.3em 0.6em;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 6px;
    color: #fff;
}
.status-aguardando {
    background-color: #ffc107; /* Amarelo */
    color: #333;
}
.status-em-entrega {
    background-color: #0dcaf0; /* Azul claro */
    color: #333;
}
.status-concluido {
    background-color: #198754; /* Verde */
}
.status-cancelado {
    background-color: #dc3545; /* Vermelho */
}
.status-pago { /* Para faturas */
    background-color: #198754; /* Verde */
}


/* --- Formulário de Pedidos --- */
.add-item-form {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 1rem;
    align-items: flex-end; /* Alinha os campos e o botão */
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}
.add-item-form .form-group {
    margin-bottom: 0;
}
.add-item-form .btn-primary {
    padding: 0.75rem 1.25rem;
}

/* Tabela de Itens Adicionados no Pedido */
.items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}
.items-table th,
.items-table td {
    padding: 0.9rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}
.items-table th {
    background-color: #f8f9fa;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #718096;
}
.items-table td {
    font-size: 0.95rem;
}
.items-table .actions {
    text-align: right;
}
.items-table .btn-danger {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Resumo do Pedido */
.order-summary {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}
.total-display {
    background-color: #f8f9fa;
    border: 1px solid #e2e8f0;
    padding: 1.5rem 2rem;
    border-radius: 8px;
    text-align: right;
}
.total-display h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: #4a5568;
    font-weight: 500;
}
.total-display .total-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1a202c;
}

/* --- Página de Detalhe do Pedido --- */
.detalhe-pedido-container {
    background-color: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.detalhe-header {
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
}
.detalhe-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.detalhe-header-top h2 {
    margin: 0;
    font-size: 1.8rem;
}

.detalhe-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
}
.info-item {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
}
.info-item strong {
    display: block;
    font-size: 0.8rem;
    color: #718096;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}
.info-item span,
.info-item {
    font-size: 1rem;
    font-weight: 500;
    color: #343a40;
}
.info-item .status-badge {
    font-size: 0.9rem;
    font-weight: 600;
}

/* Layout 2 colunas */
.detalhe-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}
.detalhe-main-col {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.detalhe-side-col {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.detalhe-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background-color: #fff;
    overflow: hidden; /* Para a tabela não vazar */
}
.detalhe-card-header {
    padding: 1rem 1.5rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.detalhe-card-header h3 {
    margin: 0;
    font-size: 1.15rem;
}
.detalhe-card-body {
    padding: 1.5rem;
}
.table-container {
    overflow-x: auto; /* Tabela rolável se for pequena */
}
.tabela-detalhes {
    width: 100%;
    border-collapse: collapse;
}
.tabela-detalhes th,
.tabela-detalhes td {
    padding: 0.9rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}
.tabela-detalhes tr:last-child td {
    border-bottom: none;
}
.tabela-detalhes th {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #718096;
}
.saldo-positivo {
    color: #dc3545; /* Vermelho (falta entregar) */
    font-weight: 600;
}
.saldo-zero {
    color: #198754; /* Verde (entregue) */
    font-weight: 500;
}

/* Lista de Histórico (Entregas e Faturas) */
.lista-vazia {
    font-size: 0.95rem;
    color: #718096;
    text-align: center;
    padding: 1rem 0;
}
.lista-historico {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.item-historico {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px dashed #e2e8f0;
}
.item-historico:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.item-historico-info strong {
    display: block;
    font-weight: 600;
    color: #343a40;
    font-size: 0.95rem;
}
.item-historico-info span {
    font-size: 0.85rem;
    color: #718096;
}
.item-historico-valor {
    font-weight: 600;
    font-size: 1rem;
    color: #1a202c;
}


/* --- INÍCIO: Estilos do Modal (Pop-up) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background-color: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

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

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #1a202c;
}

.modal-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 0;
}

.modal-close-btn svg {
    width: 24px;
    height: 24px;
    color: #718096;
}
.modal-close-btn:hover svg {
    color: #1a202c;
}

.modal-body {
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 0.5rem; /* Espaço para scrollbar */
}

/* Tabela de itens dentro do modal */
.modal-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}
.modal-items-table th,
.modal-items-table td {
    padding: 0.75rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}
.modal-items-table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #718096;
}
.modal-items-table td input[type="number"] {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
}
.modal-items-table .item-saldo {
    font-size: 0.9rem;
    color: #718096;
}

.modal-footer {
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}
/* --- FIM: Estilos do Modal --- */

.item-historico {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px dashed #e2e8f0;
    gap: 0.5rem; /* <-- ADICIONE ESTA LINHA */
}

/* --- INÍCIO DA ADIÇÃO --- */
.btn-small {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 6px;
}

/* --- INÍCIO: Estilos do Dashboard --- */

.stat-card {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 12px; /* Cantos arredondados */
    box-shadow: var(--shadow-sm); /* Sombra suave */
    border: 1px solid var(--border-color);
}

.stat-card h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a5568; /* Cinza escuro */
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .stat-value {
    margin-top: 0.5rem;
    font-size: 2.25rem; /* 36px */
    font-weight: 700;
    color: #1a202c; /* Quase preto */
}

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

.chart-card {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    grid-column: span 2;
}

.chart-card h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a202c;
}

.chart-container {
    /* Altura de 300px para o gráfico */
    position: relative;
    height: 300px;
}


/* --- Responsividade (Mobile) --- */

@media (max-width: 1024px) {
    /* Em telas médias, stat cards se adaptam */
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .stat-card {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    
    .sidebar {
        /* Esconde o menu fora da tela */
        transform: translateX(-100%);
        box-shadow: 0 0 20px rgba(0,0,0,0.2);
    }
    
    .sidebar.mobile-open {
        /* Mostra o menu */
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
        padding-top: 6rem; /* Espaço para o header mobile */
    }
    
    .mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1rem 1.5rem;
        background-color: #1a202c;
        color: #fff;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 99;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }
    .mobile-header-logo {
        font-size: 1.2rem;
        font-weight: 600;
    }
    .mobile-menu-toggle {
        background: transparent;
        border: none;
        color: #fff;
        padding: 0.5rem;
        cursor: pointer;
    }
    .mobile-menu-toggle svg {
        width: 24px;
        height: 24px;
    }
    
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0,0,0,0.4);
        z-index: 99;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .content-header h1 {
        font-size: 1.5rem;
    }

    .content-body {
        padding: 1.5rem;
    }

    /* Ajusta tabelas para rolar horizontalmente */
    .data-table, .items-table, .tabela-detalhes {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }
    .data-table th, .data-table td,
    .items-table th, .items-table td,
    .tabela-detalhes th, .tabela-detalhes td {
        white-space: nowrap;
    }

    /* Ajusta formulários para 1 coluna */
    .form-grid {
        grid-template-columns: 1fr;
    }
    .layout-produtos, .layout-clientes {
        grid-template-columns: 1fr;
    }
    .layout-produtos .col-span-2,
    .layout-clientes .col-span-1,
    .layout-clientes .col-span-2 {
        grid-column: span 1;
    }
    
    .add-item-form {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Detalhe do Pedido */
    .detalhe-grid {
        grid-template-columns: 1fr;
    }
    .detalhe-info-grid {
        grid-template-columns: 1fr 1fr; /* 2 colunas no mobile */
    }
    .dashboard-grid {
        grid-template-columns: 1fr; /* Uma coluna no mobile */
    }
    
    .stat-card,
    .chart-card {
        grid-column: span 1; /* Todos ocupam 1 coluna */
    }
}

.item-historico-complexo {
    padding: 0.75rem 0;
    border-bottom: 1px dashed #e2e8f0;
}
.item-historico-complexo:last-child {
    border-bottom: none;
}

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

.item-historico-detalhes {
    padding-left: 0.5rem;
    margin-top: 0.75rem;
}

.item-historico-obs {
    font-size: 0.9rem;
    color: #4a5568;
    background-color: #f7fafc;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    margin: 0.5rem 0;
}
.item-historico-obs strong {
    color: #2d3748;
}

.item-historico-detalhes strong {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.25rem;
    display: block;
}

.item-historico-item-list {
    list-style: none;
    padding-left: 0.75rem;
    margin-top: 0.5rem;
    border-left: 3px solid #e2e8f0;
}

.item-historico-item {
    display: flex;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #4a5568;
    margin-bottom: 0.25rem;
}
.item-historico-item span:first-child {
    font-weight: 600;
    color: #1a202c;
    min-width: 30px;
}
/* --- Despesas --- */
.parcelas-section {
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

/* --- Barra de Filtros (Pedidos, Recebimentos) --- */
.filtros-bar {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* --- Badges de Vencido/Alerta --- */
.badge-vencido {
    display: inline-block;
    padding: 0.15em 0.5em;
    font-size: 0.7rem;
    font-weight: 700;
    background-color: #dc3545;
    color: #fff;
    border-radius: 4px;
    margin-left: 0.5rem;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    animation: pulse 2s infinite;
}

.badge-alerta {
    display: inline-block;
    padding: 0.15em 0.5em;
    font-size: 0.7rem;
    font-weight: 700;
    background-color: #f59e0b;
    color: #fff;
    border-radius: 4px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

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

/* --- Linhas de tabela com destaque --- */
.row-vencido {
    background-color: #fff5f5 !important;
    border-left: 3px solid #dc3545;
}
.row-vencido:hover td {
    background-color: #fee2e2 !important;
}

.row-alerta {
    background-color: #fffbeb !important;
    border-left: 3px solid #f59e0b;
}
.row-alerta:hover td {
    background-color: #fef3c7 !important;
}

/* --- Responsividade para filtros --- */
@media (max-width: 768px) {
    .filtros-bar {
        flex-direction: column;
    }
}

.parcelas-section h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #4a5568;
    font-size: 1rem;
}

textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cbd5e0;
    border-radius: 0.375rem;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    min-height: 100px;
}

textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Animações e Destaques para Parcelas */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.parcela-item {
    animation: slideIn 0.3s ease-out forwards;
    transition: all 0.3s ease;
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
}

.parcela-item:hover {
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border-color: #cbd5e0;
}

.input-destaque {
    border: 2px solid #86b7fe !important;
    background-color: #f0f7ff !important;
    font-weight: 600;
    border-radius: 8px !important;
    padding: 10px 12px !important;
    font-size: 1.05rem !important;
    height: auto !important;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.1);
}

.input-destaque:focus {
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.25) !important;
}

/* --- Modal Grande (para edição de pedido) --- */
.modal-large {
    max-width: 850px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}

/* --- Botão PDF --- */
.btn-pdf {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;
    background-color: #dc3545;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-pdf:hover {
    background-color: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.btn-pdf svg {
    width: 16px;
    height: 16px;
}

/* --- Botão Warning (Editar) --- */
.btn-warning {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;
    background-color: #f59e0b;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-warning:hover {
    background-color: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* --- Responsividade dos botões do cabeçalho de detalhe --- */
@media (max-width: 768px) {
    .detalhe-header-top {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }
    
    .detalhe-header-top > div {
        flex-wrap: wrap;
    }
    
    .modal-large {
        max-width: 100%;
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }
}
