* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f6fb;
    color: #222;
}

body.modal-open {
    overflow: hidden;
}

.container {
    max-width: 420px;

    margin: auto;

    min-height: 100vh;

    padding: 20px 20px 110px;
}

.header {
    margin-bottom: 20px;
}

.header h1 {
    text-align: center;

    font-size: 30px;
}

.sales-list {
    display: flex;

    flex-direction: column;

    gap: 15px;
}

.sale-card {
    background: white;

    border-radius: 16px;

    padding: 18px;
    padding-bottom: 8px;

    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);

    cursor: pointer;

    transition: transform 0.12s ease, box-shadow 0.12s ease,
        background 0.12s ease;

    user-select: none;

    -webkit-tap-highlight-color: transparent;
}

.sale-card:hover {
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.12);
}

.sale-card:active {
    transform: scale(0.985);

    background: #f7faff;
}

.customer {
    font-size: 20px;

    font-weight: bold;
}

.product {
    margin-top: 5px;

    color: #666;

    margin-bottom: 8px;
}

.values {
    display: grid;

    grid-template-columns: 1fr;

    gap: 8px;
}

.values div {
    display: flex;

    justify-content: space-between;

    align-items: center;
}

.values span {
    color: #777;

    font-size: 14px;
}

.values strong {
    font-size: 17px;
}

.paid {
    color: #17a34a;
}

.owed {
    color: #d32f2f;
}

.summary {
    margin-top: 25px;

    background: #0a84ff;

    color: white;

    border-radius: 18px;

    padding: 20px;

    text-align: center;

    box-shadow: 0 8px 30px rgba(10, 132, 255, 0.25);
}

.summary-title {
    font-size: 16px;

    opacity: 0.9;
}

.summary-value {
    margin-top: 8px;

    font-size: 34px;

    font-weight: bold;
}

.fab {
    position: fixed;

    left: 50%;

    bottom: 20px;

    transform: translateX(-50%);

    width: calc(100% - 40px);

    max-width: 380px;

    display: flex;

    justify-content: center;

    align-items: center;

    padding: 16px;

    border: none;

    border-radius: 16px;

    background: #0a84ff;

    color: white;

    font-size: 18px;

    font-weight: bold;

    cursor: pointer;

    box-shadow: 0 10px 30px rgba(10, 132, 255, 0.35);

    z-index: 100;
}

.fab:active {
    transform: translateX(-50%) scale(0.98);
}

.modal {
    position: fixed;

    inset: 0;

    background: rgba(0, 0, 0, 0.45);

    display: flex;

    justify-content: center;

    align-items: flex-end;

    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    width: 100%;

    max-width: 420px;

    height: 95vh;

    background: #f4f6fb;

    border-radius: 22px 22px 0 0;

    display: flex;

    flex-direction: column;

    animation: slideUp 0.25s ease;
}

.modal-header {
    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 24px;
}

.close-button {
    width: 42px;

    height: 42px;

    border: none;

    border-radius: 50%;

    background: #ececec;

    color: #444;

    font-size: 22px;

    cursor: pointer;
}

form {
    background: white;

    border-radius: 16px;

    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

label {
    display: block;

    margin-bottom: 18px;

    font-size: 15px;

    font-weight: bold;
}

input,
select,
textarea {
    width: 100%;

    margin-top: 8px;

    padding: 14px;

    border-radius: 10px;

    border: 1px solid #d7d7d7;

    font-size: 16px;

    outline: none;

    background: white;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #0a84ff;
}

textarea {
    resize: vertical;

    min-height: 100px;

    font-family: inherit;
}

button {
    width: 100%;

    display: flex;

    align-items: center;

    justify-content: center;

    gap: 10px;

    padding: 15px;

    border: none;

    border-radius: 12px;

    background: #0a84ff;

    color: white;

    font-size: 17px;

    font-weight: bold;

    cursor: pointer;
}

button:disabled {
    opacity: 0.7;

    cursor: not-allowed;
}

button:active {
    transform: scale(0.98);
}

.spinner {
    width: 18px;

    height: 18px;

    border: 3px solid rgba(255, 255, 255, 0.35);

    border-top: 3px solid white;

    border-radius: 50%;

    animation: spin 0.8s linear infinite;
}

.hidden {
    display: none;
}

.loading,
.empty {
    text-align: center;

    color: #666;

    padding: 35px 20px;
}

.toast {
    position: fixed;

    left: 50%;

    top: -100px;

    transform: translateX(-50%);

    min-width: 300px;

    max-width: 90%;

    padding: 16px 20px;

    border-radius: 12px;

    color: white;

    font-weight: bold;

    text-align: center;

    z-index: 2000;

    transition: top 0.35s ease;

    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.toast.success {
    background: #2e7d32;
}

.toast.error {
    background: #d32f2f;
}

.toast.show {
    top: 18px;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.details {
    display: flex;

    flex-direction: column;

    gap: 16px;
}

.detail-card {
    background: white;

    padding: 15px;

    border-radius: 14px;

    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

.detail-label {
    font-size: 13px;

    color: #777;

    margin-bottom: 6px;
}

.detail-value {
    font-size: 18px;

    font-weight: bold;
}

#installmentsList {
    display: flex;

    flex-direction: column;

    gap: 12px;

    margin-top: 10px;
}

.installment {
    background: white;

    border-radius: 14px;

    padding: 15px;

    display: flex;

    justify-content: space-between;

    align-items: center;

    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

.installment-left {
    display: flex;

    flex-direction: column;

    gap: 5px;
}

.installment-number {
    font-weight: bold;
}

.installment-date {
    color: #666;

    font-size: 14px;
}

.installment-value {
    color: #666;

    font-size: 15px;
}

.installment-status {
    padding: 8px 14px;

    border-radius: 20px;

    font-size: 14px;

    font-weight: bold;
}

.status-paid {
    background: #dff5e4;

    color: #2e7d32;
}

.status-pending {
    background: #fff4d6;

    color: #b26a00;
}

.modal-header {
    position: sticky;

    top: 0;

    z-index: 10;

    display: flex;

    justify-content: space-between;

    align-items: center;

    padding: 20px;

    background: #f4f6fb;

    border-bottom: 1px solid #ddd;
}

.modal-content form,
.details {
    flex: 1;

    overflow-y: auto;

    padding: 20px;
}

.delete-button {
    width: 100%;

    margin-top: 25px;

    background: #d32f2f;

    color: white;
}

.delete-button:hover {
    background: #b71c1c;
}

.secondary-button {
    background: #e5e5e5;

    color: #222;
}

.secondary-button:hover {
    background: #d4d4d4;
}

.confirm-modal {
    width: calc(100% - 40px);

    max-width: 380px;

    background: white;

    border-radius: 18px;

    padding: 24px;

    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
}

.confirm-modal h2 {
    margin-bottom: 15px;

    text-align: center;
}

.confirm-modal p {
    margin-bottom: 15px;

    text-align: center;

    line-height: 1.5;
}

.confirm-buttons {
    display: flex;

    gap: 12px;

    margin-top: 25px;
}

.confirm-buttons button {
    flex: 1;
}

.pay-button {
    width: auto;

    padding: 10px 16px;

    border: none;

    border-radius: 10px;

    background: #0a84ff;

    color: white;

    font-size: 14px;

    font-weight: bold;

    cursor: pointer;
}

.pay-button:active {
    transform: scale(0.97);
}

.installment {
    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 15px;
}

.installment-right {
    display: flex;

    flex-direction: column;

    align-items: flex-end;

    gap: 8px;
}

.installment-status {
    padding: 6px 10px;

    border-radius: 999px;

    font-size: 13px;

    font-weight: bold;

    text-align: center;
}

.status-pending {
    background: #fff4cc;

    color: #9a6700;
}

.status-paid {
    background: #dff7df;

    color: #0a7a2f;
}

.pay-button {
    width: auto;

    min-width: 150px;

    padding: 10px 14px;

    border: none;

    border-radius: 10px;

    background: #0a84ff;

    color: white;

    font-size: 14px;

    font-weight: bold;

    cursor: pointer;
}

.pay-button:disabled {
    opacity: 0.7;

    cursor: not-allowed;
}

.tabs {
    display: grid;

    grid-template-columns: repeat(6, 1fr);

    margin: 20px 0 24px;

    border-bottom: 1px solid #ddd;
}

.tabs .tab:nth-child(1),
.tabs .tab:nth-child(2),
.tabs .tab:nth-child(3) {
    grid-column: span 2;
}

.tabs .tab:nth-child(4),
.tabs .tab:nth-child(5) {
    grid-column: span 3;
}

.tab {
    flex: 1;

    text-align: center;

    padding: 6px 0;

    font-size: 16px;

    font-weight: 600;

    color: #888;

    cursor: pointer;

    transition: 0.25s;

    position: relative;

    user-select: none;
}

.tab.active {
    color: #0a84ff;
}

.tab.active::after {
    content: "";

    position: absolute;

    left: 18px;

    right: 18px;

    bottom: -1px;

    height: 3px;

    background: #0a84ff;

    border-radius: 3px 3px 0 0;
}

.tab:hover {
    color: #0a84ff;
}

.scheduled-payments {
    margin-top: 22px;

    background: white;

    border-radius: 18px;

    padding: 18px;

    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.scheduled-payments-header {
    display: flex;

    justify-content: space-between;

    align-items: flex-start;

    gap: 14px;

    margin-bottom: 18px;
}

.scheduled-payments-header h2 {
    font-size: 21px;

    margin-bottom: 5px;
}

.scheduled-payments-range {
    color: #777;

    font-size: 14px;
}

.payment-period-selector {
    width: auto;

    min-width: 105px;

    margin-top: 0;

    padding: 10px 12px;

    border: 1px solid #d7d7d7;

    border-radius: 10px;

    background: white;

    color: #222;

    font-size: 14px;

    font-weight: bold;
}

.scheduled-payments-list {
    display: flex;

    flex-direction: column;

    gap: 14px;
}

#scheduledPaymentsTotalLabel {
    margin-bottom: 10px;
}

.scheduled-payment-card {
    background: white;

    border-left: 5px solid #0a84ff;

    border-radius: 14px;

    padding: 15px;

    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.scheduled-payment-customer {
    font-size: 18px;

    font-weight: bold;
}

.scheduled-payment-product {
    margin-top: 4px;

    margin-bottom: 14px;

    color: #666;
}

.scheduled-payment-row {
    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 15px;

    margin-top: 8px;
}

.scheduled-payment-row span {
    color: #666;

    font-size: 14px;
}

.scheduled-payment-row strong {
    font-size: 15px;

    text-align: right;
}

.access-denied-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #f4f6fb;
}

.access-denied-card {
    width: 100%;
    max-width: 380px;
    padding: 32px 24px;
    background: white;
    border-radius: 18px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.access-denied-icon {
    margin-bottom: 18px;
    font-size: 52px;
}

.access-denied-card h1 {
    margin-bottom: 10px;
    font-size: 28px;
}

.access-denied-card p {
    color: #777;
    font-size: 16px;
    line-height: 1.5;
}

.scheduled-payments-total {
    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 16px;

    margin-top: 18px;

    padding-top: 18px;

    border-top: 1px solid #e5e5e5;
}

.scheduled-payments-total span {
    color: #555;

    font-size: 15px;

    font-weight: bold;
}

.scheduled-payments-total strong {
    color: #0a84ff;

    font-size: 22px;

    text-align: right;
}

.balance-eye-button svg {
    width: 22px;

    height: 22px;

    display: block;
}

.balance-eye-button {
    width: 42px;

    height: 42px;

    padding: 0;

    flex-shrink: 0;

    display: flex;

    align-items: center;

    justify-content: center;

    border: none;

    border-radius: 50%;

    background: rgba(255, 255, 255, 0.18);

    color: white;

    cursor: pointer;
}

.summary-value-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
}

.whatsapp-link {
    display: inline-flex;

    align-items: center;

    gap: 7px;

    margin-bottom: 16px;

    color: #25d366;

    font-size: 14px;

    font-weight: bold;

    text-decoration: none;
}

.whatsapp-link svg {
    width: 18px;

    height: 18px;
}

.whatsapp-link:active {
    opacity: 0.7;
}

.input-readonly {
    background: #eeeeee;

    color: #777;

    border-color: #d5d5d5;

    cursor: not-allowed;
}

.input-readonly:focus {
    border-color: #d5d5d5;
}

.search-bar {
    margin-bottom: 18px;
}

.search-bar input {
    width: 100%;

    margin: 0;

    padding: 14px 16px;

    background: white;

    border: 1px solid #ddd;

    border-radius: 14px;

    font-size: 16px;

    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.search-bar input:focus {
    border-color: #0a84ff;

    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.1);
}

.transactions-section {
    margin-bottom: 20px;
}

.transactions-toggle {
    width: 100%;

    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 0px;

    padding: 1px 2px 0px 0px;

    background: transparent;

    color: #222;

    border: none;

    border-radius: 0;

    box-shadow: none;

    font-size: 18px;

    font-weight: bold;

    text-align: left;
}

.transactions-toggle:active {
    transform: none;
}

.transactions-toggle-icon {
    font-size: 14px;

    color: #777;
}

.transactions-content {
    display: grid;

    grid-template-rows: 1fr;

    opacity: 1;

    transition: grid-template-rows 0.3s ease, opacity 0.2s ease;
}

.transactions-content > .sales-list {
    min-height: 0;

    overflow: hidden;
}

.transactions-content.collapsed {
    grid-template-rows: 0fr;

    opacity: 0;
}

.transactions-content.collapsed {
    max-height: 0;

    opacity: 0;
}

.charts-view {
    margin-top: 10px;
}

.chart-header {
    margin-bottom: 18px;
}

.chart-header h2 {
    font-size: 22px;

    margin-bottom: 5px;
}

.chart-header p {
    color: #777;

    font-size: 14px;
}

.chart-card {
    background: white;

    border-radius: 18px;

    padding: 18px;

    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.chart-container {
    position: relative;

    width: 100%;

    height: 320px;
}

.chart-total {
    display: flex;

    justify-content: space-between;

    align-items: center;

    gap: 20px;

    margin-top: 18px;

    padding: 18px;

    background: white;

    border-radius: 16px;

    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.chart-total span {
    color: #666;

    font-size: 14px;
}

.chart-total strong {
    color: #0a84ff;

    font-size: 21px;

    text-align: right;
}

.chart-section {
    margin-top: 28px;
}

.chart-section .chart-header {
    display: flex;

    justify-content: space-between;

    align-items: flex-start;

    gap: 16px;
}

.chart-period-selector {
    width: auto;

    min-width: 110px;

    margin: 0;

    padding: 9px 10px;

    border-radius: 10px;

    font-size: 14px;

    font-weight: bold;
}

.comparison-chart-container {
    height: 320px;
}

.transactions-content {
    display: grid;

    grid-template-rows: 1fr;

    opacity: 1;

    transition: grid-template-rows 0.3s ease, opacity 0.2s ease;
}

.transactions-content-inner {
    min-height: 0;

    overflow: hidden;
}

.transactions-content.collapsed {
    grid-template-rows: 0fr;

    opacity: 0;
}

.doughnut-chart-container {
    position: relative;

    width: 100%;

    height: 300px;
}

.doughnut-center {
    position: absolute;

    left: 50%;

    top: 50%;

    transform: translate(-50%, -58%);

    display: flex;

    flex-direction: column;

    align-items: center;

    text-align: center;

    pointer-events: none;
}

.doughnut-center span {
    color: #777;

    font-size: 13px;
}

.doughnut-center strong {
    margin-top: 4px;

    font-size: 20px;
}

.chart-summary-row {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 12px;

    margin-top: 14px;
}

.chart-summary-item {
    display: flex;

    flex-direction: column;

    gap: 5px;

    background: white;

    border-radius: 14px;

    padding: 15px;

    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

.chart-summary-item span {
    color: #777;

    font-size: 13px;
}

.chart-summary-item strong {
    font-size: 17px;
}

/* Top clientes */

.top-debtors-list {
    display: flex;

    flex-direction: column;

    gap: 12px;
}

.debtor-item {
    background: white;

    border-radius: 16px;

    padding: 16px;

    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

.debtor-header {
    display: flex;

    align-items: center;

    gap: 12px;
}

.debtor-position {
    width: 30px;

    height: 30px;

    flex-shrink: 0;

    display: flex;

    align-items: center;

    justify-content: center;

    border-radius: 50%;

    background: #f0f5ff;

    color: #0a84ff;

    font-size: 14px;

    font-weight: bold;
}

.debtor-info {
    min-width: 0;

    flex: 1;

    display: flex;

    flex-direction: column;
}

.debtor-info strong {
    font-size: 15px;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;
}

.debtor-info span {
    margin-top: 3px;

    color: #777;

    font-size: 12px;
}

.debtor-value {
    flex-shrink: 0;

    color: #d32f2f;

    font-size: 15px;

    font-weight: bold;
}

.debtor-bar {
    height: 7px;

    margin-top: 13px;

    background: #ececec;

    border-radius: 999px;

    overflow: hidden;
}

.debtor-bar-value {
    height: 100%;

    background: #0a84ff;

    border-radius: 999px;
}

.debtor-footer {
    margin-top: 7px;

    color: #888;

    font-size: 12px;
}

.transaction-filters {
    display: flex;

    gap: 8px;

    margin-bottom: 18px;

    overflow-x: auto;

    padding-bottom: 3px;

    scrollbar-width: none;
}

.transaction-filters::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    width: auto;

    flex-shrink: 0;

    padding: 9px 14px;

    border-radius: 999px;

    border: 1px solid #dcdcdc;

    background: white;

    color: #666;

    font-size: 12px;

    font-weight: 600;

    box-shadow: none;
}

.filter-chip:hover {
    color: #0a84ff;

    border-color: #0a84ff;
}

.filter-chip.active {
    background: #0a84ff;

    color: white;

    border-color: #0a84ff;
}

.filter-chip:active {
    transform: scale(0.97);
}

.payment-progress {
    margin-top: 8px;

    padding-top: 15px;

    border-top: 1px solid #eeeeee;
}

.payment-progress-header {
    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 8px;
}

.payment-progress-header span {
    color: #777;

    font-size: 12px;
}

.payment-progress-header strong {
    color: #555;

    font-size: 13px;
}

.payment-progress-track {
    width: 100%;

    height: 7px;

    background: #e9edf3;

    border-radius: 999px;

    overflow: hidden;
}

.payment-progress-bar {
    height: 100%;

    background: #17a34a;

    border-radius: 999px;

    transition: width 0.35s ease;
}

.tab {
    display: flex;

    align-items: center;

    justify-content: center;

    gap: 6px;
}

.tab-count {
    display: flex;

    align-items: center;

    justify-content: center;

    min-width: 21px;

    height: 21px;

    padding: 0 6px;

    border-radius: 999px;

    background: #e8edf5;

    color: #666;

    font-size: 11px;

    font-weight: bold;
}

.tab.active .tab-count {
    background: rgba(10, 132, 255, 0.12);

    color: #0a84ff;
}

.tab-overdue {
    display: flex;

    align-items: center;

    justify-content: center;

    min-width: 21px;

    height: 21px;

    padding: 0 6px;

    border-radius: 999px;

    background: #d32f2f;

    color: white;

    font-size: 11px;

    font-weight: bold;
}

.tab-overdue.hidden {
    display: none;
}

.summary-progress {
    margin-top: 18px;
}

.summary-progress-header {
    margin-bottom: 8px;

    text-align: left;
}

.summary-progress-header span {
    font-size: 13px;

    opacity: 0.9;
}

.summary-progress-track {
    width: 100%;

    height: 7px;

    overflow: hidden;

    border-radius: 999px;

    background: rgba(255, 255, 255, 0.25);
}

.summary-progress-bar {
    width: 0;

    height: 100%;

    border-radius: 999px;

    background: white;

    transition: width 0.4s ease;
}

.summary-periods {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 10px;

    margin-top: 20px;
}

.summary-period {
    display: flex;

    flex-direction: column;

    gap: 5px;

    padding: 12px;

    border-radius: 12px;

    background: rgba(255, 255, 255, 0.12);

    text-align: left;
}

.summary-period span {
    font-size: 12px;

    opacity: 0.8;
}

.summary-period strong {
    font-size: 16px;

    font-weight: bold;
}

.detail-notes {
    white-space: pre-wrap;

    line-height: 1.5;

    font-size: 15px;

    font-weight: normal;
}

.receipt-button {
    width: auto;

    min-width: 150px;

    padding: 9px 12px;

    border: 1px solid #d5dbe5;

    border-radius: 10px;

    background: white;

    color: #444;

    font-size: 13px;

    font-weight: 600;

    cursor: pointer;
}

html.dark-theme .receipt-button {
    background-color: #1c1f26;
}

.receipt-button:hover {
    background: #f5f7fa;
}

.receipt-button:active {
    transform: scale(0.97);
}

.receipt-modal {
    max-width: 380px;
}

.receipt-share-options {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 12px;

    margin: 22px 0 14px;
}

.receipt-share-button {
    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    gap: 8px;

    min-height: 90px;

    padding: 15px;

    background: white;

    color: #333;

    border: 1px solid #ddd;

    border-radius: 14px;
}

.receipt-share-button svg {
    width: 30px;

    height: 30px;
}

#shareReceiptWhatsApp svg {
    color: #25d366;
}

#shareReceiptEmail svg {
    color: #0a84ff;
}

.receipt-share-button span {
    font-size: 14px;

    font-weight: bold;
}

.receipt-share-button:hover {
    background: #f7f8fa;
}

.receipt-save-button {
    margin-bottom: 10px;
}

#closeReceiptModalButton {
    margin-top: 0;
}

.overdue-warning {
    display: flex;

    align-items: center;

    gap: 12px;

    margin: 0 0 18px;

    padding: 13px 15px;

    border: 1px solid #f3c276;

    border-radius: 12px;

    background: #fff4df;

    color: #8a5200;

    font-size: 14px;

    line-height: 1.4;

    cursor: pointer;

    user-select: none;
}

.overdue-warning:hover {
    background: #ffefd1;
}

.overdue-warning:active {
    transform: scale(0.99);
}

.overdue-warning-icon {
    display: flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;

    width: 25px;

    height: 25px;

    border-radius: 50%;

    background: #f0a733;

    color: white;

    font-weight: bold;

    font-size: 16px;
}

.overdue-warning strong {
    font-weight: bold;
}

.overdue-warning.hidden {
    display: none;
}

.customer-row {
    display: flex;

    align-items: flex-start;

    justify-content: space-between;

    gap: 12px;
}

.customer-row .customer {
    flex: 1;
}

.overdue-transaction-badge {
    flex-shrink: 0;

    padding: 6px 9px;

    border-radius: 999px;

    background: #ffe1e1;

    color: #c62828;

    font-size: 11px;

    font-weight: bold;

    white-space: nowrap;
}

.installment-labels {
    display: flex;

    align-items: center;

    justify-content: flex-end;

    gap: 6px;

    flex-wrap: wrap;
}

.status-overdue {
    background: #ffe1e1;

    color: #c62828;
}

.transaction-sort {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 12px;

    margin: 8px 0;
}

.transaction-sort label {
    margin: 0;

    color: #666;

    font-size: 13px;

    font-weight: 600;

    white-space: nowrap;
}

.transaction-sort-select {
    width: auto;

    min-width: 175px;

    margin: 0;

    padding: 5px 12px;

    border-radius: 10px;

    font-size: 14px;

    cursor: pointer;
}

.payment-progress-installments {
    margin-top: 7px;

    color: #777;

    font-size: 12px;

    text-align: right;
}

.transaction-notes-indicator {
    display: flex;

    align-items: center;

    gap: 6px;

    width: max-content;

    margin: -8px 0 14px;

    padding: 5px 9px;

    border-radius: 999px;

    background: #f1f3f7;

    color: #666;

    font-size: 11px;

    font-weight: 600;
}

.transaction-notes-indicator span {
    font-size: 13px;
}

.line-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

.undo-payment-button {
    width: auto;

    min-width: 150px;

    padding: 9px 12px;

    border: 1px solid #e1b5b5;

    border-radius: 10px;

    background: #fff5f5;

    color: #b3261e;

    font-size: 13px;

    font-weight: 600;

    cursor: pointer;
}

.undo-payment-button:hover {
    background: #ffeaea;
}

.undo-payment-button:active {
    transform: scale(0.97);
}

.app-footer {
    padding: 30px 20px 110px;

    text-align: center;
}

.app-footer a {
    color: #777;

    font-size: 13px;

    text-decoration: none;
}

.app-footer a:hover {
    color: #0a84ff;

    text-decoration: underline;
}

.history-page {
    width: 100%;

    max-width: 1100px;

    margin: auto;

    padding: 24px 20px 60px;
}

.history-header {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 20px;

    margin-bottom: 25px;
}

.history-header h1 {
    margin: 0;

    font-size: 28px;
}

.history-header p {
    margin-top: 6px;

    color: #777;
}

.history-back-button {
    width: auto;

    padding: 11px 16px;
}

.history-toolbar {
    display: flex;

    gap: 12px;

    margin-bottom: 20px;
}

.history-toolbar input {
    flex: 1;

    margin: 0;
}

.history-toolbar select {
    width: auto;

    min-width: 190px;

    margin: 0;
}

.history-table-container {
    overflow-x: auto;

    background: white;

    border-radius: 16px;

    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.07);
}

.history-table {
    width: 100%;

    border-collapse: collapse;

    min-width: 800px;
}

.history-table th,
.history-table td {
    padding: 14px 16px;

    text-align: left;

    vertical-align: top;

    border-bottom: 1px solid #eee;
}

.history-table th {
    font-size: 12px;

    color: #777;

    text-transform: uppercase;

    letter-spacing: 0.04em;

    background: #fafafa;
}

.history-table td {
    font-size: 14px;
}

.history-date {
    white-space: nowrap;

    color: #777;
}

.history-event {
    display: inline-flex;

    padding: 6px 9px;

    border-radius: 999px;

    font-size: 11px;

    font-weight: bold;

    white-space: nowrap;
}

.history-event-created {
    background: #e5f4ff;

    color: #0869a6;
}

.history-event-updated {
    background: #f2edff;

    color: #6647b8;
}

.history-event-paid {
    background: #dff7df;

    color: #137a35;
}

.history-event-undone {
    background: #fff0d8;

    color: #a45e00;
}

.history-event-deleted {
    background: #ffe3e3;

    color: #bd2929;
}

.history-details {
    line-height: 1.5;
}

.history-change {
    margin-bottom: 7px;
}

.history-change span {
    margin: 0 5px;

    color: #999;
}

.history-empty {
    padding: 40px !important;

    text-align: center !important;

    color: #777;
}

@media (max-width: 650px) {
    .history-header {
        align-items: flex-start;

        flex-direction: column;
    }

    .history-back-button {
        width: 100%;
    }

    .history-toolbar {
        flex-direction: column;
    }

    .history-toolbar select {
        width: 100%;
    }
}

.backup-section {
    margin-top: 30px;

    padding: 22px;

    background: white;

    border-radius: 16px;

    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.07);
}

.backup-header h2 {
    margin: 0;

    font-size: 20px;
}

.backup-header p {
    margin-top: 6px;

    color: #777;

    line-height: 1.5;
}

.backup-info {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 12px;

    margin: 20px 0;

    padding: 13px 15px;

    border-radius: 12px;

    background: #f5f7fa;

    font-size: 13px;
}

.backup-info span {
    color: #777;
}

.backup-info strong {
    text-align: right;
}

.backup-actions {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 12px;
}

@media (max-width: 600px) {
    .backup-actions {
        grid-template-columns: 1fr;
    }
}

.app-title-row {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 16px;
}

.app-title-row h1 {
    margin: 0;
}

.header-actions {
    display: flex;

    align-items: center;

    gap: 8px;
}

.header-icon-button {
    display: flex;

    align-items: center;

    justify-content: center;

    width: 40px;

    height: 40px;

    padding: 0;

    border-radius: 50%;

    background: #eceff3;

    color: #666;

    font-size: 18px;

    cursor: pointer;
}

.header-icon-button:hover {
    background: #dfe4ea;
}

.logout-button:hover {
    background: #ffe6e6;

    color: #b3261e;
}

.settings-link {
    position: absolute;

    right: 0;

    display: flex;

    align-items: center;

    justify-content: center;

    width: 40px;

    height: 40px;

    border-radius: 50%;

    color: #666;

    background: #eceff3;

    text-decoration: none;

    transition: 0.2s;
}

.settings-link:hover {
    background: #dfe4ea;

    color: #0a84ff;
}

.settings-link:active {
    transform: scale(0.95);
}

.settings-link svg {
    width: 18px;

    height: 18px;
}

.app-title-row {
    display: flex;

    align-items: center;

    justify-content: center;

    position: relative;
}

.settings-button {
    width: 40px;

    height: 40px;

    padding: 0;

    border-radius: 50%;

    background: #eceff3;

    color: #666;
}

.settings-button svg {
    width: 18px;

    height: 18px;
}

.settings-button:hover {
    background: #dfe4ea;

    color: #0a84ff;
}

.settings-modal-content {
    height: auto;

    max-height: 90vh;
}

.settings-modal-body {
    padding: 20px;

    overflow-y: auto;
}

.settings-group {
    margin-bottom: 24px;
}

.settings-group h3 {
    margin-bottom: 12px;

    font-size: 16px;
}

.setting-row {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 20px;

    margin: 0;

    padding: 14px 0;

    border-bottom: 1px solid #eee;
}

.setting-row > div {
    flex: 1;
}

.setting-row strong {
    display: block;

    margin-bottom: 4px;

    font-size: 14px;
}

.setting-row span {
    display: block;

    color: #777;

    font-size: 12px;

    line-height: 1.4;
}

.setting-row input {
    width: 20px;

    height: 20px;

    margin: 0;

    flex-shrink: 0;
}

.settings-field {
    margin-bottom: 16px;
}

.settings-field select {
    margin-top: 8px;
}

.settings-reset-button {
    margin-top: 10px;
}

/* =========================================================
   LOGIN
   ========================================================= */

.login-page {
    min-height: 100vh;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 24px;
}

.login-container {
    width: 100%;

    max-width: 420px;
}

.login-card {
    padding: 32px 26px;

    background: #fff;

    border-radius: 20px;

    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

.login-brand {
    text-align: center;

    margin-bottom: 30px;
}

.login-logo {
    font-size: 42px;

    margin-bottom: 10px;
}

.login-brand h1 {
    margin: 0;

    font-size: 26px;
}

.login-brand p {
    margin: 8px 0 0;

    color: #777;

    font-size: 14px;
}

.login-form {
    display: flex;

    flex-direction: column;

    gap: 18px;
}

.login-form label {
    margin: 0;
}

.login-form label span {
    display: block;

    margin-bottom: 7px;

    font-size: 13px;

    font-weight: 600;
}

.login-form input {
    width: 100%;

    box-sizing: border-box;
}

.login-error {
    padding: 12px 14px;

    border-radius: 10px;

    background: #fff0f0;

    color: #c62828;

    font-size: 13px;

    text-align: center;
}

.login-footer {
    margin-top: 24px;

    padding-top: 20px;

    border-top: 1px solid #eee;

    color: #999;

    font-size: 11px;

    text-align: center;
}

@media (max-width: 850px) {
    .navbar-inner {
        flex-wrap: wrap;
        padding: 12px 0;
    }

    .nav-links {
        width: 100%;

        display: flex;
        align-items: center;
        justify-content: space-between;

        gap: 10px;
    }

    .nav-links a {
        display: block;

        font-size: 13px;

        white-space: nowrap;
    }

    .nav-login {
        padding: 8px 12px;
    }
}

@media (max-width: 520px) {
    .navbar-inner {
        gap: 10px;
    }

    .brand {
        width: 100%;
        justify-content: center;
    }

    .nav-links {
        gap: 5px;
    }

    .nav-links a {
        font-size: 12px;
    }

    .nav-login {
        padding: 7px 10px;
    }
}

@media (max-width: 600px) {
    .comparison-wrapper {
        position: relative;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .comparison-table {
        min-width: 560px;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 10px 8px;
        font-size: 11px;
    }

    .comparison-table th:first-child,
    .comparison-table td:first-child {
        min-width: 170px;
    }
}

.comparison-scroll-hint {
    display: none;
}

@media (max-width: 600px) {
    .comparison-scroll-hint {
        display: block;

        margin-bottom: 10px;

        color: #667085;

        font-size: 11px;

        font-weight: 600;

        text-align: center;
    }
}

.comparison-wrapper {
    position: relative;
}

@media (max-width: 600px) {
    .comparison-wrapper::after {
        content: "";

        position: sticky;

        right: 0;

        display: block;

        width: 28px;

        height: 100%;

        pointer-events: none;

        background: linear-gradient(
            to right,
            transparent,
            rgba(255, 255, 255, 0.95)
        );
    }
}

.comparison-scroll-shell {
    position: relative;
}

@media (max-width: 600px) {
    .comparison-scroll-shell::after {
        content: "";

        position: absolute;

        top: 0;
        right: 0;
        bottom: 0;

        width: 32px;

        pointer-events: none;

        background: linear-gradient(
            to right,
            transparent,
            rgba(255, 255, 255, 0.96)
        );
    }
}

/* FIX: transaction list must not be truncated when expanded */

.transactions-content:not(.collapsed) {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
}

.transactions-content-inner {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
}

.sales-list {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
}

.transactions-content.collapsed {
    max-height: 0 !important;
    overflow: hidden !important;
}

/* =========================================================
   DARK THEME
   ========================================================= */

html.dark-theme {
    color-scheme: dark;
}

html.dark-theme body {
    background: #111318;
    color: #e8eaf0;
}

/*
 * =========================================================
 * MAIN STRUCTURE
 * =========================================================
 */

html.dark-theme .container {
    color: #e8eaf0;
}

html.dark-theme .header {
    color: #f3f4f6;
}

/*
 * =========================================================
 * HEADER BUTTONS
 * =========================================================
 */

html.dark-theme .header-icon-button {
    background: #23262e;
    color: #d9dde7;
}

html.dark-theme .header-icon-button:hover {
    background: #30343e;
}

html.dark-theme .logout-button:hover {
    background: #4a2428;
    color: #ff999f;
}

/*
 * =========================================================
 * TABS
 * =========================================================
 */

html.dark-theme .tabs {
    border-color: #30343e;
}

html.dark-theme .tab {
    color: #9ea5b3;
}

html.dark-theme .tab:hover {
    color: #e7e9ee;
}

html.dark-theme .tab.active {
    color: #7da7ff;
}

html.dark-theme .tab-count {
    background: #2b303a;
    color: #cdd2dc;
}

/*
 * =========================================================
 * SEARCH / INPUTS / SELECTS / TEXTAREA
 * =========================================================
 */

html.dark-theme input,
html.dark-theme select,
html.dark-theme textarea {
    background: #1c1f26;
    color: #e7e9ef;
    border-color: #343945;
}

html.dark-theme input::placeholder,
html.dark-theme textarea::placeholder {
    color: #737b89;
}

html.dark-theme input:focus,
html.dark-theme select:focus,
html.dark-theme textarea:focus {
    border-color: #648fff;
    box-shadow: 0 0 0 3px rgba(100, 143, 255, 0.12);
}

/*
 * =========================================================
 * TRANSACTION FILTER CHIPS
 * =========================================================
 */

html.dark-theme .filter-chip {
    background: #23262e;
    color: #b8bec9;
    border-color: #343945;
}

html.dark-theme .filter-chip:hover {
    background: #2c3039;
}

html.dark-theme .filter-chip.active {
    background: #315fc2;
    border-color: #315fc2;
    color: white;
}

/*
 * =========================================================
 * TRANSACTION SECTION
 * =========================================================
 */

html.dark-theme .transactions-section {
    color: #e5e7eb;
}

html.dark-theme .transaction-sort label {
    color: #979eab;
}

html.dark-theme .transaction-sort-select {
    background: #1c1f26;
    color: #e6e8ec;
}

/*
 * =========================================================
 * SALE CARDS
 * =========================================================
 */

html.dark-theme .sale-card {
    background: #1b1e24;
    border-color: #2f343d;
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.25);
}

html.dark-theme .sale-card:hover {
    background: #20242b;
}

html.dark-theme .sale-card .customer {
    color: #f2f3f5;
}

html.dark-theme .sale-card .product {
    color: #979eaa;
}

html.dark-theme .sale-card .values span {
    color: #848c99;
}

html.dark-theme .sale-card .values strong {
    color: #e4e7ec;
}

html.dark-theme .sale-card .paid {
    color: #63d98a;
}

html.dark-theme .sale-card .owed {
    color: #ff8188;
}

html.dark-theme .installment {
    background-color: #22262d;
}

/*
 * =========================================================
 * PAYMENT PROGRESS
 * =========================================================
 */

html.dark-theme .payment-progress-track,
html.dark-theme .summary-progress-track {
    background: #30343d;
}

html.dark-theme .payment-progress-text,
html.dark-theme .installment-progress-text {
    color: #9ca3af;
}

/*
 * =========================================================
 * SUMMARY
 * =========================================================
 */

html.dark-theme .summary {
    background: #1b1e24;
    color: #e9ebef;

    border-color: #30343e;

    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

html.dark-theme .summary-title {
    color: #aab0bc;
}

html.dark-theme .summary-value {
    color: #f6f7f9;
}

html.dark-theme .summary-period {
    background: #22262d;
}

html.dark-theme .summary-period span {
    color: #9299a5;
}

html.dark-theme .summary-period strong {
    color: #e8eaf0;
}

html.dark-theme .balance-eye-button {
    color: #c2c7d0;
}

/*
 * =========================================================
 * SCHEDULED PAYMENTS
 * =========================================================
 */

html.dark-theme .scheduled-payments {
    background: #1b1e24;
    color: #e8eaf0;

    border-color: #30343e;

    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.22);
}

html.dark-theme .scheduled-payments-range {
    color: #9299a5;
}

html.dark-theme .scheduled-payment-card {
    background: #22262d;
    border-color: #303640;
}

html.dark-theme .scheduled-payments-total {
    border-color: #313640;
}

/*
 * =========================================================
 * OVERDUE WARNING
 * =========================================================
 */

html.dark-theme .overdue-warning {
    background: #3b2b17;
    border-color: #80551c;
    color: #f8c977;
}

html.dark-theme .overdue-warning-stat {
    background: rgba(255, 255, 255, 0.06);
}

html.dark-theme .overdue-transaction-badge {
    color: #c62828;
}

html.dark-theme .paid-label {
    color: #0a7a2f;
}

/*
 * =========================================================
 * WHATSAPP
 * =========================================================
 */

html.dark-theme .whatsapp-link {
    color: #63d98a;
}

/*
 * =========================================================
 * NOTES
 * =========================================================
 */

html.dark-theme .notes-indicator {
    color: #d0b56e;
}

/*
 * =========================================================
 * CHARTS
 * =========================================================
 */

html.dark-theme .chart-card {
    background: #1b1e24;

    border-color: #30343e;

    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.22);
}

html.dark-theme .chart-header h2 {
    color: #eceef2;
}

html.dark-theme .chart-header p {
    color: #9299a5;
}

html.dark-theme .chart-total {
    background: #1b1e24;
    border-color: #30343e;
}

html.dark-theme .chart-summary-item {
    background: #1b1e24;
    border-color: #30343e;
}

html.dark-theme .doughnut-center {
    color: #e8eaf0;
}

/*
 * =========================================================
 * TOP DEBTORS
 * =========================================================
 */

html.dark-theme .top-debtor-item {
    background: #1b1e24;
    border-color: #30343e;
}

/*
 * =========================================================
 * MODALS
 * =========================================================
 */

html.dark-theme .modal {
    background: rgba(0, 0, 0, 0.72);
}

html.dark-theme .modal-content,
html.dark-theme .confirm-modal {
    background: #1c1f26;
    color: #e9ebef;
}

html.dark-theme .modal-header {
    border-color: #313640;
    background-color: #313640;
}

html.dark-theme .modal-header h2,
html.dark-theme .confirm-modal h2 {
    color: #f1f2f4;
}

html.dark-theme .close-button {
    color: #b8bec8;
}

html.dark-theme .detail-card {
    background: #22262d;
    border-color: #30343e;
}

html.dark-theme .detail-label {
    color: #9198a4;
}

html.dark-theme .detail-value {
    color: #e8eaf0;
}

html.dark-theme .detail-notes {
    background: #22262d;
}

/*
 * =========================================================
 * SETTINGS
 * =========================================================
 */

html.dark-theme .settings-modal-content {
    background: #1c1f26;
}

html.dark-theme .settings-group {
    border-color: #313640;
}

html.dark-theme .settings-group h3 {
    color: #e7e9ed;
}

html.dark-theme .setting-row {
    border-color: #30343d;
}

html.dark-theme .setting-row strong {
    color: #e4e6ea;
}

html.dark-theme .setting-row span {
    color: #8f96a3;
}

/*
 * =========================================================
 * BUTTONS
 * =========================================================
 */

html.dark-theme .secondary-button {
    background: #292d35;
    color: #d9dde4;
    border-color: #3b414c;
}

html.dark-theme .secondary-button:hover {
    background: #343943;
}

html.dark-theme .edit-button {
    background: #25375b;
    color: #91b4ff;
}

html.dark-theme .delete-button {
    background: #56272b;
    color: #ff9a9f;
}

/*
 * =========================================================
 * RECEIPT
 * =========================================================
 */

html.dark-theme .receipt-share-button {
    background: #242830;
    color: #dfe2e7;
    border-color: #363c46;
}

html.dark-theme .receipt-save-button {
    background: #315fc2;
    color: white;
}

/*
 * =========================================================
 * EMPTY STATE
 * =========================================================
 */

html.dark-theme .empty {
    color: #858c98;
}

/*
 * =========================================================
 * FOOTER
 * =========================================================
 */

html.dark-theme .app-footer {
    color: #747c89;
}

html.dark-theme .app-footer a {
    color: #8d96a5;
}

html.dark-theme .app-footer a:hover {
    color: #7da7ff;
}

/*
 * =========================================================
 * TOAST
 * =========================================================
 */

html.dark-theme .toast {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

/*
 * =========================================================
 * SCROLLBAR
 * =========================================================
 */

html.dark-theme {
    scrollbar-color: #414751 #17191e;
}

html.dark-theme ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

html.dark-theme ::-webkit-scrollbar-track {
    background: #17191e;
}

html.dark-theme ::-webkit-scrollbar-thumb {
    background: #414751;
    border-radius: 999px;
}

html.dark-theme ::-webkit-scrollbar-thumb:hover {
    background: #555c68;
}

/* =========================================================
   DARK THEME - TEXT
   ========================================================= */

html.dark-theme span {
    color: white;
}

html.dark-theme .paid-label {
    color: #0a7a2f !important;
}

html.dark-theme .debtor-item {
    background-color: #1b1e24;
}

html.dark-theme .scheduled-payment-product {
    color: white;
}

/* HEADER NEW */
.app-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    padding: 10px 0 14px;
}

.app-brand {
    display: flex;
    align-items: center;

    gap: 12px;

    min-width: 0;
}

.app-brand-logo {
    width: 52px;
    height: 52px;

    border-radius: 14px;

    object-fit: cover;

    flex-shrink: 0;

    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.app-brand-text {
    min-width: 0;
}

.app-brand-text h1 {
    margin: 0;

    font-size: 18px;

    text-align: left;

    line-height: 1.05;
}

.app-brand-text span {
    display: block;

    margin-top: 4px;

    color: #7b8493;

    font-size: 11px;
}

.header-actions {
    display: flex;
    align-items: flex-start;

    gap: 8px;

    flex-shrink: 0;
}

.header-action-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 5px;

    width: 72px;

    padding: 7px 5px;

    border: none;

    background: transparent;

    color: #5f6876;

    cursor: pointer;
}

.header-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 38px;
    height: 38px;

    border-radius: 11px;

    background: #eceff3;

    transition: background 0.2s, color 0.2s, transform 0.15s;
}

.header-action-icon svg {
    width: 20px;
    height: 20px;
}

.header-action-label {
    max-width: 72px;

    font-size: 9px;

    font-weight: 600;

    line-height: 1.15;

    text-align: center;

    color: #737b88;
}

.header-action-button:hover .header-action-icon {
    background: #dfe4ea;

    color: #246bfd;
}

.header-action-button:active .header-action-icon {
    transform: scale(0.94);
}

.logout-button:hover .header-action-icon {
    background: #ffe5e5;

    color: #c62828;
}

@media (max-width: 600px) {
    .app-title-row {
        gap: 8px;
    }

    .app-brand {
        gap: 8px;
    }

    .app-brand-logo {
        width: 42px;
        height: 42px;

        border-radius: 11px;
    }

    .app-brand-text h1 {
        font-size: 17px;
    }

    .header-actions {
        gap: 0;
    }

    .header-action-button {
        width: 54px;

        padding: 5px 2px;
    }

    .header-action-icon {
        width: 34px;
        height: 34px;
    }

    .header-action-icon svg {
        width: 18px;
        height: 18px;
    }

    .header-action-label {
        max-width: 54px;

        font-size: 7.5px;
    }
}

html.dark-theme .app-brand-text span {
    color: #8f96a3;
}

html.dark-theme .app-brand-logo {
    border: solid 2px #393cee;
}

html.dark-theme .header-action-button {
    color: #c8cdd6;
}

html.dark-theme .header-action-icon {
    background: #23262e;

    color: #d9dde7;
}

html.dark-theme .header-action-label {
    color: #949ba7;
}

html.dark-theme .header-action-button:hover .header-action-icon {
    background: #30343e;

    color: #7da7ff;
}

html.dark-theme .logout-button:hover .header-action-icon {
    background: #4a2428;

    color: #ff999f;
}

.app-title-row {
    display: flex;
    align-items: center;

    width: 100%;

    gap: 12px;

    padding: 10px 0 14px;
}

.app-brand {
    display: flex;
    align-items: center;

    gap: 10px;

    min-width: 0;
}

.header-actions {
    display: flex;
    align-items: flex-start;

    /*
     * Push everything to the
     * right edge of the header.
     */
    margin-left: auto;

    gap: 2px;

    flex-shrink: 0;
}

.header-action-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;

    gap: 4px;

    width: 58px;

    padding: 5px 2px;

    border: 0;

    background: transparent;

    color: #5f6876;

    cursor: pointer;
}

.header-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 36px;
    height: 36px;

    border-radius: 10px;

    background: #eceff3;

    color: #596270;

    transition: background 0.2s, color 0.2s, transform 0.15s;
}

.header-action-icon svg {
    display: block;

    width: 19px;
    height: 19px;

    flex-shrink: 0;
}

.header-action-label {
    display: block;

    width: 100%;

    color: #737b88;

    font-size: 8px;

    font-weight: 600;

    line-height: 1.1;

    text-align: center;

    white-space: nowrap;
}

.header-action-button:hover .header-action-icon {
    background: #dfe4ea;

    color: #246bfd;
}

.header-action-button:active .header-action-icon {
    transform: scale(0.93);
}

.logout-button:hover .header-action-icon {
    background: #ffe5e5;

    color: #c62828;
}

@media (max-width: 600px) {
    .app-title-row {
        gap: 6px;
    }

    .app-brand-logo {
        width: 40px;
        height: 40px;

        border-radius: 10px;
    }

    .app-brand {
        gap: 7px;
    }

    .app-brand-text h1 {
        font-size: 16px;
    }

    .header-actions {
        gap: 0;

        margin-left: auto;
    }

    .header-action-button {
        width: 48px;

        padding-left: 0;
        padding-right: 0;
    }

    .header-action-icon {
        width: 32px;
        height: 32px;

        border-radius: 9px;
    }

    .header-action-icon svg {
        width: 17px;
        height: 17px;
    }

    .header-action-label {
        font-size: 6.8px;
    }
}

.scheduled-payment-card {
    cursor: pointer;

    transition: transform 0.15s ease, box-shadow 0.15s ease,
        border-color 0.15s ease;
}

.scheduled-payment-card:hover {
    transform: translateY(-1px);

    border-color: #b9c8e8;

    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.scheduled-payment-card:active {
    transform: scale(0.99);
}

.scheduled-payment-card:focus-visible {
    outline: 2px solid #246bfd;

    outline-offset: 2px;
}

html.dark-theme .scheduled-payment-card:hover {
    border-color: #4f6285;

    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
}

html.dark-theme .scheduled-payment-card:focus-visible {
    outline-color: #7da7ff;
}

.detail-actions {
    display: flex;

    gap: 10px;

    margin-bottom: 18px;
}

.detail-actions .edit-button,
.detail-actions .renegotiate-button {
    flex: 1;
}

.renegotiate-button {
    padding: 10px 14px;

    border: 1px solid #d5def1;

    border-radius: 9px;

    background: #f1f5ff;

    color: #315fc2;

    font-weight: 700;

    cursor: pointer;
}

.renegotiate-button:hover {
    background: #e3ebff;
}

html.dark-theme .renegotiate-button {
    background: #263653;

    border-color: #40577f;

    color: #9bb9ff;
}

html.dark-theme .renegotiate-button:hover {
    background: #304366;
}

html.dark-theme #editTransactionForm,
html.dark-theme #renegotiateTransactionForm {
    background-color: #313640;
}

.products-view {
    width: 100%;
}

.products-header {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 16px;

    margin-bottom: 18px;
}

.products-header h2 {
    margin: 0 0 4px;

    font-size: 22px;
}

.products-header p {
    margin: 0;

    color: #777;

    font-size: 14px;
}

.new-product-button {
    padding: 11px 15px;

    border: none;

    border-radius: 10px;

    background: #0a84ff;

    color: white;

    font-size: 14px;

    font-weight: 700;

    cursor: pointer;
}

.new-product-button:hover {
    opacity: 0.9;
}

.products-table-container {
    overflow: hidden;

    background: white;

    border-radius: 16px;

    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.products-table {
    width: 100%;

    border-collapse: collapse;
}

.products-table th {
    padding: 14px 16px;

    background: #f6f7f9;

    color: #666;

    font-size: 12px;

    font-weight: 700;

    text-align: left;

    text-transform: uppercase;

    letter-spacing: 0.04em;
}

.products-table td {
    padding: 15px 16px;

    border-top: 1px solid #eee;

    font-size: 14px;

    vertical-align: middle;
}

.products-table tbody tr:first-child td {
    border-top: none;
}

.products-table tbody tr:hover {
    background: #fafbfc;
}

.products-quantity-column {
    width: 90px;

    text-align: center !important;
}

.products-actions-column {
    width: 80px;
}

.products-empty {
    padding: 32px 16px !important;

    color: #888;

    text-align: center;
}

html.dark-theme .products-header p {
    color: #9ca7b8;
}

html.dark-theme .products-table-container {
    background: #171b22;
}

html.dark-theme .products-table th {
    background: #1d222b;

    color: #9ca7b8;
}

html.dark-theme .products-table td {
    border-color: #2a303a;
}

html.dark-theme .products-table tbody tr:hover {
    background: #1b2028;
}

html.dark-theme .products-empty {
    color: #9ca7b8;
}

.product-name-cell {
    font-weight: 600;
}

.product-quantity-cell {
    width: 90px;

    text-align: center;

    font-variant-numeric: tabular-nums;
}

.product-actions-cell {
    width: 80px;

    text-align: right;
}

.product-edit-button {
    padding: 7px 11px;

    border: 1px solid #d6dbe3;

    border-radius: 8px;

    background: #fff;

    color: #333;

    font-size: 13px;

    font-weight: 600;

    cursor: pointer;

    transition: background 0.15s ease, border-color 0.15s ease;
}

.product-edit-button:hover {
    background: #f4f6f8;

    border-color: #c3c9d2;
}

.products-error {
    color: #c62828;
}

html.dark-theme .product-edit-button {
    border-color: #343b47;

    background: #222832;

    color: #e5e9ef;
}

html.dark-theme .product-edit-button:hover {
    background: #29313c;

    border-color: #46505f;
}

html.dark-theme .products-error {
    color: #ff7b7b;
}

.product-modal-content {
    width: min(520px, calc(100% - 24px));
}

.product-form-row {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 12px;
}

#productForm textarea {
    width: 100%;

    resize: vertical;
}

.form-error {
    margin-top: 10px;

    padding: 10px 12px;

    border-radius: 8px;

    background: #fff1f1;

    color: #b42318;

    font-size: 13px;
}

html.dark-theme .form-error {
    background: #351b1b;

    color: #ff9898;
}

@media (max-width: 520px) {
    .product-form-row {
        grid-template-columns: 1fr;
    }
}

.products-search-container {
    margin-bottom: 16px;
}

.products-search {
    width: 100%;

    height: 44px;

    padding: 0 14px;

    border: 1px solid #d9dee7;

    border-radius: 11px;

    background: #fff;

    color: #222;

    font-size: 14px;

    outline: none;

    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.products-search:focus {
    border-color: #0a84ff;

    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.12);
}

.products-search::placeholder {
    color: #999;
}

.product-stock {
    display: inline-flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    gap: 3px;

    min-width: 62px;
}

.product-stock-quantity {
    font-size: 15px;

    font-weight: 700;

    line-height: 1;
}

.product-stock-status {
    display: inline-flex;

    align-items: center;

    justify-content: center;

    padding: 3px 7px;

    border-radius: 999px;

    font-size: 9px;

    font-weight: 700;

    line-height: 1;

    white-space: nowrap;
}

/*
 * NORMAL
 */

.product-stock-normal .product-stock-quantity {
    color: #16803c;
}

.product-stock-normal .product-stock-status {
    background: #eaf8ef;

    color: #16803c;
}

/*
 * LOW STOCK
 */

.product-stock-low .product-stock-quantity {
    color: #b76e00;
}

.product-stock-low .product-stock-status {
    background: #fff4dc;

    color: #a66200;
}

/*
 * OUT OF STOCK
 */

.product-stock-empty .product-stock-quantity {
    color: #c62828;
}

.product-stock-empty .product-stock-status {
    background: #fdecec;

    color: #c62828;
}

.product-delete-button {
    width: 100%;

    margin-top: 18px;

    padding: 11px 15px;

    border: 1px solid #efc4c4;

    border-radius: 10px;

    background: #fff5f5;

    color: #c62828;

    font-size: 14px;

    font-weight: 700;

    cursor: pointer;
}

.product-delete-button:hover {
    background: #fdeaea;
}

html.dark-theme .products-search {
    border-color: #343b47;

    background: #171b22;

    color: #e5e9ef;
}

html.dark-theme .products-search::placeholder {
    color: #7f8a9b;
}

html.dark-theme .products-search:focus {
    border-color: #0a84ff;

    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.15);
}

html.dark-theme .product-stock-normal .product-stock-status {
    background: #173524;

    color: #75d895;
}

html.dark-theme .product-stock-normal .product-stock-quantity {
    color: #75d895;
}

html.dark-theme .product-stock-low .product-stock-status {
    background: #3d3018;

    color: #f4bd55;
}

html.dark-theme .product-stock-low .product-stock-quantity {
    color: #f4bd55;
}

html.dark-theme .product-stock-empty .product-stock-status {
    background: #3b2020;

    color: #ff8585;
}

html.dark-theme .product-stock-empty .product-stock-quantity {
    color: #ff8585;
}

html.dark-theme .product-delete-button {
    border-color: #643434;

    background: #321d1d;

    color: #ff8b8b;
}

html.dark-theme .product-delete-button:hover {
    background: #402323;
}

/* =========================================================
   PRODUCT MODAL
   ========================================================= */

.product-modal-content {
    width: min(540px, calc(100% - 24px));

    max-height: calc(100vh - 32px);

    overflow-y: auto;

    padding: 0;

    border-radius: 18px;

    background: #fff;

    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.18);
}

/* =========================================================
   HEADER
   ========================================================= */

.product-modal-header {
    display: flex;

    align-items: flex-start;

    justify-content: space-between;

    gap: 16px;

    padding: 22px 22px 18px;

    border-bottom: 1px solid #edf0f4;
}

.product-modal-header h2 {
    margin: 0;

    color: #20242c;

    font-size: 21px;

    font-weight: 750;
}

.product-modal-header p {
    margin: 5px 0 0;

    color: #7a8494;

    font-size: 13px;
}

.product-modal-close {
    display: flex;

    align-items: center;

    justify-content: center;

    flex-shrink: 0;

    width: 36px;

    height: 36px;

    padding: 0;

    border: none;

    border-radius: 50%;

    background: #f1f3f6;

    color: #606978;

    font-size: 16px;

    cursor: pointer;

    transition: background 0.15s ease, color 0.15s ease;
}

.product-modal-close:hover {
    background: #e5e8ed;

    color: #222;
}

/* =========================================================
   FORM
   ========================================================= */

#productForm {
    padding: 20px 22px 22px;
}

.product-form-group {
    margin-bottom: 17px;
}

.product-form-group label {
    display: block;

    margin-bottom: 7px;

    color: #343a46;

    font-size: 13px;

    font-weight: 700;
}

.product-form-group label span {
    margin-left: 3px;

    color: #929baa;

    font-size: 11px;

    font-weight: 500;
}

.product-form-group input,
.product-form-group textarea {
    width: 100%;

    box-sizing: border-box;

    border: 1px solid #d9dee7;

    border-radius: 10px;

    background: #fff;

    color: #222;

    font: inherit;

    font-size: 14px;

    outline: none;

    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.product-form-group input {
    height: 44px;

    padding: 0 12px;
}

.product-form-group textarea {
    min-height: 82px;

    padding: 11px 12px;

    resize: vertical;
}

.product-form-group input:focus,
.product-form-group textarea:focus {
    border-color: #0a84ff;

    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.11);
}

.product-form-group input::placeholder,
.product-form-group textarea::placeholder {
    color: #a7aebb;
}

/* =========================================================
   TWO-COLUMN MONEY FIELDS
   ========================================================= */

.product-form-row {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 12px;
}

.product-money-field {
    display: flex;

    align-items: center;

    height: 44px;

    overflow: hidden;

    border: 1px solid #d9dee7;

    border-radius: 10px;

    background: #fff;

    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.product-money-field:focus-within {
    border-color: #0a84ff;

    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.11);
}

.product-money-field span {
    padding-left: 12px;

    color: #7d8797;

    font-size: 13px;

    font-weight: 700;
}

.product-money-field input {
    flex: 1;

    height: 42px;

    min-width: 0;

    padding-left: 7px;

    border: none;

    box-shadow: none;
}

.product-money-field input:focus {
    border: none;

    box-shadow: none;
}

/* =========================================================
   FORM ERROR
   ========================================================= */

.product-form-error {
    margin-bottom: 15px;

    padding: 10px 12px;

    border-radius: 9px;

    background: #fff0f0;

    color: #b42318;

    font-size: 13px;
}

/* =========================================================
   DELETE
   ========================================================= */

.product-delete-button {
    width: 100%;

    margin: 2px 0 18px;

    padding: 11px 14px;

    border: 1px solid #efcccc;

    border-radius: 10px;

    background: #fff7f7;

    color: #c62828;

    font-size: 13px;

    font-weight: 700;

    cursor: pointer;

    transition: background 0.15s ease, border-color 0.15s ease;
}

.product-delete-button:hover {
    border-color: #e7b3b3;

    background: #ffeded;
}

/* =========================================================
   ACTIONS
   ========================================================= */

.product-modal-actions {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 10px;

    padding-top: 3px;
}

.product-cancel-button,
.product-save-button {
    min-height: 44px;

    padding: 10px 14px;

    border-radius: 10px;

    font-size: 14px;

    font-weight: 700;

    cursor: pointer;

    transition: opacity 0.15s ease, background 0.15s ease;
}

.product-cancel-button {
    border: 1px solid #d9dee7;

    background: #fff;

    color: #4b5565;
}

.product-cancel-button:hover {
    background: #f5f7f9;
}

.product-save-button {
    border: none;

    background: #0a84ff;

    color: #fff;
}

.product-save-button:hover {
    background: #0077e6;
}

.product-save-button:disabled {
    cursor: default;

    opacity: 0.6;
}

@media (max-width: 520px) {
    .product-modal-content {
        width: calc(100% - 20px);

        max-height: calc(100vh - 20px);

        border-radius: 16px;
    }

    .product-modal-header {
        padding: 18px 18px 15px;
    }

    #productForm {
        padding: 17px 18px 18px;
    }

    .product-form-row {
        grid-template-columns: 1fr;
    }

    .product-modal-actions {
        grid-template-columns: 1fr 1fr;
    }
}

/* =========================================================
   PRODUCT MODAL - DARK
   ========================================================= */

html.dark-theme .product-modal-content {
    background: #171b22;
}

html.dark-theme .product-modal-header {
    border-color: #2a303a;
}

html.dark-theme .product-modal-header h2 {
    color: #f0f3f7;
}

html.dark-theme .product-modal-header p {
    color: #8f9aaa;
}

html.dark-theme .product-modal-close {
    background: #252b34;

    color: #adb6c4;
}

html.dark-theme .product-modal-close:hover {
    background: #303741;

    color: #fff;
}

html.dark-theme .product-form-group label {
    color: #dce2ea;
}

html.dark-theme .product-form-group label span {
    color: #7f8997;
}

html.dark-theme .product-form-group input,
html.dark-theme .product-form-group textarea {
    border-color: #343b47;

    background: #1d222b;

    color: #edf1f6;
}

html.dark-theme .product-form-group input::placeholder,
html.dark-theme .product-form-group textarea::placeholder {
    color: #687383;
}

html.dark-theme .product-money-field {
    border-color: #343b47;

    background: #1d222b;
}

html.dark-theme .product-money-field span {
    color: #929dad;
}

html.dark-theme .product-money-field input {
    background: transparent;
}

html.dark-theme .product-form-error {
    background: #351b1b;

    color: #ff9898;
}

html.dark-theme .product-cancel-button {
    border-color: #343b47;

    background: #222832;

    color: #dce2ea;
}

html.dark-theme .product-cancel-button:hover {
    background: #2a313c;
}

html.dark-theme .product-delete-button {
    border-color: #643434;

    background: #321d1d;

    color: #ff8b8b;
}

html.dark-theme .product-delete-button:hover {
    background: #402323;
}

/* =========================================================
   SALE PRODUCTS
   ========================================================= */

.sale-products-control {
    margin-bottom: 18px;
}

.sale-products-control > label {
    margin-bottom: 8px;
}

.sale-products-list {
    display: flex;

    flex-direction: column;

    gap: 8px;

    margin-bottom: 10px;
}

.sale-product-item {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        70px
        34px;

    align-items: center;

    gap: 8px;

    padding: 9px 10px;

    border: 1px solid #dfe3e8;

    border-radius: 10px;

    background: #f7f9fb;
}

.sale-product-item-name {
    overflow: hidden;

    color: #252a33;

    font-size: 14px;

    font-weight: 700;

    text-overflow: ellipsis;

    white-space: nowrap;
}

.sale-product-item-quantity {
    width: 70px;

    height: 34px;

    margin: 0;

    padding: 5px 7px;

    text-align: center;
}

.sale-product-item-remove {
    width: 34px;

    height: 34px;

    padding: 0;

    border-radius: 50%;

    background: #eceff3;

    color: #555;

    font-size: 21px;

    line-height: 1;
}

.sale-product-item-remove:hover {
    background: #fdeaea;

    color: #c62828;
}

/* =========================================================
   PRODUCT PICKER
   ========================================================= */

.sale-product-picker {
    position: relative;

    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        44px;

    gap: 8px;
}

.sale-product-search-wrapper {
    position: relative;
}

.sale-product-search-wrapper input {
    margin: 0;

    padding-right: 42px;
}

.sale-product-add-button {
    width: 44px;

    height: 48px;

    padding: 0;

    border-radius: 10px;

    font-size: 22px;
}

.product-search-spinner {
    position: absolute;

    top: 50%;

    right: 13px;

    width: 17px;

    height: 17px;

    margin-top: -8.5px;

    border: 2px solid #d5dae2;

    border-top-color: #0a84ff;

    border-radius: 50%;

    animation: spin 0.7s linear infinite;
}

.sale-product-suggestions {
    position: absolute;

    top: calc(100% + 6px);

    left: 0;

    right: 52px;

    z-index: 50;

    max-height: 240px;

    overflow-y: auto;

    border: 1px solid #dce1e8;

    border-radius: 11px;

    background: white;

    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.sale-product-suggestion {
    width: 100%;

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 12px;

    padding: 11px 13px;

    border-radius: 0;

    background: white;

    color: #252a33;

    text-align: left;
}

.sale-product-suggestion + .sale-product-suggestion {
    border-top: 1px solid #edf0f4;
}

.sale-product-suggestion:hover {
    background: #f5f7fa;
}

.sale-product-suggestion-name {
    flex: 1;

    overflow: hidden;

    font-size: 14px;

    font-weight: 700;

    text-overflow: ellipsis;

    white-space: nowrap;
}

.sale-product-suggestion small {
    color: #16803c;

    font-size: 11px;

    white-space: nowrap;
}

.sale-product-suggestion small.low-stock {
    color: #a66200;
}

.sale-product-suggestion small.out-of-stock {
    color: #c62828;
}

.sale-product-help {
    display: block;

    margin-top: 7px;

    color: #828b99;

    font-size: 11px;

    line-height: 1.4;
}

/* =========================================================
   EDIT INVENTORY WARNING
   ========================================================= */

.edit-inventory-warning {
    display: flex;

    flex-direction: column;

    gap: 4px;

    margin-bottom: 18px;

    padding: 12px 14px;

    border: 1px solid #f0cf8b;

    border-radius: 10px;

    background: #fff8e7;

    color: #70510b;

    font-size: 12px;

    line-height: 1.4;
}

.edit-inventory-warning strong {
    font-size: 13px;
}

/* =========================================================
   INVENTORY CONFIRMATION
   ========================================================= */

.inventory-warning-list {
    display: flex;

    flex-direction: column;

    gap: 7px;

    margin: 14px 0;
}

.inventory-warning-item {
    padding: 9px 10px;

    border-radius: 8px;

    background: #fff4e5;

    color: #79530b;

    font-size: 12px;

    text-align: left;
}

/* =========================================================
   DARK
   ========================================================= */

html.dark-theme .sale-product-item {
    border-color: #343b47;

    background: #20262f;
}

html.dark-theme .sale-product-item-name {
    color: #e7ebf1;
}

html.dark-theme .sale-product-item-remove {
    background: #303741;

    color: #c4ccd7;
}

html.dark-theme .sale-product-suggestions {
    border-color: #343b47;

    background: #1d222b;
}

html.dark-theme .sale-product-suggestion {
    background: #1d222b;

    color: #e7ebf1;
}

html.dark-theme .sale-product-suggestion + .sale-product-suggestion {
    border-color: #303741;
}

html.dark-theme .sale-product-suggestion:hover {
    background: #252c36;
}

html.dark-theme .edit-inventory-warning {
    border-color: #685322;

    background: #342b18;

    color: #e8c875;
}

html.dark-theme .inventory-warning-item {
    background: #342b18;

    color: #e8c875;
}

#editTransactionModal > .modal-content > .modal-header {
    margin-bottom:0;
}