.sales-card-header {
    align-items: flex-end;
}

.sales-filters {
    display: flex;
    width: min(980px, 100%);
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.delivery-filter {
    width: 210px;
}

.sale-note {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.sale-patient {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sale-patient-name {
    font-weight: 560;
}

.sale-patient-document {
    color: var(--text-tertiary);
    font-size: 12px;
}

.payment-progress {
    display: flex;
    min-width: 110px;
    flex-direction: column;
    gap: 6px;
}

.payment-progress-text {
    color: var(--text-secondary);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.payment-progress-track {
    width: 100%;
    height: 4px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(118, 118, 128, 0.12);
}

.payment-progress-value {
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
}

.delivery-select {
    width: 165px;
    min-height: 34px;
    padding: 6px 9px;
    font-size: 12px;
}

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

.sale-fixed-date,
.expense-fixed-date {
    display: flex;
    min-height: 42px;
    padding: 8px 11px;
    justify-content: center;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-secondary);
    font-weight: 600;
}

.sale-fixed-date small,
.expense-fixed-date small {
    margin-top: 2px;
    color: var(--text-tertiary);
    font-size: 10px;
    font-weight: 400;
}

.sale-form-section {
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}

.sale-form-section:first-child {
    padding-top: 0;
}

.sale-form-section:last-of-type {
    border-bottom: 0;
}

.sale-form-section-title {
    margin: 0 0 15px;
    font-size: 14px;
    font-weight: 620;
}

.patient-search-wrapper {
    position: relative;
}

.patient-results {
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow:
        0 14px 40px rgba(0, 0, 0, 0.12);
}

.patient-result {
    display: flex;
    width: 100%;
    padding: 12px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text-primary);
    text-align: left;
}

.patient-result:last-child {
    border-bottom: 0;
}

.patient-result:hover {
    background: var(--surface-secondary);
}

.patient-result-name {
    font-weight: 560;
}

.patient-result-detail {
    color: var(--text-tertiary);
    font-size: 12px;
}

.selected-patient {
    display: none;
    margin-top: 10px;
    padding: 11px 13px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 13px;
}

.selected-patient.visible {
    display: block;
}

.payment-methods {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.payment-method {
    position: relative;
}

.payment-method input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.payment-method label {
    display: flex;
    min-height: 52px;
    padding: 0 14px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    border-radius: 11px;
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 550;
    cursor: pointer;
    transition:
        border-color var(--transition),
        background var(--transition),
        color var(--transition);
}

.payment-method input:checked + label {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.sale-summary {
    display: grid;
    margin-top: 18px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.sale-summary-item {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-secondary);
}

.sale-summary-label {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
}

.sale-summary-value {
    display: block;
    margin-top: 6px;
    font-size: 18px;
    font-weight: 620;
    font-variant-numeric: tabular-nums;
}

.sale-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.sale-detail-item {
    padding-bottom: 13px;
    border-bottom: 1px solid var(--border);
}

.sale-detail-label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-tertiary);
    font-size: 12px;
}

.sale-detail-value {
    font-weight: 550;
}

@media (max-width: 1050px) {
    .sales-card-header,
    .sales-filters {
        align-items: stretch;
        flex-direction: column;
    }

    .sales-filters {
        width: 100%;
    }

    .delivery-filter {
        width: 100%;
    }
}

@media (max-width: 720px) {
    .payment-methods,
    .sale-summary,
    .sale-detail-grid {
        grid-template-columns: 1fr;
    }

    .sales-table th:nth-child(3),
    .sales-table td:nth-child(3),
    .sales-table th:nth-child(5),
    .sales-table td:nth-child(5) {
        display: none;
    }
}

.date-filter-group {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.date-filter-field {
    display: flex;
    width: 150px;
    flex-direction: column;
    gap: 6px;
}

.date-filter-field label {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 550;
}

.date-filter-field .input {
    min-height: 38px;
}

.clear-sale-filters {
    white-space: nowrap;
}

@media (max-width: 1250px) {
    .sales-filters {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .date-filter-group {
        width: 100%;
    }
}

@media (max-width: 720px) {
    .date-filter-group {
        align-items: stretch;
        flex-direction: column;
    }

    .date-filter-field {
        width: 100%;
    }

    .clear-sale-filters {
        width: 100%;
    }
}
