:root {
    --brand: #0d9488;
    --brand-dark: #0f766e;
    --brand-light: #f0fdfa;
    --bs-primary: #0d9488;
    --bs-primary-rgb: 13, 148, 136;
    --bs-link-color: #0d9488;
    --bs-link-color-rgb: 13, 148, 136;
    --bs-link-hover-color: #0f766e;
}

body {
    background: linear-gradient(180deg, var(--brand-light) 0%, #f4f6f9 320px);
    min-height: 100vh;
}

.lock-screen {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #115e59 0%, var(--brand) 55%, #2dd4bf 100%);
    padding: 1rem;
}

.lock-card {
    background: #fff;
    border-radius: 1rem;
    padding: 2rem;
    width: 100%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.lock-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--brand-light);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 1rem;
}

.pin-input {
    width: 100%;
    text-align: center;
    font-size: 2rem;
    letter-spacing: 1rem;
    padding: 0.5rem 0 0.5rem 1rem;
    border: 1px solid #ced4da;
    border-radius: 0.5rem;
}

.pin-input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 0.2rem rgba(13, 148, 136, 0.25);
}

.app-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, #115e59 0%, var(--brand) 55%, #2dd4bf 100%);
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.3);
    color: #fff;
}

.app-header h1 {
    color: #fff;
}

.app-header #serverStatus:not(.text-danger) {
    color: rgba(255, 255, 255, 0.75) !important;
}

#addExpenseBtn {
    background-color: #fff;
    border-color: #fff;
    color: var(--brand);
    font-weight: 600;
}

#addExpenseBtn:hover {
    background-color: var(--brand-light);
    border-color: var(--brand-light);
    color: var(--brand-dark);
}

.btn-primary {
    background-color: var(--brand);
    border-color: var(--brand);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--brand-dark) !important;
    border-color: var(--brand-dark) !important;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

#loadingIndicator {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.filter-search-row {
    flex-wrap: nowrap !important;
}

@media (max-width: 575.98px) {
    .app-toolbar-row {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-search-row {
        width: 100%;
    }

    .category-filter-select {
        max-width: none !important;
        flex: 0 0 38%;
        min-width: 0;
    }

    .search-group {
        max-width: none !important;
        flex: 1 1 auto;
        min-width: 0;
    }
}

.summary-card {
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chart-card {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.chart-card-header {
    background-color: var(--brand);
    color: #fff;
    font-weight: 600;
    border-bottom: none;
}

.modal-header-danger {
    background-color: #dc3545;
    color: #fff;
    border-bottom: none;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.1);
}

.summary-card-total {
    background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 100%);
    color: #fff;
    border-color: transparent;
}

.category-badge {
    color: #fff;
    font-weight: 500;
    padding: 0.4em 0.65em;
    border-radius: 999px;
}

.table-responsive {
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-top: 3px solid;
    border-image: linear-gradient(90deg, var(--brand-dark), var(--brand), #2dd4bf, #99f6e4) 1;
    overflow-x: auto;
}

#expenseTable thead {
    background-color: var(--brand-light);
}

#expenseTable thead th {
    color: var(--brand-dark);
    border-bottom-width: 1px;
}

#expenseTable thead th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

#expenseTable thead th.sortable:hover {
    color: var(--brand);
}

#expenseTable thead th .sort-icon {
    font-size: 0.75em;
    opacity: 0.4;
    margin-left: 0.25rem;
}

#expenseTable thead th.sort-active .sort-icon {
    opacity: 1;
}

.pagination .page-item.active .page-link {
    background-color: var(--brand);
    border-color: var(--brand);
}

.pagination .page-link {
    color: var(--brand);
}


#emptyState {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

@media (max-width: 576px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .toolbar {
        width: 100%;
    }
    .toolbar .btn {
        flex: 1 1 auto;
    }
}

/* Below this width, a traditional table hides the Amount/Actions columns off-screen
   with no visual hint to scroll. Switch each row to a stacked card instead so every
   field stays visible. */
@media (max-width: 575.98px) {
    #expenseTable thead {
        display: none;
    }
    #expenseTable, #expenseTable tbody, #expenseTable tr, #expenseTable td {
        display: block;
        width: 100%;
    }
    #expenseTable tr {
        margin-bottom: 0.75rem;
        border: 1px solid #dee2e6;
        border-radius: 0.5rem;
        padding: 0.5rem 0.75rem;
    }
    #expenseTable td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.75rem;
        padding: 0.4rem 0;
        border: none;
        text-align: right;
    }
    #expenseTable td:not(:last-child) {
        border-bottom: 1px solid #f1f1f1;
    }
    #expenseTable td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6c757d;
        text-align: left;
    }
}
