/* Shared layout styles (used by Home + PatientSearchView) */
.payment-container {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.12);
    overflow: hidden;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}
.payment-header {
    background: linear-gradient(135deg, #003366 0%, #004080 100%);
    color: white;
    padding: 1.25rem 1.5rem;
}
.payment-header h2 {
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 0.15rem;
}
.payment-header p {
    opacity: 0.9;
    margin-bottom: 0;
    font-size: 0.9rem;
}
.payment-body {
    padding: 1.5rem;
}

/* Shared modal styles (used by ManualWritebackModal, TerminalSelectModal) */
.modal-backdrop-custom {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    animation: modalBackdropFadeIn 0.18s ease-out;
}
.modal-dialog-custom {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalDialogPopIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes modalBackdropFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes modalDialogPopIn {
    from { opacity: 0; transform: translateY(8px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    .modal-backdrop-custom,
    .modal-dialog-custom { animation: none; }
}
.modal-header-custom {
    background: linear-gradient(135deg, #003366 0%, #004080 100%);
    color: white;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header-custom h5 {
    margin: 0;
    font-weight: 600;
}
.modal-body-custom {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}
.modal-footer-custom {
    padding: 1rem 1.25rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Shared payment-list-item styles (used by TerminalSelectModal, PatientSearchView) */
.payment-list-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}
.payment-list-item:hover {
    border-color: #004080;
    background: #f7fafc;
}
.payment-list-item.selected {
    border-color: #004080;
    background: #e6f0ff;
}
.payment-list-item .payment-info {
    flex: 1;
    margin-left: 0.75rem;
}
.payment-list-item .payment-amount {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1a202c;
}
.payment-list-item .payment-details {
    font-size: 0.8rem;
    color: #718096;
}

/* Shared encounter-panel layout (used by EncounterSelectPanel, ManagePaymentsSelectPanel, ManagePaymentsConfirmPanel) */
.encounter-panel {
    display: flex; flex-direction: column;
    max-height: calc(100dvh - 230px);
    overflow: hidden;
}
.encounter-panel-title {
    padding: 1rem 1.5rem 0.5rem; font-weight: 700; font-size: 1rem; color: #1a365d;
    flex-shrink: 0;
}
.encounter-filter {
    padding: 0.5rem 1.5rem 0.6rem; flex-shrink: 0;
}
.encounter-filter-input {
    position: relative; display: flex; align-items: center;
}
.encounter-filter-input input {
    padding-left: 2rem; padding-right: 2.25rem;
    border-radius: 999px; border: 1.5px solid #cbd5e0;
    background: #f7fbff; font-size: 0.85rem; height: 2.25rem;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.encounter-filter-input input:focus {
    border-color: #004080; background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 64, 128, 0.12);
    outline: none;
}
.encounter-filter-input input::placeholder { color: #a0aec0; }
.encounter-filter-input input::-webkit-search-cancel-button,
.encounter-filter-input input::-webkit-search-decoration,
.encounter-filter-input input::-webkit-search-results-button,
.encounter-filter-input input::-webkit-search-results-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}
.encounter-filter-input input::-ms-clear,
.encounter-filter-input input::-ms-reveal {
    display: none;
    width: 0;
    height: 0;
}
.encounter-filter-icon {
    position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%);
    color: #718096; font-size: 0.9rem; pointer-events: none;
}
.encounter-filter-clear {
    position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
    background: transparent; border: none; padding: 0.25rem;
    color: #a0aec0; cursor: pointer; font-size: 0.9rem;
    display: inline-flex; align-items: center; justify-content: center;
}
.encounter-filter-clear:hover { color: #4a5568; }

.encounter-select-all {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.6rem 1.5rem; border-bottom: 1px solid #e2e8f0;
    cursor: pointer; user-select: none; flex-shrink: 0;
}
.encounter-select-all:hover { background: #f7fbff; }
.encounter-select-all.disabled { opacity: 0.6; pointer-events: none; cursor: wait; }
.encounter-select-all .encounter-checkbox.all-checked {
    border-color: #004080; background: #004080; color: #fff;
}
.encounter-select-all .encounter-checkbox.some-checked {
    border-color: #004080; background: #004080; color: #fff;
}
.select-all-label { font-weight: 600; font-size: 0.85rem; color: #1a365d; }
.select-all-count { font-size: 0.8rem; color: #718096; margin-left: auto; }

.encounter-scroll { flex: 1 1 auto; overflow-y: auto; padding: 0.75rem 1.5rem; min-height: 0; }

.encounter-item {
    display: flex; flex-direction: column; gap: 0.6rem;
    padding: 0.85rem; border: 1.5px solid #e2e8f0; border-radius: 10px;
    margin-bottom: 0.5rem; cursor: pointer; transition: all 0.15s; user-select: none;
}
.encounter-item-top {
    display: flex; align-items: flex-start; gap: 0.75rem;
}
.encounter-item:hover { border-color: #90cdf4; background: #f7fbff; }
.encounter-item.checked { border-color: #004080; background: #ebf4ff; }
.encounter-item.expanded {
    position: relative; z-index: 1; margin-bottom: 0;
    box-shadow: 0 2px 8px rgba(0, 64, 128, 0.08);
}
.encounter-checkbox {
    width: 22px; height: 22px; border-radius: 6px; border: 2px solid #cbd5e0;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; margin-top: 2px; transition: all 0.15s;
    color: transparent; font-size: 0.75rem;
}
.encounter-item.checked .encounter-checkbox {
    border-color: #004080; background: #004080; color: #fff;
}
.encounter-item-info { flex: 1; min-width: 0; }
.encounter-item-amount { font-weight: 700; font-size: 1rem; color: #1a365d; white-space: nowrap; margin-top: 2px; }
.encounter-item-use {
    display: flex; align-items: center; justify-content: flex-end;
    gap: 0.5rem; padding-top: 0.5rem; border-top: 1px dashed #cbd5e0;
}
.encounter-item-use-label {
    font-size: 0.68rem; color: #718096; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600;
}

.encounter-running-total {
    background: #f0f4f8; border-top: 1px solid #e2e8f0;
    padding: 0.75rem 1.5rem; text-align: left; flex-shrink: 0;
}
.encounter-running-total .rt-label {
    font-size: 0.7rem; color: #718096; text-transform: uppercase; letter-spacing: 0.5px;
}
.encounter-running-total .rt-amount { font-size: 1.5rem; font-weight: 700; color: #004080; transition: all 0.2s; }
.encounter-running-total .rt-amount.has-value { color: #38a169; }

.encounter-panel-footer {
    padding: 0.75rem 1.5rem 1rem; background: #f0f4f8;
    display: flex; gap: 0.75rem; flex-shrink: 0;
}
.enc-btn-cancel {
    flex: 1; padding: 0.7rem; border: 1.5px solid #e2e8f0; border-radius: 10px;
    background: #fff; color: #4a5568; font-weight: 600; font-size: 0.9rem;
    cursor: pointer; transition: all 0.15s;
}
.enc-btn-cancel:hover { border-color: #a0aec0; background: #f7fafc; }
.enc-btn-select {
    flex: 1; padding: 0.7rem; border: none; border-radius: 10px;
    background: #004080; color: #fff; font-weight: 600; font-size: 0.9rem;
    cursor: pointer; transition: all 0.15s;
}
.enc-btn-select:hover { background: #003366; }
.enc-btn-select .count-badge {
    background: rgba(255,255,255,0.25); padding: 0.1rem 0.45rem;
    border-radius: 4px; font-size: 0.75rem; margin-left: 0.35rem;
}

/* Manage payments confirm styles */
.manage-tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.manage-tab {
    flex: 1;
    padding: 0.65rem 0.5rem;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    color: #4a5568;
    font-size: 0.85rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
}
.manage-tab.active { color: #004080; border-bottom-color: #004080; }
.manage-tab:hover:not(.active) { background: #f7fafc; }
.manage-confirm-items {
    display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem;
}
.manage-confirm-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.7rem 0.85rem;
    background: #f7fafc; border: 1px solid #e2e8f0; border-radius: 8px;
}
.manage-confirm-item-left { flex: 1; min-width: 0; }
.manage-confirm-item-title {
    font-weight: 600; font-size: 0.875rem; color: #1a202c;
    display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
}
.manage-confirm-badge {
    font-size: 0.68rem; padding: 0.1rem 0.4rem; border-radius: 4px;
    background: #e2e8f0; color: #4a5568; font-weight: 600;
}
.manage-confirm-item-sub { font-size: 0.75rem; color: #718096; margin-top: 0.15rem; }
.manage-confirm-item-amount {
    font-weight: 700; font-size: 0.95rem; color: #1a365d;
    margin-left: 1rem; white-space: nowrap;
}
.manage-confirm-total {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.65rem 0.85rem;
    background: linear-gradient(135deg, #ebf4ff 0%, #dbeafe 100%);
    border: 1.5px solid #90cdf4; border-radius: 8px;
    font-weight: 600; font-size: 0.9rem; color: #1a365d; margin-bottom: 1rem;
}
.manage-confirm-total-amount { font-size: 1.1rem; font-weight: 700; color: #004080; }
.manage-confirm-reason { display: flex; flex-direction: column; gap: 0.35rem; }
.manage-confirm-reason-label {
    font-size: 0.8rem; font-weight: 600; color: #4a5568;
    display: flex; align-items: center;
}
.manage-confirm-reason-input {
    width: 100%; padding: 0.6rem 0.75rem;
    border: 1.5px solid #cbd5e0; border-radius: 8px;
    font-size: 0.85rem; color: #2d3748; background: #f7fafc;
    resize: none; font-family: inherit; outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.manage-confirm-reason-input:focus {
    border-color: #004080; box-shadow: 0 0 0 3px rgba(0,64,128,0.1); background: #fff;
}
.manage-confirm-reason-input::placeholder { color: #a0aec0; }

.manage-pill {
    display: inline-flex; align-items: center;
    font-size: 0.72rem; font-weight: 700;
    padding: 0.2rem 0.55rem; border-radius: 999px;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.manage-pill-void        { background: #fef3c7; color: #92400e; }
.manage-pill-voidrefund  { background: #ede9fe; color: #5b21b6; }
.manage-pill-refund      { background: #dbeafe; color: #1e40af; }
.manage-pill-unavailable { background: #f1f5f9; color: #64748b; }
.manage-confirm-btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.55rem 1.25rem; border-radius: 8px;
    font-weight: 600; font-size: 0.875rem; border: none;
    cursor: pointer; transition: all 0.2s;
}
.manage-confirm-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.manage-confirm-btn-void {
    background: #c53030; color: white;
}
.manage-confirm-btn-void:hover:not(:disabled) {
    background: #9b2c2c;
}
.manage-confirm-btn-refund {
    background: #004080; color: white;
}
.manage-confirm-btn-refund:hover:not(:disabled) {
    background: #003366;
}
.manage-hint {
    font-size: 0.75rem;
    color: #718096;
    margin: 0.5rem 0 0 0;
}
