/* =========
   BASE GERAL
   ========= */

.dsp-wrapper {
    max-width: 1100px;
    margin: 20px auto;
    padding: 10px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #1f2933;
}

.dsp-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    padding: 24px;
}

.dsp-title {
    margin: 0 0 4px;
    font-size: 1.6rem;
    font-weight: 600;
}

.dsp-subtitle {
    margin: 0 0 20px;
    color: #6b7280;
}

.dsp-top-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
    gap: 12px;
    align-items: flex-end;
}

.dsp-top-filter-status {
    max-width: 230px;
}

/* Seções */

.dsp-section {
    margin-top: 24px;
    border-top: 1px solid #e5e7eb;
    padding-top: 20px;
}

.dsp-section-title {
    margin: 0 0 12px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #111827;
}

/* =========
   FORMULÁRIOS
   ========= */

.dsp-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 14px;
}

@media (max-width: 768px) {
    .dsp-row {
        grid-template-columns: 1fr;
    }
}

.dsp-field {
    display: flex;
    flex-direction: column;
}

.dsp-label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #4b5563;
}

.dsp-input {
    width: 100%;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    padding: 8px 10px;
    font-size: 0.95rem;
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
    background-color: #f9fafb;
}

.dsp-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
    background-color: #ffffff;
}

textarea.dsp-input {
    resize: vertical;
    min-height: 70px;
}

/* Checkbox group */

.dsp-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 0;
}

.dsp-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: #374151;
    background: #f3f4f6;
    border-radius: 999px;
    padding: 4px 8px;
    border: 1px solid transparent;
    cursor: pointer;
}

.dsp-checkbox input {
    margin: 0;
}

.dsp-checkbox:hover {
    border-color: #9ca3af;
}

/* =========
   BUSCA DE CLIENTE (se usar no futuro)
   ========= */

.dsp-search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.dsp-search-input-wrap {
    flex: 1;
    position: relative;
}

.dsp-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 0.95rem;
    opacity: 0.7;
}

.dsp-search-input-wrap .dsp-input {
    padding-left: 30px;
}

/* =========
   GRID GENÉRICO
   ========= */

.dsp-grid {
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    max-height: 260px;
    overflow-y: auto;
    background: #ffffff;
}

.dsp-grid-empty {
    padding: 10px;
    font-size: 0.9rem;
    color: #6b7280;
}

/* Cabeçalho do grid base */

.dsp-grid-header {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.5fr;
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
}

.dsp-grid-header > div {
    padding: 8px 10px;
}

/* Linhas base */

.dsp-grid-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.5fr;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.15s, transform 0.05s;
}

.dsp-grid-row > div {
    padding: 8px 10px;
    border-bottom: 1px solid #f3f4f6;
}

/* Zebra */

.dsp-grid-row:nth-child(odd) {
    background-color: #ffffff;
}

.dsp-grid-row:nth-child(even) {
    background-color: #f9fafb;
}

/* Hover */

.dsp-grid-row:hover {
    background-color: #e5edff;
}

/* Selecionado */

.dsp-grid-row.selected {
    background-color: #e0ecff;
    border-left: 3px solid #6366f1;
}

/* =========
   GRID DE PEDIDOS ABERTOS
   ========= */

.dsp-grid-pedidos {
    margin-top: 8px;
    max-height: 320px;
}

.dsp-grid-header-pedidos {
    grid-template-columns: 0.7fr 2.3fr 1.6fr 1.8fr 1.3fr;
}

.dsp-grid-row-pedido {
    grid-template-columns: 0.7fr 2.3fr 1.6fr 1.8fr 1.3fr;
}

/* =========
   CLIENTE SELECIONADO
   ========= */

.dsp-selected-client {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f3f4ff;
    border: 1px solid #e0e7ff;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dsp-selected-client-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6366f1;
    font-weight: 600;
}

.dsp-selected-client-info {
    font-size: 0.95rem;
    font-weight: 500;
    color: #111827;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.dsp-selected-client-nome {
    font-weight: 600;
}

.dsp-selected-client-bairro {
    color: #4b5563;
}

.dsp-selected-client-fone {
    color: #2563eb;
}

.dsp-separator {
    color: #9ca3af;
}

/* =========
   RESUMO EM LINHA DO PEDIDO
   ========= */

.dsp-resumo-top {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 16px;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.dsp-resumo-item {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.dsp-resumo-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 2px;
}

.dsp-resumo-valor {
    font-size: 0.9rem;
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 1024px) {
    .dsp-resumo-top {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .dsp-resumo-top {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* =========
   BOTÕES
   ========= */

.dsp-btn {
    border-radius: 999px;
    border: 1px solid transparent;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.dsp-btn-primary {
    background: #4f46e5;
    color: #ffffff;
    border-color: #4f46e5;
}

.dsp-btn-primary:hover {
    background: #4338ca;
    border-color: #4338ca;
    box-shadow: 0 8px 18px rgba(79, 70, 229, 0.35);
}

.dsp-btn-secondary {
    background: #e5e7eb;
    color: #111827;
    border-color: #d1d5db;
}

.dsp-btn-secondary:hover {
    background: #d1d5db;
}

.dsp-btn-ghost {
    background: transparent;
    color: #4b5563;
    border-color: #d1d5db;
}

.dsp-btn-ghost:hover {
    background: #f3f4f6;
}

.dsp-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

/* =========
   ESTADOS GERAIS
   ========= */

.dsp-hidden {
    display: none !important;
}

.dsp-disabled {
    opacity: 0.6;
    pointer-events: none;
}

.dsp-feedback {
    margin-top: 12px;
    font-size: 0.9rem;
    display: none;
}

.dsp-feedback-success {
    color: #166534;
}

.dsp-feedback-error {
    color: #b91c1c;
}

/* =========
   ENCAMINHAMENTO
   ========= */

.dsp-section-encaminhamento {
    margin-top: 24px;
}

.dsp-enc-box {
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 15px;
}

/* Campo de busca candidata */
.dsp-busca-cand-input-wrap {
    display: flex;
    gap: 8px;
    max-width: 400px;
    margin: 5px 0 8px 0;
}

/* Área com rolagem interna para lista de candidatas */
#dsp-enc-resultados-candidatas {
    max-height: 260px;
    overflow-y: auto;
}

/* Tabela candidatas */
.dsp-grid-candidatas {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.85rem;
}

.dsp-grid-candidatas th,
.dsp-grid-candidatas td {
    border: 1px solid #e5e7eb;
    padding: 4px 6px;
}

.dsp-grid-candidatas th {
    background: #f3f4f6;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: #6b7280;
}

.dsp-cand-linha:nth-child(odd) {
    background-color: #ffffff;
}

.dsp-cand-linha:nth-child(even) {
    background-color: #f9fafb;
}

.dsp-cand-linha:hover {
    background: #e5edff;
    cursor: pointer;
}

.dsp-linha-selecionada {
    background: #d0f0d0 !important;
}
