@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    /* Light Theme Variables */
    --body-bg: #f7f7f8;
    --content-bg: #ffffff;
    --sidebar-bg: #2c3e50;
    --sidebar-bg-secondary: #34495e;
    --sidebar-text-primary: #ecf0f1;
    --sidebar-text-secondary: #bdc3c7;
    --sidebar-title-text: #ffffff;
    --sidebar-border-color: #3e5369;
    --sidebar-hover-bg: #3e5369;
    --sidebar-active-bg: #4a6075;

    --primary-accent-color: #3498db;
    --primary-accent-hover-color: #2980b9;

    --header-bg: #34495e;
    --header-text: #ecf0f1;
    --header-border-accent: var(--primary-accent-color);

    --text-primary: #212529;
    --text-secondary: #5a6773;
    --text-muted: #8a9aa8;
    --text-accent: var(--primary-accent-color);
    --text-inverted: #ffffff;
    --text-danger: #ff0000;

    --border-radius-small: 4px;
    --border-radius-medium: 6px;
    --border-radius-large: 8px;

    --border-color: #e1e8ed;
    --border-light: #edf2f7;
    --border-darker: #d3d3d3;
    --border-input: #ced4da;
    --border-input-focus: var(--primary-accent-color);
    --border-filter-section: #d6eaf8;

    --shadow-color-light: rgba(45, 55, 72, 0.08);
    --shadow-color-medium: rgba(45, 55, 72, 0.1);
    --shadow-color-dark: rgba(45, 55, 72, 0.15);

    --button-primary-bg: #2ecc71;
    --button-primary-text: #ffffff;
    --button-primary-hover-bg: #27ae60;

    --button-secondary-bg: #8abbbe;
    --button-secondary-text: #ffffff;
    --button-secondary-hover-bg: #6c9194;

    --button-danger-bg: #e74c3c;
    --button-danger-text: #ffffff;
    --button-danger-hover-bg: #c0392b;

    --button-filter-bg: #aab8c2;
    --button-filter-text: #ffffff;
    --button-filter-hover-bg: #8e9eab;

    --input-bg: #ffffff;
    --input-focus-shadow: rgba(52, 152, 219, 0.25);

    --account-block-border-default: var(--primary-accent-color);
    --filter-section-bg: #eef5fa;
    --filter-section-text: var(--primary-accent-color);
    --filter-section-border: #d1e5f1;

    --summary-bg: #f8f9fa;
    --summary-text: #212529;
    --summary-title-text: #343a40;
    --summary-border: #dee2e6;

    --income-color: #2ecc71;
    --expense-color: #e74c3c;
    --transfer-color: var(--primary-accent-color);

    --progress-bar-track-bg: #e9ecef;
    --theme-toggle-bg: #ccc;
    --theme-toggle-slider: white;
    --theme-toggle-slider-checked: var(--primary-accent-color);

    --sidebar-logout-button-bg: var(--button-danger-bg);
    --sidebar-logout-button-hover-bg: var(--button-danger-hover-bg);
    --sidebar-logout-button-text: var(--button-primary-text);

    --modal-item-hover-bg: #e9ecef;
    --modal-item-hover-text: var(--text-primary);

    --status-active-bg: var(--income-color);
    --status-paused-bg: #f39c12;
    --status-ended-bg: #95a5a6;
    --status-template-bg: var(--primary-accent-color);
    --status-text-color: #ffffff;

    --table-border-color: var(--border-light);
    --table-header-bg: var(--filter-section-bg);
    --table-row-hover-bg: #f1f3f5;

    --font-family-primary: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body[data-theme="dark"] {
    /* Dark Theme Variables */
    --body-bg: #171c22;
    --content-bg: #212a33;
    --sidebar-bg: #1a222b;
    --sidebar-bg-secondary: #2c3e50;
    --sidebar-text-primary: #e0e6eb;
    --sidebar-text-secondary: #a0aec0;
    --sidebar-title-text: #f0f4f8;
    --sidebar-border-color: #323e4a;
    --sidebar-hover-bg: #323e4a;
    --sidebar-active-bg: #3e5369;

    --primary-accent-color-dark: #4a90e2;
    --primary-accent-hover-color-dark: #3a7ac4;
    --primary-accent-color: var(--primary-accent-color-dark);
    --primary-accent-hover-color: var(--primary-accent-hover-color-dark);

    --header-bg: #1a222b;
    --header-text: #e0e6eb;

    --text-primary: #f0f4f8;
    --text-secondary: #c0cad5;
    --text-muted: #8a9aa8;
    --text-inverted: #171c22;

    --border-color: #3e5369;
    --border-light: #2d3748;
    --border-input: #4a5568;
    --border-filter-section: #2d3748;

    --shadow-color-light: rgba(0, 0, 0, 0.2);
    --shadow-color-medium: rgba(0, 0, 0, 0.25);
    --shadow-color-dark: rgba(0, 0, 0, 0.3);

    --button-primary-bg: #38a169;
    --button-primary-hover-bg: #2f855a;
    --button-secondary-bg: #606f7b;
    --button-secondary-hover-bg: #4a5568;
    --button-danger-bg: #e53e3e;
    --button-danger-hover-bg: #c53030;
    --button-filter-bg: #55606A;
    --button-filter-hover-bg: #404A53;

    --input-bg: #2d3748;
    --input-focus-shadow: rgba(74, 144, 226, 0.25);

    --filter-section-bg: #25303b;
    --filter-section-text: var(--primary-accent-color-dark);
    --filter-section-border: #323e4a;

    --summary-bg: #212a33;
    --summary-text: #e0e6eb;
    --summary-title-text: #f0f4f8;
    --summary-border: #3e5369;

    --income-color: #48bb78;
    --expense-color: #f56565;

    --progress-bar-track-bg: #4a5568;
    --theme-toggle-bg: #4a5568;
    --theme-toggle-slider: #e0e6eb;
    --theme-toggle-slider-checked: var(--primary-accent-color-dark);

    --modal-item-hover-bg: #323e4a;
    --modal-item-hover-text: var(--text-primary);

    --status-active-bg: var(--income-color);
    --status-paused-bg: #dd6b20;
    --status-ended-bg: #606f7b;
    --status-template-bg: var(--primary-accent-color-dark);
    --status-text-color: #f0f4f8;

    --table-header-bg: var(--sidebar-bg-secondary);
    --table-row-hover-bg: #2d3748;
}

html {
    font-size: var(--base-font-size);
}

body {
    font-family: var(--font-family-primary);
    margin: 0;
    background-color: var(--body-bg);
    color: var(--text-primary);
    line-height: 1.65;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
    font-size: 0.95rem;

    /* ++ ADD THESE 3 LINES ++ */
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

input,
button,
textarea,
select {
    font-family: inherit;
}

body.auth-view-active .app-header .header-left {
    display: none;
}


/* Register Styles */

#register-view {
    display: none;
}

/* Sidebar Styles */
/* -------------------------------------------------------------------------- */
.sidebar {
    height: 100%;
    width: 260px;
    position: fixed;
    z-index: 1001;
    top: 0;
    left: 0;
    background-color: var(--sidebar-bg);
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: 1rem;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out, background-color 0.3s ease;
    box-shadow: 3px 0 10px var(--shadow-color-dark);
    display: flex;
    flex-direction: column;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-nav {
    flex-grow: 1;
}

.sidebar-title {
    color: var(--sidebar-title-text);
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 0.8rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--sidebar-border-color);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-top: 0.5rem;
    font-weight: 600;
}

.sidebar-nav ul {
    list-style-type: none;
    padding: 0;
    margin: 0 0 0.8rem 0;
}

.sidebar-nav>ul>li {
    border-bottom: 1px solid var(--sidebar-border-color);
}

.sidebar-nav>ul>li:last-child {
    border-bottom: none;
}

.sidebar-nav li a {
    padding: 0.7rem 1.25rem;
    text-decoration: none;
    font-size: 0.9rem;
    color: var(--sidebar-text-primary);
    display: block;
    transition: background-color 0.2s ease, color 0.2s ease, padding-left 0.2s ease, border-left-color 0.2s ease;
    border-left: 4px solid transparent;
    font-weight: 400;
}

.sidebar-nav li a:hover {
    background-color: var(--sidebar-hover-bg);
    color: var(--sidebar-title-text);
    padding-left: 1.5rem;
    border-left-color: var(--text-accent);
}

.sidebar-nav li a.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-title-text);
    font-weight: 500;
    border-left-color: var(--text-accent);
}

.sidebar-nav li a i {
    margin-right: 0.7rem;
    width: 1.2rem;
    text-align: center;
}

.developer-credit-sidebar {
    text-align: center;
    font-size: 0.8rem;
    color: var(--sidebar-text-secondary);
    padding: 0.6rem 0;
    margin: 0 1rem;
    margin-top: 1.2rem;
    border-top: 1px solid var(--sidebar-border-color);
}


#nav-admin-menu-item {
    display: none;
}

/* Main Content & Header Styles */
/* -------------------------------------------------------------------------- */
#main-content-wrapper {
    transition: margin-left 0.3s ease-in-out;
    padding-top: 4.5rem;
    width: 100%;
    overflow-x: hidden;
}

.app-header {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: 0 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--header-border-accent);
    box-shadow: 0 2px 8px var(--shadow-color-light);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 4.5rem;
    transition: background-color 0.3s ease, color 0.3s ease, height 0.3s ease;
}

.header-left {
    display: flex;
    align-items: center;
}

.app-title-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.header-logo {
    height: 5rem;
    width: auto;
    vertical-align: middle;
    display: none;
}

#header-logo-dark {
    display: block;
}

#sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--header-text);
    font-size: 1.4rem;
    cursor: pointer;
    margin-right: 1rem;
    padding: 0.3rem;
    line-height: 1;
}

#sidebar-toggle-btn:hover {
    color: var(--text-accent);
}

#user-auth-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

#user-greeting {
    margin-right: 12px;
    line-height: 1;
    color: var(--header-text);
    font-size: 0.9rem;
    font-weight: 500;
}

#notification-area {
    position: relative;
    display: flex;
    align-items: center;
}

#notification-bell-btn {
    background: none;
    border: none;
    color: var(--header-text);
    font-size: 1.3rem;
    cursor: pointer;
    position: relative;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: color 0.2s ease;
}

#notification-bell-btn:hover {
    color: var(--text-accent);
}

/* Add this new rule anywhere in your stylesheet */
#notification-bell-btn.processing .fa-bell {
    animation: spin 1s linear infinite;
}

/* You can reuse the keyframes from the previous step if you added them */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

#notification-count-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--expense-color);
    color: white;
    border-radius: 50%;
    padding: 1.5px 6px;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    min-width: 12px;
    text-align: center;
    display: none;
}

#notification-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background: var(--content-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-medium);
    box-shadow: 0 3px 10px var(--shadow-color-medium);
    width: 320px;
    max-height: 420px;
    overflow-y: auto;
    z-index: 1010;
    display: none;
}

.notification-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--border-light);
}

.notification-dropdown-header h4 {
    margin: 0;
    padding: 0;
    border-bottom: none;
    flex-grow: 1;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

#clear-all-notifications-btn {
    font-size: 0.75rem;
    padding: 4px 8px;
    margin-left: 0;
    line-height: normal;
    background-color: var(--button-secondary-bg);
    color: var(--button-secondary-text);
    border: none;
    border-radius: var(--border-radius-small);
    cursor: pointer;
}

#clear-all-notifications-btn:hover {
    background-color: var(--button-secondary-hover-bg);
}

#notification-list-ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#notification-list-ul li {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
    transition: background-color 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#notification-list-ul li:last-child {
    border-bottom: none;
}

#notification-list-ul li a {
    text-decoration: none;
    color: var(--text-primary);
    display: block;
    flex-grow: 1;
}

#notification-list-ul li:hover,
#notification-list-ul li a:hover {
    background-color: var(--modal-item-hover-bg);
}

body[data-theme="dark"] #notification-list-ul li a:hover {
    color: var(--modal-item-hover-text);
}

#no-notifications-message {
    padding: 18px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.notification-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 5px;
    font-size: 1.2em;
    margin-left: 6px;
}

.notification-action-btn:hover {
    color: var(--text-accent);
}


/* General App View & Container Styles */

.app-view {
    display: none;
    padding: 1.25rem;
}

.app-view>.container,
.dashboard-summary-and-filters-container,
.dashboard-transactions-container,
#reports-master-section {
    width: 100%;
    max-width: 1024px;
    margin: 0 auto 1rem auto;
    background-color: var(--content-bg);
    box-shadow: 0 2px 10px var(--shadow-color-light);
    border-radius: var(--border-radius-large);
    padding: 1rem;
    transition: background-color 0.3s ease;
}

.app-view h2,
#app-content h2,
#create-account-form-container h3,
#existing-accounts-list h3,
#create-category-form h3,
#existing-categories-list h3,
#recurring-management-view h2,
#recurring-payment-form h3,
#existing-recurring-payments-list-container h3,
#reports-master-section h2 {
    font-size: 1.2rem;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    color: var(--text-accent);
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
}

.app-view h2,
#app-content h2 {
    margin-top: 0;
}

/* Authentication Section Styles (#auth-section) */
/* -------------------------------------------------------------------------- */
#auth-section {
    width: 90%;
    max-width: 400px;
    margin: 2rem auto;
    padding: 1.5rem;
    background-color: var(--content-bg);
    box-shadow: 0 4px 15px var(--shadow-color-light);
    border-radius: var(--border-radius-large);
    text-align: center;
}

.auth-page-logo {
    margin: 0 auto 1.5rem auto;
    height: 150px;
    width: auto;
    display: none;
}

body[data-theme="light"] .auth-page-logo.app-logo-light {
    display: block;
}

body[data-theme="dark"] .auth-page-logo.app-logo-dark {
    display: block;
}

#auth-section form {
    text-align: left;
    margin-top: 0;
}

#auth-section form div {
    margin-bottom: 1.25rem;
}

#auth-section label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

#auth-section input[type="text"],
#auth-section input[type="email"],
#auth-section input[type="password"] {
    width: 100%;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--border-input);
    border-radius: var(--border-radius-medium);
    font-size: 0.95rem;
    background-color: var(--input-bg);
    color: var(--text-primary);
}

#auth-section input[type="text"]:focus,
#auth-section input[type="email"]:focus,
#auth-section input[type="password"]:focus {
    border-color: var(--text-accent);
    box-shadow: 0 0 0 3px var(--input-focus-shadow);
    outline: none;
}

#auth-section button[type="submit"] {
    display: block;
    width: 100%;
    padding: 0.7rem;
    background-color: var(--text-accent);
    color: var(--button-primary-text);
    border: none;
    border-radius: var(--border-radius-medium);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    margin-top: 1rem;
    transition: background-color 0.2s ease-in-out;
}

#auth-section button[type="submit"]:hover {
    background-color: var(--primary-accent-hover-color);
}

#auth-section p {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.85rem;
}

#auth-section a {
    color: var(--text-accent);
    text-decoration: none;
    font-weight: 500;
}

#auth-section a:hover {
    text-decoration: underline;
}

/* App Content Styles (#app-content) */
/* -------------------------------------------------------------------------- */

#account-overview-section {
    margin-bottom: 1.8rem;
}

.filter-info-span {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-accent);
    background-color: var(--filter-section-bg);
    padding: 0.2rem 0.5rem;
    border-radius: var(--border-radius-small);
    vertical-align: middle;
}

body[data-theme="dark"] .filter-info-span {
    background-color: var(--content-bg);
    border: 1px solid var(--border-color);
}

#account-blocks-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: flex-start;
}

.account-block {
    background-color: var(--content-bg);
    border-top: 1px solid transparent;
    border-right: 1px solid transparent;
    border-bottom: 1px solid transparent;
    border-left: 4px solid var(--account-block-border-default);
    border-radius: var(--border-radius-medium);
    padding: 0.6rem;
    box-shadow: 0 2px 5px var(--shadow-color-light);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out, border-color 0.2s ease, background-color 0.3s ease;
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 75px;
    flex-grow: 1;
    flex-shrink: 1;
    flex-basis: calc(33.333% - 0.6rem);
    min-width: 120px;
    max-width: calc(33.333% - 0.6rem);
}

.account-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px var(--shadow-color-medium);
    border-color: var(--text-accent);
}

.account-block.selected-account-filter {
    border: 2px solid var(--text-accent);
    border-left-width: 4px;
    border-left-color: var(--text-accent);
    box-shadow: 0 0 8px var(--input-focus-shadow);
}

.account-block-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.2rem;
}

.account-block .account-name {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin: 0 0 0.1rem 0;
    font-weight: 500;
    flex-grow: 1;
    padding-right: 0.3rem;
    word-break: break-word;
    overflow-wrap: break-word;
}

.account-block .add-transaction-btn {
    background-color: var(--button-primary-bg);
    color: var(--button-primary-text);
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.75rem;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 1px 2px var(--shadow-color-dark);
    transition: background-color 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 0.3rem;
}

.account-block .add-transaction-btn:hover {
    background-color: var(--button-primary-hover-bg);
    transform: scale(1.1);
}

.account-block-details {
    margin-top: auto;
}

.account-block .account-balance {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0;
    text-align: left;
    margin-top: 0.15rem;
    word-break: break-all;
}

* Green Accounts */ .account-block[data-type="Savings"],
.account-block[data-type="Cash"],
.account-block[data-type="Checking"],
.account-block[data-type="Mobile Banking"],
.account-block[data-type^="Deposit"] {
    border-left-color: var(--income-color);
}

/* Red Accounts */
.account-block[data-type="Credit Card"],
.account-block[data-type^="Loan"] {
    border-left-color: var(--expense-color);
}

/* Grey Accounts (No change needed) */
.account-block[data-type="General"] {
    border-left-color: var(--text-muted);
}

/* This rule applies a grey border to any account with the 'excluded' status */
.account-block[data-status="excluded"] {
    border-left-color: var(--text-muted);
}

#initial-balance-edit-warning {
    display: none;
    color: #e74c3c;
}



#quick-templates-section h2 {
    font-size: 1.2rem;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    color: var(--text-accent);
    border-bottom: 1px solid var(--border-light);
    margin-top: 0;
    font-weight: 600;
}

.template-buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.6rem;
    padding-bottom: 0.6rem;
}

.template-action-btn {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    background-color: var(--button-filter-bg);
    color: var(--button-filter-text);
    border: none;
    border-radius: var(--border-radius-medium);
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: center;
    box-shadow: 0 1.5px 3px var(--shadow-color-light);
    font-weight: 500;
}

.template-action-btn:hover {
    background-color: var(--button-filter-hover-bg);
    box-shadow: 0 2.5px 5px var(--shadow-color-medium);
}

.dashboard-summary-and-filters-container {
    margin-top: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
    background-color: transparent;
    box-shadow: none;
    padding: 0.6rem 0;
    margin-bottom: 1.25rem;
    justify-content: flex-end;
}

#summary {
    background-color: var(--summary-bg);
    border: 1px solid var(--summary-border);
    border-radius: var(--border-radius-large);
    color: var(--summary-text);
    box-shadow: 0 2px 8px var(--shadow-color-light);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    flex: 1 1 400px;
    min-width: 280px;
    padding: 0.8rem;
    margin-bottom: 0;
}

#summary-header-with-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.filter-title-area {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-right: 1.25rem;
}

#transaction-filter-main-title {
    margin-bottom: 0.2rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.05rem;
    border-bottom: none;
    padding-bottom: 0;
}

#transaction-filter-main-title.reports-view-filter-title {}

#summary-account-filter-name.filter-info-span {
    margin-left: 0;
    margin-top: 0.1rem;
    display: inline-block;
}

.date-filters-container {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: flex-start;
}

.inline-date-filters {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: nowrap;
    justify-content: flex-end;
    width: 100%;
}


.inline-date-filters input[type="date"] {
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
    border: 1px solid var(--border-input);
    border-radius: var(--border-radius-small);
    background-color: var(--input-bg);
    color: var(--text-primary);
    width: auto;
    max-width: 130px;
    min-height: 30px;
}

.inline-date-filters input[type="date"]:focus {
    border-color: var(--text-accent);
    box-shadow: 0 0 0 2px var(--input-focus-shadow);
}


.preset-date-filters {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-end;
}

.preset-filter-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    background-color: var(--button-secondary-bg);
    color: var(--button-filter-text);
    border: none;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    transition: background-color 0.2s ease;
    flex-grow: 0;
    text-align: center;
    font-weight: 500;
}

.preset-filter-btn:hover,
.preset-filter-btn.active {
    background-color: var(--button-secondary-hover-bg);
}

#summary p {
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed var(--summary-border);
    padding-bottom: 0.4rem;
    color: var(--text-secondary);
}

#summary p:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}

#summary p span {
    font-weight: 500;
    color: var(--summary-text);
    font-size: 0.9rem;
}

#total-income,
#total-expenses,
#net-balance {
    padding: 0.15rem 0.4rem;
    border-radius: var(--border-radius-small);
    font-weight: 700;
    font-size: 0.85rem;
}

body[data-theme="light"] #total-income {
    background-color: #e6ffed;
    color: #1f7a3b;
    border: 1px solid #c3e6cb;
}

body[data-theme="light"] #total-expenses {
    background-color: #feedec;
    color: #a71d2a;
    border: 1px solid #f5c6cb;
}

body[data-theme="light"] #net-balance {
    background-color: #e7f3fe;
    color: #004085;
    border: 1px solid #b8daff;
}

body[data-theme="dark"] #total-income {
    background-color: var(--content-bg);
    color: var(--income-color);
    border: 1px solid var(--income-color);
}

body[data-theme="dark"] #total-expenses {
    background-color: var(--content-bg);
    color: var(--expense-color);
    border: 1px solid var(--expense-color);
}

body[data-theme="dark"] #net-balance {
    background-color: var(--content-bg);
    color: var(--transfer-color);
    border: 1px solid var(--transfer-color);
}

#summary #summary-note {
    display: block;
    margin-top: 0.6rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    background-color: var(--content-bg);
    border: 1px solid var(--border-color);
    padding: 0.4rem;
    border-radius: var(--border-radius-small);
    text-align: center;
}

.dashboard-transactions-container {}

#transactions-section {
    margin-top: 0;
}

.transaction-search-container {
    margin-bottom: 1rem;
}

#transaction-search-input {
    width: 100%;
    padding: 0.5rem 0.7rem;
    font-size: 0.9rem;
    border: 1px solid var(--border-input);
    border-radius: var(--border-radius-medium);
    background-color: var(--input-bg);
    color: var(--text-primary);
    box-sizing: border-box;
}

#transaction-search-input:focus {
    border-color: var(--text-accent);
    box-shadow: 0 0 0 2.5px var(--input-focus-shadow);
    outline: none;
}

#transaction-list {
    margin-top: 1rem;
}

.transaction-date-group {
    margin-bottom: 1rem;
}

.transaction-date-header {
    font-size: 1.05rem;
    color: var(--text-accent);
    padding: 0.4rem 0.75rem;
    margin: 0 0 0.6rem 0;
    background-color: var(--filter-section-bg);
    border-bottom: 1px solid var(--border-light);
    border-radius: var(--border-radius-medium);
    font-weight: 500;
}

body[data-theme="dark"] .transaction-date-header {
    background-color: var(--content-bg);
    border-color: var(--border-color);
}

.transaction-date-group .transaction-item {
    margin-bottom: 0.4rem;
    margin-left: 0.75rem;
    margin-right: 0.75rem;
    width: calc(100% - 1.5rem);
}

.transaction-item {
    background-color: var(--content-bg);
    border: 1px solid var(--border-light);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: var(--border-radius-medium);
    border-left-width: 4px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px var(--shadow-color-light);
    transition: box-shadow 0.2s ease-in-out, background-color 0.3s ease;
}

.transaction-item:hover {
    box-shadow: 0 3px 8px var(--shadow-color-medium);
}

.transaction-item.income {
    border-left-color: var(--income-color);
}

.transaction-item.income .amount-display {
    color: var(--income-color);
}

.transaction-item.expense {
    border-left-color: var(--expense-color);
}

.transaction-item.expense .amount-display {
    color: var(--expense-color);
}

.transaction-item.transfer {
    border-left-color: var(--transfer-color);
}

.transaction-item.transfer .amount-display {
    color: var(--transfer-color);
}

.transaction-item .details {
    flex-grow: 1;
    margin-right: 0.75rem;
    overflow: hidden;
}

.transaction-item .details strong {
    font-size: 0.95rem;
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.transaction-item .details small {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.25;
    margin-top: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.transaction-item .amount-section {
    text-align: right;
    flex-shrink: 0;
}

.transaction-item span.amount-display {
    font-weight: 700;
    font-size: 0.95rem;
    display: block;
    margin-bottom: 2px;
    white-space: nowrap;
}

.transaction-item .actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 0.2rem;
}

.transaction-item .actions button {
    margin-left: 0.2rem;
    padding: 0.25rem 0.4rem;
    font-size: 0.75rem;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    background-color: var(--border-light);
    color: var(--text-secondary);
}

.transaction-item .actions button i {
    font-size: 0.85rem;
}

.transaction-item .actions button:hover {
    background-color: var(--border-color);
}

.transaction-item .actions .edit-btn:hover {
    color: var(--button-primary-text);
    background-color: #f39c12;
    border-color: #d68910;
}

body[data-theme="dark"] .transaction-item .actions .edit-btn:hover {
    background-color: #f59e0b;
    border-color: #d97706;
}

.transaction-item .actions .delete-btn:hover {
    color: var(--button-primary-text);
    background-color: var(--button-danger-bg);
    border-color: var(--button-danger-hover-bg);
}


/* Reports Section (#reports-master-section) */
#reports-master-section {
    margin-top: 1.5rem;
}

#reports-master-section h2 {
    font-size: 1.4rem;
    padding-bottom: 0.6rem;
    margin-bottom: 1.25rem;
}

.report-filters {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.report-filters .preset-filter-btn.active {
    background-color: var(--primary-accent-hover-color);
    font-weight: 500;
}

.report-content-area {
    margin-top: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-large);
    background-color: var(--content-bg);
    box-shadow: var(--shadow-color-light) 0px 3px 10px;
}

.report-main-title {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 0.3rem;
    padding-bottom: 0;
    border-bottom: none;
    font-weight: 600;
}

.report-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0;
    margin-bottom: 1.25rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border-color);
}

.print-report-btn {
    padding: 0.6rem 1.2rem;
    background-color: var(--button-secondary-bg);
    color: var(--button-secondary-text);
    border: none;
    border-radius: var(--border-radius-medium);
    cursor: pointer;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    float: right;
    transition: background-color 0.2s ease;
    font-weight: 500;
}

.print-report-btn:hover {
    background-color: var(--button-secondary-hover-bg);
}

.print-report-btn i {
    margin-right: 0.6rem;
}

.report-type-filters {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.75rem;
}

.report-loading-text,
.report-no-data-text,
.report-error-text {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.report-table th,
.report-table td {
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border-darker);
    text-align: left;
    vertical-align: top;
}

.report-table th {
    background-color: var(--table-header-bg);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.report-table tbody tr:hover {
    background-color: var(--table-row-hover-bg);
}

.report-table .amount-cell {
    text-align: right;
    white-space: nowrap;
}

.report-table .category-name-cell {
    padding-left: 1.5rem;
}

.report-table .reporting-head-row td {
    font-weight: 600;
    background-color: var(--filter-section-bg);
    color: var(--text-primary);
}

body[data-theme="dark"] .report-table .reporting-head-row td {
    background-color: var(--sidebar-bg-secondary);
}

.report-table .reporting-head-subtotal-row td {
    font-weight: 600;
    border-top: 2px solid var(--border-color);
}

.report-table .subtotal-label-cell {
    padding-left: 1rem;
    font-style: italic;
}

.report-table-section h4 {
    font-size: 1.2rem;
    font-weight: 500;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed var(--border-light);
}

.report-table-section:first-child h4 {
    margin-top: 0;
}

.report-table-section.income-section h4 {
    color: var(--income-color);
}

.report-table-section.expense-section h4 {
    color: var(--expense-color);
}

.report-table-footer {
    display: flex;
    justify-content: space-between;
    font-size: 1.05rem;
    font-weight: 600;
    padding: 0.75rem 0.25rem;
    margin-top: 0.75rem;
    border-top: 2px solid var(--border-color);
}

.report-table-footer .report-table-cell {
    padding: 0;
    border: none;
}

.income-expense-statement .section-total strong:last-child {
    color: inherit;
}

.income-expense-statement .income-section .section-total strong:last-child {
    color: var(--income-color) !important;
}

.income-expense-statement .expense-section .section-total strong:last-child {
    color: var(--expense-color) !important;
}

.income-expense-statement .net-difference {
    font-size: 1.2rem;
    color: var(--text-accent);
    border-top: 2px solid var(--text-accent);
    margin-top: 1.5rem;
}

.income-expense-statement .net-difference h3 {
    margin: 0;
    font-size: inherit;
    color: inherit;
    font-weight: 600;
}

.card-utilization-item-print-block {
    border: 1px solid var(--border-light);
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: var(--border-radius-medium);
    background-color: var(--content-bg);
}

.card-utilization-item-print-block .card-print-header {
    margin-bottom: 0.3rem;
}

.card-utilization-item-print-block .card-print-name {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.card-utilization-item-print-block .progress-bar-container {
    width: 100%;
    background-color: var(--progress-bar-track-bg);
    border-radius: var(--border-radius-small);
    height: 22px;
    margin-top: 0.6rem;
    margin-bottom: 0.4rem;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
}

.card-utilization-item-print-block .progress-bar-fill {
    height: 100%;
    border-radius: var(--border-radius-small);
    transition: width 0.3s ease-in-out, background-color 0.3s ease-in-out;
}

.card-utilization-item-print-block .card-print-utilization-text {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 0.15rem;
    margin-bottom: 0.6rem;
}

.card-utilization-item-print-block .card-print-limit {
    margin-top: 0.2rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

#master-category-report-list .report-table th,
#master-category-report-list .report-table td {
    padding: 0.6rem;
}

.report-total-line {
    margin-top: 1.25rem;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
}

/* General Form & Input Styles (used across multiple views) */
/* -------------------------------------------------------------------------- */
label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.transaction-labels-container {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.transaction-label-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    /* For rectangular box with slightly rounded corners */
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.4;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--border-input);
    border-radius: var(--border-radius-medium);
    font-size: 0.9rem;
    background-color: var(--input-bg);
    color: var(--text-primary);
    line-height: 1.4;
}

input[type="date"] {
    position: relative;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input[type="date"]::-webkit-datetime-edit-year-field,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-text {
    color: var(--text-primary);
    padding: 0 2px;
}

input[type="date"]:invalid::-webkit-datetime-edit-text {
    color: var(--text-muted);
}

input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0.9;
    cursor: pointer;
    filter: var(--body-bg) brightness(60%);
}

body[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(0.9);
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
textarea:focus {
    border-color: var(--text-accent);
    box-shadow: 0 0 0 3px var(--input-focus-shadow);
    outline: none;
}

/* Custom Select Wrapper (used in many forms) */
/* -------------------------------------------------------------------------- */
.custom-select-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    cursor: pointer;
}

.custom-select-display {
    flex-grow: 1;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
    padding-left: 0.8rem;
    padding-right: 38px;
    background-color: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-input);
    border-radius: var(--border-radius-medium);
    font-size: 0.95rem;
    line-height: 1.5;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

.custom-select-display:focus {
    border-color: var(--text-accent);
    box-shadow: 0 0 0 3.5px var(--input-focus-shadow);
    outline: none;
}

.custom-select-button {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 38px;
    height: 100%;
    border: none;
    background-color: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 var(--border-radius-medium) var(--border-radius-medium) 0;
    padding: 0;
    z-index: 2;
}

/* Settings List Styles (Generalized from sidebar-footer) */
.settings-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.settings-list li {
    padding: 0.5rem 0.25rem;
}

.settings-list .theme-toggle-li,
.settings-list .setting-item-li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.settings-list .theme-toggle-label,
.settings-list .setting-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-right: 0;
    display: flex;
    align-items: center;
    font-weight: 400;
}


.settings-list .theme-toggle-label i,
.settings-list .setting-label i {
    margin-right: 0.5rem;
    width: 1rem;
    text-align: center;
    color: var(--text-primary);
}

body[data-theme="light"] .settings-list .theme-toggle-label .fa-moon {
    color: #7f8c8d;
}

body[data-theme="light"] .settings-list .theme-toggle-label .fa-sun {
    color: #f39c12;
}

body[data-theme="dark"] .settings-list .theme-toggle-label .fa-moon {
    color: #f39c12;
}

body[data-theme="dark"] .settings-list .theme-toggle-label .fa-sun {
    color: #7f8c8d;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    margin-left: 20px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--theme-toggle-bg);
    transition: .4s;
    border-radius: 24px;
}

.theme-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--theme-toggle-slider);
    transition: .4s;
    border-radius: 50%;
}

input:checked+.theme-slider {
    background-color: var(--theme-toggle-slider-checked);
}

input:focus+.theme-slider {
    box-shadow: 0 0 1px var(--theme-toggle-slider-checked);
}

input:checked+.theme-slider:before {
    transform: translateX(24px);
}

.settings-list .custom-select-wrapper {
    flex-grow: 1;
    min-width: 140px;
}

.settings-list .custom-select-display {
    background-color: var(--input-bg);
    color: var(--text-primary);
    border-color: var(--border-input);
    font-size: 0.9rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.custom-select-wrapper.custom-select-disabled-in-edit {
    opacity: 0.65;
}

.custom-select-wrapper.custom-select-disabled-in-edit .custom-select-display {
    background-color: var(--filter-section-bg);
    cursor: not-allowed;
}

body[data-theme="dark"] .custom-select-wrapper.custom-select-disabled-in-edit .custom-select-display {
    background-color: var(--sidebar-bg-secondary);
}

/* Add Transaction View & Form (#add-transaction-view, #transaction-form) */
/* -------------------------------------------------------------------------- */
#add-transaction-view .container h2 {}

#transaction-form div {
    margin-bottom: 1rem;
}

#transaction-form button[type="submit"],
#add-split-item-btn,
#confirm-split-btn,
#show-split-ui-btn,
#create-label-btn,
#budget-form-submit-btn,
.admin-save-plan-btn,
.pending-approve-btn,
.admin-edit-user-btn {
    display: inline-block;
    width: auto;
    min-width: 150px;
    padding: 0.6rem 1.2rem;
    background-color: var(--button-primary-bg);
    color: var(--button-primary-text);
    border: none;
    border-radius: var(--border-radius-medium);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out;
    margin-top: 0.6rem;
}

#transaction-form button[type="submit"]:hover,
#create-label-btn:hover,
.admin-save-plan-btn:hover,
.pending-approve-btn:hover {
    background-color: var(--button-primary-hover-bg);
}

#transaction-form button[type="button"] {
    display: inline-block;
    width: auto;
    min-width: 150px;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--border-radius-medium);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out;
    margin-top: 0.6rem;
    margin-left: 12px;
}

#save-as-template-btn,
#add-split-item-btn,
#confirm-split-btn,
#show-split-ui-btn {
    margin-left: 10px;
    background-color: var(--button-primary-bg);
    color: var(--button-secondary-text);
}

#save-as-template-btn:hover,
#add-split-item-btn:hover,
#confirm-split-btn:hover,
#show-split-ui-btn:hover,
#budget-form-submit-btn:hover {
    background-color: var(--button-primary-hover-bg);
}


#use-transaction-template-btn {
    margin-left: 10px;
    background-color: var(--button-secondary-bg);
    color: var(--button-secondary-text);
}

#use-transaction-template-btn:hover {
    background-color: var(--button-secondary-hover-bg);
    color: var(--button-secondary-text);
}

#transfer-to-account-field {
    display: none;
}

.conditional-fields {
    margin-top: 0.8rem;
    margin-bottom: 1rem;
    padding-left: 1rem;
    border-left: 2px solid var(--border-light);
}

.conditional-fields div {
    margin-bottom: 1rem !important;
}

.conditional-fields div:last-child {
    margin-bottom: 0 !important;
}

#preferred-currency-rate-field {
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-medium);
    padding: 1rem;
    margin-top: 1.25rem;
    background-color: var(--filter-section-bg);
}

body[data-theme="dark"] #preferred-currency-rate-field {
    background-color: var(--content-bg);
    border-color: var(--border-color);
}

#preferred-currency-rate-field label:first-of-type {
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-size: 1.05rem;
    border-bottom: none;
    padding-bottom: 0.4rem;
    font-weight: 500;
}

#preferred-currency-rate-field small {
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

#preferred-currency-rate-field #pref-currency-rate-info {
    margin-bottom: 0.3rem;
}

#preferred-currency-rate-field #pref-currency-calculated-value {
    font-weight: 500;
    color: var(--text-accent);
}

#preferred-currency-rate-field label {
    font-weight: 400;
    margin-right: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

#multi-currency-transfer-fields {
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-medium);
    padding: 1rem;
    margin-top: 1.25rem;
    background-color: var(--filter-section-bg);
}

body[data-theme="dark"] #multi-currency-transfer-fields {
    background-color: var(--content-bg);
    border-color: var(--border-color);
}

#multi-currency-transfer-fields h4 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-size: 1.05rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.4rem;
    font-weight: 500;
}

#multi-currency-transfer-fields p {
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

#multi-currency-transfer-fields div>label:first-child {
    font-weight: 500;
    margin-bottom: 0.3rem;
    display: block;
}

#multi-currency-transfer-fields input[type="radio"] {
    width: auto;
    margin-right: 0.3rem;
    vertical-align: middle;
}

#multi-currency-transfer-fields label {
    font-weight: 400;
    margin-right: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

#multi-currency-transfer-fields #conversion-rate-group,
#multi-currency-transfer-fields #destination-amount-group {
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
}

#multi-currency-transfer-fields #conversion-rate-group label,
#multi-currency-transfer-fields #destination-amount-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 500;
    color: var(--text-secondary);
}

#multi-currency-transfer-fields #mct-calculated-value {
    font-weight: 700;
    color: var(--text-accent);
}

#source-currency-label-amount,
#mct-source-currency,
#mct-dest-currency,
#mct-source-currency-rate,
#mct-dest-currency-rate,
#mct-dest-currency-amount,
#trans-acc-currency-label-rate,
#user-pref-currency-label-rate,
#user-pref-currency-label,
#user-pref-currency-label-calc {
    font-weight: 400;
    color: var(--text-muted);
}

.radio-group {
    display: flex;
    gap: 1rem;
    margin-top: 0.25rem;
}

.radio-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.radio-group input[type="radio"] {
    margin-right: 0.3rem;
    width: auto;
}


/* Account Management View (#account-management-view) */
/* -------------------------------------------------------------------------- */
#create-account-form-container+#existing-accounts-list {
    margin-top: 1rem;
}

#existing-accounts-list .simple-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

#existing-accounts-list .simple-list li {
    background-color: var(--content-bg);
    border: 1px solid var(--border-light);
    border-left-width: 5px;
    border-left-color: var(--text-muted);
    border-radius: var(--border-radius-medium);
    padding: 0.7rem 1rem;
    margin-bottom: 0.6rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    box-shadow: 0 2px 6px var(--shadow-color-light);
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, background-color 0.3s ease;
}

#existing-accounts-list .simple-list li:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color-medium);
}

#existing-accounts-list .simple-list li[data-account-type="Cash"],
#existing-accounts-list .simple-list li[data-account-type="Checking"],
#existing-accounts-list .simple-list li[data-account-type="Savings"],
#existing-accounts-list .simple-list li[data-account-type="Deposit (Installment)"],
#existing-accounts-list .simple-list li[data-account-type="Deposit (Non-Installment)"],
#existing-accounts-list .simple-list li[data-account-type="Mobile Banking"] {
    border-left-color: var(--income-color);
}

#existing-accounts-list .simple-list li[data-account-type="Credit Card"],
#existing-accounts-list .simple-list li[data-account-type="Loan (Installment)"],
#existing-accounts-list .simple-list li[data-account-type="Loan (Non-Installment)"],
#existing-accounts-list .simple-list li[data-account-type="Loan (General)"] {
    border-left-color: var(--expense-color);
}

#existing-accounts-list .simple-list li .account-list-item-main {
    flex-grow: 1;
}

#existing-accounts-list .simple-list li .account-list-name {
    font-weight: 500;
    font-size: 1.05rem;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

#existing-accounts-list .simple-list li .account-list-subtext {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
    line-height: 1.4;
}

.account-list-item-actions,
.rate-actions {
    margin-left: 1rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.account-list-item-actions button,
.rate-actions button,
.budget-actions button,
.plan-edit-btn {
    margin-left: 0.25rem;
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    background-color: var(--border-light);
    color: var(--text-secondary);
}

.account-list-item-actions button i {
    font-size: 0.9rem;
}

.account-list-item-actions button:hover {
    background-color: var(--border-color);
}

.edit-account-btn {
    margin-right: 0.3rem;
}

.edit-account-btn:hover {
    color: var(--button-primary-text);
    background-color: var(--button-secondary-hover-bg);
    border-color: var(--button-secondary-hover-bg);
}

body[data-theme="dark"] .edit-account-btn:hover {
    background-color: var(--button-secondary-hover-bg);
    border-color: var(--button-secondary-hover-bg);
}

.delete-account-btn:hover {
    color: var(--button-primary-text);
    background-color: var(--button-danger-bg);
    border-color: var(--button-danger-hover-bg);
}

#existing-accounts-list .simple-list li.draggable-account-item {
    cursor: grab;
}

#existing-accounts-list .simple-list li.draggable-account-item:active {
    cursor: grabbing;
}

#existing-accounts-list .simple-list li.dragging {
    opacity: 0.7;
    background-color: var(--filter-section-bg);
    border-style: dashed;
}

.drag-over {
    border-top: 2px solid var(--text-accent) !important;
}

#create-account-form div {
    margin-bottom: 1rem;
}

#create-account-form button[type="submit"] {}

#cancel-edit-account-btn,
#cancel-edit-budget-btn,
#admin-cancel-edit-plan-btn {
    display: none;
    margin-left: 10px;
    width: auto;
    min-width: 150px;
    padding: 0.6rem 1.2rem;
    background-color: var(--button-danger-bg);
    color: var(--button-primary-text);
    border: none;
    border-radius: var(--border-radius-medium);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out;
    margin-top: 0.6rem;
}

#cancel-edit-account-btn:hover,
.sidebar-logout-button:hover,
#cancel-edit-budget-btn:hover,
#admin-cancel-edit-plan-btn:hover {
    background-color: var(--button-danger-hover-bg);
}

#credit-card-fields,
#loan-installment-fields,
#loan-non-installment-fields,
#deposit-fields {}

/* Category Management View (#category-management-view) */
/* -------------------------------------------------------------------------- */
#create-category-form+#existing-categories-list {
    margin-top: 1rem;
}

#existing-categories-list .simple-list {}

#existing-categories-list .simple-list li.category-list-item {
    border-left-color: var(--text-muted);
}

#existing-categories-list .simple-list li.category-list-item[data-category-type="income"] {
    border-left-color: var(--income-color);
}

#existing-categories-list .simple-list li.category-list-item[data-category-type="expense"] {
    border-left-color: var(--expense-color);
}

#existing-categories-list .simple-list li.category-list-item[data-category-type="transfer"] {
    border-left-color: var(--text-muted);
}

#existing-categories-list .simple-list li.category-list-item[data-category-type="reporting_head"] {
    border-left-color: var(--text-accent);
}

#existing-categories-list .simple-list li .category-list-details {
    flex-grow: 1;
}

#existing-categories-list .simple-list li .category-list-name {
    font-weight: 500;
    font-size: 1.05rem;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

#existing-categories-list .simple-list li .category-list-subtext {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
    line-height: 1.4;
}

#create-category-form+#existing-categories-list {
    margin-top: 1rem;
}

#existing-categories-list h3 {}

#existing-categories-list .simple-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

#existing-categories-list .simple-list li.category-list-item {
    background-color: var(--content-bg);
    border: 1px solid var(--border-light);
    border-left-width: 5px;
    border-left-color: var(--text-muted);
    border-radius: var(--border-radius-medium);
    padding: 0.7rem 1rem;
    margin-bottom: 0.6rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    box-shadow: 0 2px 6px var(--shadow-color-light);
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, background-color 0.3s ease;
}

#existing-categories-list .simple-list li.category-list-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color-medium);
}

#existing-categories-list .simple-list li.category-list-item[data-category-type="income"] {
    border-left-color: var(--income-color);
}

#existing-categories-list .simple-list li.category-list-item[data-category-type="expense"] {
    border-left-color: var(--expense-color);
}

#existing-categories-list .simple-list li.category-list-item[data-category-type="transfer"] {
    border-left-color: var(--text-muted);
}

#existing-categories-list .simple-list li.category-list-item[data-category-type="reporting_head"] {
    border-left-color: var(--text-accent);
}

#existing-categories-list .simple-list li .category-list-details {
    flex-grow: 1;
}

#existing-categories-list .simple-list li .category-list-name {
    font-weight: 500;
    font-size: 1.05rem;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

#existing-categories-list .simple-list li .category-list-subtext {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
    line-height: 1.4;
}

.category-list-item-actions {
    margin-left: 1rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.category-list-item-actions button {
    margin-left: 0.25rem;
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    background-color: var(--border-light);
    color: var(--text-secondary);
}

.category-list-item-actions button i {
    font-size: 0.9rem;
}

.category-list-item-actions button:hover {
    background-color: var(--border-color);
}

.edit-category-btn {
    margin-right: 0.3rem;
}

.edit-category-btn:hover {
    color: var(--button-primary-text);
    background-color: var(--button-secondary-hover-bg);
    border-color: var(--button-secondary-hover-bg);
}

body[data-theme="dark"] .edit-category-btn:hover {
    background-color: var(--button-secondary-hover-bg);
    border-color: var(--button-secondary-hover-bg);
}

.delete-category-btn:hover {
    color: var(--button-primary-text);
    background-color: var(--button-danger-bg);
    border-color: var(--button-danger-hover-bg);
}

.category-list-item-actions {}

.category-list-item-actions button {}

.edit-category-btn {
    margin-right: 0.3rem;
}

.edit-category-btn:hover {}

.delete-category-btn:hover {}

#create-category-form div {
    margin-bottom: 1rem;
}

#create-category-form button[type="submit"] {}

#cancel-edit-category-btn {}

/* Exchange Rate Management View (#exchange-rate-management-view) */
/* -------------------------------------------------------------------------- */
#custom-rate-form label {
    display: block;
    margin-bottom: 0.4rem;
}

#existing-custom-rates-list-container {
    margin-top: 0.8rem;
}

#existing-custom-rates-list-container h4 {
    font-size: 1.05rem;
    margin-bottom: 0.6rem;
    color: var(--text-primary);
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-light);
    font-weight: 500;
}

#existing-custom-rates-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
    max-height: 350px;
    overflow-y: auto;
}

#existing-custom-rates-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.4rem;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-light);
}

#existing-custom-rates-list li:last-child {
    border-bottom: none;
}

#existing-custom-rates-list .rate-pair {
    flex-grow: 1;
}

#existing-custom-rates-list .rate-actions button {
    margin-left: 0.6rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.rate-input-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem;
    border: 1px solid var(--border-input);
    border-radius: var(--border-radius-medium);
    background-color: var(--input-bg);
    margin-bottom: 0.8rem;
}

.rate-input-group span {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.rate-input-group .currency-label {
    font-weight: 700;
    color: var(--text-accent);
    min-width: 40px;
    display: inline-block;
    text-align: center;
}

.rate-input-group input[type="number"].rate-input-field {
    width: auto;
    flex-grow: 1;
    max-width: 160px;
    padding: 0.7rem 0.8rem;
    text-align: right;
}

#custom-rate-form button[type="submit"],
#custom-rate-form button[type="button"] {
    display: inline-block;
    width: auto;
    min-width: 160px;
    padding: 0.7rem 1.3rem;
    border: none;
    border-radius: var(--border-radius-medium);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out;
    margin-top: 0.7rem;
}

#save-custom-rate-btn {
    background-color: var(--button-primary-bg);
    color: var(--button-primary-text);
}

#save-custom-rate-btn:hover {
    background-color: var(--button-primary-hover-bg);
}

#cancel-edit-custom-rate-btn {
    background-color: var(--button-danger-bg);
    color: var(--button-danger-text);
    margin-left: 12px;
    display: none;
    margin-left: 10px;
}

#cancel-edit-custom-rate-btn:hover {
    background-color: var(--button-danger-hover-bg);
}

#custom-rate-form .custom-select-wrapper {
    margin-bottom: 0;
}

/* Recurring Management View (#recurring-management-view) */
/* -------------------------------------------------------------------------- */
#recurring-payment-form div {
    margin-bottom: 1rem;
}

#recurring-payment-form button[type="submit"] {}

#cancel-edit-rp-btn {}

#existing-recurring-payments-list-container {
    margin-top: 1.8rem;
}

#existing-recurring-payments-list-container h3 {
    font-size: 1.2rem;
    padding-bottom: 0.6rem;
    margin-bottom: 1.2rem;
    color: var(--text-accent);
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
}

.recurring-payments-actual-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
    max-height: 350px;
    overflow-y: auto;
}

* Hides the scrollbar from the recurring payments list view */ .recurring-payments-actual-list {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.recurring-payments-actual-list::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari, and Opera */
}

.recurring-payment-item {
    background-color: var(--content-bg);
    border: 1px solid var(--border-light);
    border-left-width: 5px;
    border-left-color: var(--transfer-color);
    border-radius: var(--border-radius-large);
    padding: 0.8rem 1.2rem;
    margin-bottom: 0.7rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 3px 8px var(--shadow-color-light);
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, background-color 0.3s ease;
}

.recurring-payment-item[data-status="paused"] {
    border-left-color: var(--status-paused-bg);
}

.recurring-payment-item[data-status="ended"] {
    border-left-color: var(--status-ended-bg);
    opacity: 0.75;
}

.recurring-payment-item[data-status="template"] {
    border-left-color: var(--status-template-bg);
}

.recurring-payment-item:hover {
    transform: translateY(-2.5px);
    box-shadow: 0 5px 15px var(--shadow-color-medium);
}

.recurring-payment-item .rp-main-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 0.4rem;
}

.recurring-payment-item .rp-description {
    flex-grow: 1;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.recurring-payment-item .rp-amount {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
    white-space: nowrap;
    margin-left: 0.6rem;
}

.recurring-payment-item .rp-status-badge {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    color: var(--status-text-color);
    margin-left: 0.6rem;
    font-weight: 500;
    text-transform: capitalize;
}

.rp-status-badge.status-active {
    background-color: var(--status-active-bg);
}

.rp-status-badge.status-paused {
    background-color: var(--status-paused-bg);
}

.rp-status-badge.status-ended {
    background-color: var(--status-ended-bg);
}

.rp-status-badge.status-template {
    background-color: var(--status-template-bg);
}

.recurring-payment-item .rp-schedule-details {
    font-size: 0.85rem;
    color: var(--text-muted);
    width: 100%;
}

.recurring-payment-item .rp-schedule-details small {
    display: block;
    line-height: 1.4;
    margin-top: 2.5px;
}

.recurring-payment-item .rp-schedule-details small.rp-notes {
    font-style: italic;
    margin-top: 5px;
}

.recurring-payment-item .rp-actions {
    margin-left: 0;
    margin-top: 0.6rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    justify-content: flex-end;
}

.recurring-payment-item .rp-actions button {
    margin-left: 0;
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
    border-radius: var(--border-radius-medium);
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    background-color: var(--border-light);
    color: var(--text-secondary);
    font-weight: 500;
}

.recurring-payment-item .rp-actions button i {
    font-size: 0.9rem;
    margin-right: 0.3rem;
}

.recurring-payment-item .rp-actions button:hover {
    background-color: var(--border-color);
}

.recurring-payment-item .rp-actions .log-rp-btn {
    background-color: var(--button-primary-bg);
    color: var(--button-primary-text);
}

.recurring-payment-item .rp-actions .log-rp-btn:hover {
    background-color: var(--button-primary-hover-bg);
}

.recurring-payment-item .rp-actions .edit-rp-btn:hover {
    color: var(--button-primary-text);
    background-color: var(--button-secondary-hover-bg);
    border-color: var(--button-secondary-hover-bg);
}

body[data-theme="dark"] .recurring-payment-item .rp-actions .edit-rp-btn:hover {
    background-color: var(--button-secondary-hover-bg);
    border-color: var(--button-secondary-hover-bg);
}

.recurring-payment-item .rp-actions .delete-rp-btn:hover {
    color: var(--button-primary-text);
    background-color: var(--button-danger-bg);
    border-color: var(--button-danger-hover-bg);
}


body[data-theme="dark"] #recurring-payment-form input[readonly] {
    background-color: var(--sidebar-bg-secondary);
}

.edit-restriction-info {
    display: inline;
    font-style: italic;
    font-size: 0.8em;
    color: var(--text-muted);
    margin-left: 6px;
}

/*
  RULE 1: Makes the necessary fields look and feel clickable when
  creating a NEW recurring payment.
*/
#recurring-payment-form .custom-select-display[readonly],
#recurring-payment-form .custom-datepicker {
    background-color: var(--input-bg);
    opacity: 1;
    cursor: pointer;
}

/*
  RULE 2: Makes fields that are non-editable during an EDIT
  (like Start Date or Frequency) appear correctly disabled.
  This rule targets a class added by the JavaScript in edit mode.
*/
#recurring-payment-form .field-not-editable input,
#recurring-payment-form .custom-select-disabled-in-edit .custom-select-display {
    background-color: var(--filter-section-bg);
    opacity: 0.65;
    cursor: not-allowed;
}

/* Template Management View (#template-management-view) */
/* -------------------------------------------------------------------------- */

#existing-templates-list .simple-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

#existing-templates-list h3 {}

#existing-templates-list .simple-list li.template-list-item {
    background-color: var(--content-bg);
    border: 1px solid var(--border-light);
    border-left-width: 5px;
    border-left-color: #7f8c8d;
    border-radius: var(--border-radius-medium);
    padding: 0.2rem 0.5rem;
    margin-bottom: 0.6rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 6px var(--shadow-color-light);
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, background-color 0.3s ease;
}

#existing-templates-list .simple-list li.template-list-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color-medium);
}

#existing-templates-list .template-list-item .template-details {
    flex-grow: 1;
}

#existing-templates-list .template-list-item .template-name {
    font-weight: 500;
    font-size: 1.05rem;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

#existing-templates-list .template-list-item .template-subtext {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
    line-height: 1.4;
}

#existing-templates-list .template-list-item .template-actions {
    margin-left: 1rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

#existing-templates-list .template-list-item .template-actions button {
    margin-left: 0.25rem;
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    background-color: var(--border-light);
    color: var(--text-secondary);
    font-weight: 500;
}

#existing-templates-list .template-list-item .template-actions button i {
    font-size: 0.9rem;
    margin-right: 0.25rem;
}

#existing-templates-list .template-list-item .template-actions button:hover {
    background-color: var(--border-color);
}

#existing-templates-list .template-actions .use-tpl-btn:hover {
    color: var(--button-primary-text);
    background-color: var(--button-primary-bg);
    border-color: var(--button-primary-hover-bg);
}

#existing-templates-list .template-actions .edit-tpl-btn:hover {
    color: var(--button-primary-text);
    background-color: var(--button-secondary-hover-bg);
    border-color: var(--button-secondary-hover-bg);
}

#existing-templates-list .template-actions .delete-tpl-btn:hover {
    color: var(--button-primary-text);
    background-color: var(--button-danger-bg);
    border-color: var(--button-danger-hover-bg);
}

/* Admin Panel View (#admin-panel-view) */
/* -------------------------------------------------------------------------- */
#admin-panel-view .container {
    margin-bottom: 1.8rem;
}

#admin-panel-view h2 {
    font-size: 1.5rem;
    color: var(--text-accent);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.7rem;
    margin-bottom: 1.8rem;
    font-weight: 600;
}

.admin-section h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    padding-bottom: 0.5rem;
    margin-top: 0;
    margin-bottom: 1rem;
    border-bottom: 1px dashed var(--border-light);
    font-weight: 500;
}

#admin-stats-overview .admin-date-filters {
    margin-bottom: 1rem;
    display: flex;
    gap: 10px;
    align-items: center;
}

#admin-stats-overview .admin-date-filters label {
    margin-bottom: 0;
}

#admin-stats-overview .admin-date-filters input[type="date"] {
    padding: 0.3rem;
}

#admin-stats-overview .admin-date-filters button {
    padding: 0.3rem 0.6rem;
}

#admin-stats-overview .admin-date-filters .preset-filter-btn {
    padding: 0.3rem 0.6rem;
}

#admin-stats-clear-filter-btn {
    background-color: var(--button-secondary-bg);
}

#admin-stats-clear-filter-btn:hover {
    background-color: var(--button-secondary-hover-bg);
}

#admin-stats-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    padding: 0.6rem 0;
}

#admin-stats-content p {
    background-color: var(--summary-bg);
    padding: 1rem;
    border-radius: var(--border-radius-medium);
    border: 1px solid var(--summary-border);
    box-shadow: 0 1.5px 4px var(--shadow-color-light);
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

#admin-stats-content p strong {
    color: var(--text-primary);
    font-weight: 600;
    display: block;
    font-size: 1.3rem;
    margin-top: 0.25rem;
}

#admin-user-management {
    margin-top: 2.5rem;
}

#admin-user-search {
    width: 100%;
    padding: 0.7rem;
    font-size: 0.95rem;
    border: 1px solid var(--border-input);
    border-radius: var(--border-radius-medium);
    margin-bottom: 1.25rem;
    box-sizing: border-box;
    background-color: var(--input-bg);
    color: var(--text-primary);
}

#admin-user-search:focus {
    border-color: var(--text-accent);
    box-shadow: 0 0 0 3px var(--input-focus-shadow);
    outline: none;
}

#admin-user-list-table-container .report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

#admin-user-list-table-container .report-table th,
#admin-user-list-table-container .report-table td {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--table-border-color);
    text-align: left;
    vertical-align: middle;
}

#admin-user-list-table-container .report-table th {
    background-color: var(--table-header-bg);
    font-weight: 500;
    color: var(--text-primary);
}

#admin-user-list-table-container .report-table tbody tr:hover {
    background-color: var(--table-row-hover-bg);
}

#admin-user-list-table-container .report-table td button {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    margin-right: 0.4rem;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    border: 1px solid var(--border-light);
    background-color: var(--content-bg);
    color: var(--text-secondary);
    transition: background-color 0.2s ease, color 0.2s ease;
    font-weight: 500;
}

#admin-user-list-table-container .report-table td button:last-child {
    margin-right: 0;
}

#admin-user-list-table-container .report-table td button.admin-edit-user-btn:hover {
    background-color: var(--button-secondary-hover-bg);
    color: var(--button-primary-text);
}

#admin-user-list-table-container .report-table td button.admin-reset-password-btn:hover {
    background-color: var(--button-filter-hover-bg);
    color: var(--button-primary-text);
}

#admin-user-list-table-container .report-table td.status-free {
    color: var(--text-muted);
}

#admin-user-list-table-container .report-table td.status-paid {
    color: var(--income-color);
    font-weight: 500;
}

#admin-user-list-table-container .report-table td.status-admin {
    color: var(--expense-color);
    font-weight: 600;
}


/* Force Password Change View (#force-password-change-view) */
/* -------------------------------------------------------------------------- */

#force-password-change-view.modal-overlay {
    display: none;
    justify-content: center;
    align-items: center;
}

#force-password-change-view .modal-content {
    max-width: 480px;
    text-align: center;
}

#force-password-change-view #force-password-change-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

#force-password-change-view p {
    font-size: 0.95rem;
    margin-bottom: 1.25rem;
    text-align: center;
    line-height: 1.6;
}

#force-password-change-form {
    text-align: left;
    margin-top: 0.75rem;
}

#force-password-change-form div {
    margin-bottom: 1.25rem;
}

#force-password-change-form label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

#force-password-change-form input[type="password"] {
    width: 100%;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--border-input);
    border-radius: var(--border-radius-medium);
    font-size: 0.95rem;
    background-color: var(--input-bg);
    color: var(--text-primary);
}

#force-password-change-form input[type="password"]:focus {
    border-color: var(--text-accent);
    box-shadow: 0 0 0 3px var(--input-focus-shadow);
    outline: none;
}

#force-password-change-form #fp-message-area {
    color: var(--expense-color);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    min-height: 1.3em;
    text-align: center;
}

#force-password-change-form #fp-submit-btn {
    display: block;
    width: 100%;
    padding: 0.7rem;
    background-color: var(--button-primary-bg);
    color: var(--button-primary-text);
    border: none;
    border-radius: var(--border-radius-medium);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    margin-top: 1rem;
    transition: background-color 0.2s ease-in-out;
}

#force-password-change-form #fp-submit-btn:hover {
    background-color: var(--button-primary-hover-bg);
}

/* Modal Styles (General & Specific) */
/* -------------------------------------------------------------------------- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.65);
    z-index: 1002;
    justify-content: center;
    align-items: center;
    padding-top: 2vh;
    padding-bottom: 2vh;
}

.modal-content {
    background-color: var(--content-bg);
    padding: 1rem;
    border-radius: var(--border-radius-medium);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    width: 90%;
    max-width: 500px;
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.modal-content::-webkit-scrollbar {
    display: none;
}

.modal-close-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
}

.modal-close-btn:hover {
    color: var(--text-primary);
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 0.6rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.4rem;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
}

.modal-content p {
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    line-height: 1.4;
}

.modal-content p strong {
    color: var(--text-primary);
    min-width: 120px;
    display: inline-block;
    margin-right: 0.6rem;
    font-weight: 500;
}

.modal-content p span {
    flex-grow: 1;
    word-break: break-word;
    overflow-wrap: break-word;
}

#modal-type-specific-details {
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px dashed var(--border-light);
}

#modal-type-specific-details h4 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 0.6rem;
    font-weight: 500;
}

#modal-type-specific-details p {
    font-size: 0.85rem;
}

#modal-type-specific-details .progress-bar-container {
    width: 100%;
    background-color: var(--progress-bar-track-bg);
    border-radius: var(--border-radius-small);
    height: 18px;
    margin-top: 0.4rem;
    margin-bottom: 0.2rem;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
}

#modal-type-specific-details .progress-bar-fill {
    height: 100%;
    border-radius: var(--border-radius-small) 0 0 var(--border-radius-small);
    transition: width 0.5s ease-in-out, background-color 0.5s ease-in-out;
}

#modal-type-specific-details .progress-bar-fill:only-child {
    border-radius: var(--border-radius-small);
}

#modal-type-specific-details .progress-bar-text-left,
#modal-type-specific-details .progress-bar-text-right {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0 0.3rem;
    white-space: nowrap;
    z-index: 1;
    color: #ffffff;
    text-shadow: 0px 0px 3px rgba(0, 0, 0, 0.65);
}

body[data-theme="dark"] #modal-type-specific-details .progress-bar-text-left,
body[data-theme="dark"] #modal-type-specific-details .progress-bar-text-right {
    color: #f0f0f0;
    text-shadow: none;
}

#modal-type-specific-details .progress-bar-text-left {
    left: 0.3rem;
}

#modal-type-specific-details .progress-bar-text-right {
    right: 0.3rem;
}

#modal-type-specific-details .utilization-text {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: block;
    text-align: right;
    margin-top: 0.1rem;
}

.modal-search-container {
    margin-bottom: 0.75rem;
}

.modal-search-container input[type="text"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-input);
    border-radius: var(--border-radius-medium);
    font-size: 0.9rem;
    background-color: var(--input-bg);
    color: var(--text-primary);
}

.modal-items-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
    max-height: calc(80vh - 100px);
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-medium);
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.modal-items-list::-webkit-scrollbar {
    display: none;
}

.modal-selection-item {
    padding: 5px 8px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.2s ease;
    line-height: 1.3;
}

.modal-selection-item:last-child {
    border-bottom: none;
}

.modal-selection-item:hover {
    background-color: var(--modal-item-hover-bg);
    color: var(--modal-item-hover-text);
}

.modal-selection-item.modal-item-non-selectable {
    background-color: var(--filter-section-bg);
    color: var(--text-secondary);
    cursor: default;
}

body[data-theme="dark"] .modal-selection-item.modal-item-non-selectable {
    background-color: var(--sidebar-bg-secondary);
    color: var(--sidebar-text-secondary);
}

body[data-theme="dark"] .modal-selection-item.modal-item-non-selectable:hover {
    background-color: var(--sidebar-bg-secondary);
    color: var(--sidebar-text-secondary);
}

.modal-selection-item strong {
    font-size: 0.9rem;
    line-height: 1.2;
}

.modal-selection-item small {
    font-size: 0.8em;
    line-height: 1.1;
}

body[data-theme="dark"] .modal-selection-item:hover small {
    color: var(--sidebar-text-secondary);
}

.modal-selection-item.template-item strong {
    color: var(--text-accent);
}

#admin-edit-user-modal form div {
    margin-bottom: 0.8rem;
}

#admin-edit-user-modal form label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

#admin-edit-user-modal form select,
#admin-edit-user-modal form input[type="date"] {
    width: 100%;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--border-input);
    border-radius: var(--border-radius-medium);
    font-size: 0.9rem;
    background-color: var(--input-bg);
    color: var(--text-primary);
    line-height: 1.4;
}

#admin-edit-user-modal form select:focus,
#admin-edit-user-modal form input[type="date"]:focus {
    border-color: var(--text-accent);
    box-shadow: 0 0 0 3px var(--input-focus-shadow);
    outline: none;
}

#admin-edit-user-modal form button[type="submit"] {
    display: inline-block;
    width: auto;
    min-width: 150px;
    padding: 0.6rem 1.2rem;
    background-color: var(--button-primary-bg);
    color: var(--button-primary-text);
    border: none;
    border-radius: var(--border-radius-medium);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out;
    margin-top: 0.6rem;
}

#admin-edit-user-modal form button[type="submit"]:hover {
    background-color: var(--button-primary-hover-bg);
}

#admin-edit-user-modal hr {
    margin: 1.25rem 0;
    border: 0;
    border-top: 1px solid var(--border-light);
}

#admin-edit-user-modal h4 {
    font-size: 1.05rem;
    color: var(--text-accent);
    margin-top: 1.25rem;
    margin-bottom: 0.15rem;
    padding-bottom: 0.15rem;
    border-bottom: 1px dashed var(--border-light);
    font-weight: 500;
}

#admin-edit-user-modal p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

#admin-reset-user-password-btn {
    background-color: var(--button-danger-bg);
    color: var(--button-danger-text);
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--border-radius-medium);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out;
    display: inline-block;
    width: auto;
}

#admin-reset-user-password-btn:hover {
    background-color: var(--button-danger-hover-bg);
}

#admin-edit-user-modal #admin-user-stats-content {
    font-size: 0.9rem;
    margin-top: 0.15rem;
    margin-bottom: 0.15rem;
    padding-left: 0.6rem;
}

#admin-edit-user-modal #admin-user-stats-content p {
    margin-bottom: 0.15rem;
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
}

#admin-edit-user-modal #admin-user-stats-content p strong {
    min-width: auto;
    margin-left: 0.15rem;
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
}

#admin-edit-user-modal .modal-content {
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

#admin-edit-user-modal .modal-content::-webkit-scrollbar {
    display: none;
}

/* Settings Page Styles */
/* -------------------------------------------------------------------------- */
#settings-view .settings-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.settings-card {
    background-color: var(--content-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-large);
    padding: 1.5rem;
    box-shadow: var(--shadow-color-light) 0px 2px 8px;
}

.settings-card h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.settings-card .settings-list {
    gap: 1rem;
}

.settings-card .settings-list li {
    list-style-type: none !important;
}

.font-size-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.font-size-control button {
    border: 1px solid var(--border-input);
    background-color: var(--input-bg);
    color: var(--text-primary);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    line-height: 26px;
    text-align: center;
    transition: background-color 0.2s, border-color 0.2s;
}

.font-size-control button:hover {
    background-color: var(--modal-item-hover-bg);
    border-color: var(--text-accent);
}

.font-size-control span {
    font-weight: 500;
    min-width: 40px;
    text-align: center;
    color: var(--text-accent);
}



/* Utility & Helper Styles */
/* -------------------------------------------------------------------------- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.developer-credit-auth {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 1.8rem;
    padding-bottom: 0.6rem;
}

#offline-indicator {
    display: none;
    background: #ffc107;
    color: black;
    text-align: center;
    padding: 10px;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 2000;
}

.button-danger {
    background-color: var(--button-danger-bg) !important;
    color: var(--button-danger-text) !important;
}

.button-danger:hover {
    background-color: var(--button-danger-hover-bg) !important;
}

.button-danger:disabled {
    background-color: var(--text-muted) !important;
    opacity: 0.65;
    cursor: not-allowed;
}

#transaction-form button[type="submit"],
#create-account-form button[type="submit"],
#create-category-form button[type="submit"],
#recurring-payment-form button[type="submit"],
#change-password-form button[type="submit"] {
    display: inline-block;
    width: auto;
    min-width: 150px;
    padding: 0.6rem 1.2rem;
    background-color: var(--button-primary-bg);
    color: var(--button-primary-text);
    border: none;
    border-radius: var(--border-radius-medium);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out;
    margin-top: 0.6rem;
}

#transaction-form button[type="submit"]:hover,
#create-account-form button[type="submit"]:hover,
#create-category-form button[type="submit"]:hover,
#recurring-payment-form button[type="submit"]:hover,
#change-password-form button:hover[type="submit"] {
    background-color: var(--button-primary-hover-bg);
}

#cancel-edit-account-btn,
#cancel-edit-category-btn,
#cancel-edit-rp-btn,
#delete-all-data-btn,
#delete-account-btn,
#logout-button-sidebar,
#cancel-split-btn,
.button-danger {
    display: inline-block;
    width: auto;
    min-width: 150px;
    padding: 0.6rem 1.2rem;
    background-color: var(--button-danger-bg);
    color: var(--button-primary-text);
    border: none;
    border-radius: var(--border-radius-medium);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out;
    margin-top: 0.6rem;
}

#cancel-edit-account-btn:hover,
#cancel-edit-category-btn:hover,
#cancel-edit-rp-btn:hover,
.button-danger:hover {
    background-color: var(--button-danger-hover-bg);
}

.danger-option-info {
    color: var(--text-danger);
    margin-top: 1.2rem;
}

.split-summary {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background-color: var(--filter-section-bg);
    border-radius: var(--border-radius-medium);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.split-summary strong {
    font-weight: 600;
    color: var(--text-accent);
}

.split-item-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--border-light);
}

.split-item-row>div {
    flex-grow: 1;
}

.remove-split-item-btn {
    background: var(--button-danger-bg);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 26px;
    padding: 0;
}

.remove-split-item-btn:hover {
    background: var(--button-danger-hover-bg);
}

#confirm-split-btn:disabled {
    background-color: var(--text-muted);
    cursor: not-allowed;
}

.split-item-row+.split-item-row label {
    display: none;
}

#generic-modal-input {
    width: 100%;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--border-input);
    border-radius: var(--border-radius-medium);
    font-size: 0.9rem;
    background-color: var(--input-bg);
    color: var(--text-primary);
}

#generic-modal-buttons button {
    min-width: 100px;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--border-radius-medium);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out;
}

.generic-modal-confirm-btn {
    background-color: var(--button-primary-bg);
    color: var(--button-primary-text);
}

.generic-modal-confirm-btn:hover {
    background-color: var(--button-primary-hover-bg);
}

.generic-modal-cancel-btn {
    background-color: var(--button-danger-bg);
    color: var(--button-danger-text);
}

.generic-modal-cancel-btn:hover {
    background-color: var(--button-danger-hover-bg);
}

#generic-modal-message {
    white-space: pre-wrap;
}

#change-password-message-area {
    color: var(--expense-color);
    font-size: 0.9rem;
    min-height: 1.3em;
}

#rp-notes {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-input);
    border-radius: 4px;
    font-size: 0.9rem;
    background-color: var(--input-bg);
    color: var(--text-primary);
}

/* Wrapper for the input/textarea and the button */
.input-with-button-wrapper {
    position: relative;
}

/* Adjust input and textarea to make space for the button on the right */
.input-with-button-wrapper input[type="text"],
.input-with-button-wrapper textarea {
    /* This padding is crucial. It prevents text from being written under the button. */
    padding-right: 35px;
}

/* Replace your existing .add-label-btn rule with this one */
.add-label-btn {
    position: absolute;
    top: 50%;
    right: 8px;
    /* Position from the right edge of the wrapper */
    transform: translateY(-50%);
    /* This vertically centers the button */

    /* Styling for a clean, subtle look */
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 1rem;
    line-height: 1;
    height: auto;
    /* Ensure height doesn't interfere with positioning */
    width: auto;
    /* Ensure width doesn't interfere with positioning */
}

.add-label-btn:hover {
    color: var(--text-accent);
}

.income-color {
    color: var(--income-color) !important;
}

.expense-color {
    color: var(--expense-color) !important;
}

/* --- START: Consolidated Chart Bar Report Styles --- */

/* Main wrapper for the chart and its axis */
#chart-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: auto;
    margin-top: 1.5rem;
}

/* Container for all the horizontal bar items */
#simple-bar-chart-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
    width: 100%;
    border-left: 1px solid var(--border-color);
}

/* Container for a single row (label + bar) */
.chart-bar-item {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    height: 30px;
    margin-bottom: 5px;
}

/* The visual horizontal bar itself */
.chart-bar {
    height: 100%;
    background-color: var(--primary-accent-color);
    border: 1px solid var(--primary-accent-hover-color);
    border-radius: 0 var(--border-radius-small) var(--border-radius-small) 0;
    transition: width 0.3s ease, background-color 0.2s ease;
}

.chart-bar:hover {
    opacity: 0.8;
}

/* The category name label on the left of each bar */
.chart-label {
    font-size: 0.8rem;
    color: var(--text-primary);
    white-space: nowrap;
    text-align: left;
    width: 120px;
    padding-right: 10px;
    padding-left: 2px;
    flex-shrink: 0;
}

/* The X-axis container at the bottom */
#chart-y-axis {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    padding-top: 5px;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-shrink: 0;
    padding-left: 0px;
}

/* Find and REPLACE any previous rules for the labels with this complete set. */
#chart-y-axis>.y-axis-label {
    /* Center-align the middle labels ("20%", "40%", etc.) */
    text-align: center;
    flex: 1;
    /* Allow middle labels to share space equally */
}

#chart-y-axis>.y-axis-label:first-child {
    /* Align the first label ("0%") to the left */
    text-align: left;
    /* CRITICAL FIX: Do not allow this element to grow or take extra space */
    flex-grow: 0;
}

#chart-y-axis>.y-axis-label:last-child {
    /* Align the last label ("100%") to the right */
    text-align: right;
    /* CRITICAL FIX: Do not allow this element to grow or take extra space */
    flex-grow: 0;
}

/* Tooltip that appears on hover */
.chart-bar-item .tooltip {
    visibility: hidden;
    width: auto;
    min-width: 160px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text-primary);
    text-align: center;
    border-radius: var(--border-radius-medium);
    padding: 8px;
    position: absolute;
    z-index: 1;
    left: 130px;
    bottom: 105%;
    margin-left: 0;
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
}

.chart-bar-item:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

/* Base styles for the value label (Amount + Percentage) */
.chart-bar-value {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1;
    transition: color 0.3s ease, left 0.3s ease;
}

/* Style for placing the label OUTSIDE the bar */
.chart-bar-value.outside {
    /* Position it just to the right of the bar's end */
    left: calc(var(--bar-width) + 5px);

}

/* Style for placing the label INSIDE the bar */
.chart-bar-value.inside {
    /* Position it just inside the right edge of the bar */
    right: 5px;
    color: var(--text-primary);
}

/* The total amount line displayed below the chart */
.report-total-line {
    margin-bottom: 0.25rem;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: center;
    background-color: var(--filter-section-bg);
    padding: 0.5rem;
    border-radius: var(--border-radius-medium);
}

/* --- END: Consolidated Chart Bar Report Styles --- */


.modal-content form button[type="submit"] {
    display: block;
    width: 100%;
    padding: 0.7rem;
    background-color: var(--text-accent);
    color: var(--button-primary-text);
    border: none;
    border-radius: var(--border-radius-medium);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    margin-top: 1rem;
    transition: background-color 0.2s ease-in-out;
}

.modal-content form button[type="submit"]:hover {
    background-color: var(--primary-accent-hover-color);
}

#forgot-password-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.85);
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: var(--border-radius-medium);
    transition: background-color 0.3s ease;
}

body[data-theme="dark"] #forgot-password-loader {
    background-color: rgba(33, 42, 51, 0.85);
}

#forgot-password-loader .fa-spinner {
    font-size: 2.5rem;
    color: var(--primary-accent-color);
}

#forgot-password-loader p {
    margin-top: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* This rule makes the container a positioning context for the loader */
#register-view {
    position: relative;
}

#register-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.85);
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: var(--border-radius-large);
    transition: background-color 0.3s ease;
}

body[data-theme="dark"] #register-loader {
    background-color: rgba(33, 42, 51, 0.85);
}

#register-loader .fa-spinner {
    font-size: 2.5rem;
    color: var(--primary-accent-color);
}

#register-loader p {
    margin-top: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Budget Management View */
#budget-form div {
    margin-bottom: 1rem;
}

#cancel-edit-budget-btn {
    background-color: var(--button-danger-bg);
    color: var(--button-danger-text);
    margin-left: 10px;
}

#cancel-edit-budget-btn:hover {
    background-color: var(--button-danger-hover-bg);
}

.multi-select-container {
    border: 1px solid var(--border-input);
    border-radius: var(--border-radius-medium);
    padding: 0.5rem;
    max-height: 150px;
    overflow-y: auto;
    background-color: var(--input-bg);
}

.multi-select-container label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: normal;
    cursor: pointer;
}

.multi-select-container input[type="checkbox"] {
    margin-right: 0.5rem;
}

#existing-budgets-list .budget-item {
    background-color: var(--content-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-medium);
    padding: 0.8rem 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#existing-budgets-list .budget-details {
    flex-grow: 1;
}

#existing-budgets-list .budget-details strong {
    font-size: 1.05rem;
    color: var(--text-primary);
}

#existing-budgets-list .budget-details small {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Budget Progress Bar on Dashboard */
#budget-progress-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.budget-progress-item {
    display: flex;
    flex-direction: column;
}

.budget-progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.budget-progress-name {
    font-weight: 500;
    color: var(--text-primary);
}

.budget-progress-values {
    color: var(--text-secondary);
}

.budget-progress-bar {
    width: 100%;
    height: 20px;
    background-color: var(--progress-bar-track-bg);
    border-radius: var(--border-radius-medium);
    overflow: hidden;
    position: relative;
}

.progress-bar-fill-budget {
    height: 100%;
    border-radius: var(--border-radius-medium);
    transition: width 0.5s ease-in-out;
}

.budget-progress-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 2;
    /* Ensures text is on top of the bar */
    pointer-events: none;
    /* Makes the text non-interactive */
}

/* Specific styles for budget types */
.progress-bar-fill-budget.type-savings {
    background-color: var(--transfer-color);
    /* Neutral color that transitions to green */
}

.progress-bar-fill-budget.type-income {
    /* Starts Red, goes to Yellow at 50%, ends Green at 100% */
    /*background: linear-gradient(to right, #e74c3c, #f1c40f 50%, #2ecc71);*/
}

.progress-bar-fill-budget.type-expense {
    /* Starts Green, goes to Yellow at 50%, ends Red at 100% */
    /*background: linear-gradient(to right, #2ecc71, #f1c40f 50%, #e74c3c);*/
}

/* Upgrade Button in Sidebar */
#nav-upgrade-account-item a {
    background-color: var(--income-color);
    color: white !important;
    font-weight: 600 !important;
    border-left-color: #f1c40f !important;
}

#nav-upgrade-account-item a:hover {
    background-color: var(--button-primary-hover-bg);
}

/* Subscription Plans Page */

.payment-method-fields {
    display: none;
}

.plans-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.plan-card {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-large);
    padding: 1.5rem;
    text-align: center;
    background-color: var(--content-bg);
    box-shadow: 0 4px 12px var(--shadow-color-light);
    display: flex;
    flex-direction: column;
}

.plan-card h3 {
    font-size: 1.4rem;
    color: var(--text-accent);
    margin: 0 0 0.5rem 0;
}

.plan-card .price {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.plan-card .price span {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
}

.plan-card .features-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
    flex-grow: 1;
}

.plan-card .features-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.plan-card .features-list li:last-child {
    border-bottom: none;
}

.plan-card .subscribe-btn {
    padding: 0.8rem;
    font-size: 1rem;
    font-weight: 600;
    background-color: var(--button-primary-bg);
    color: var(--button-primary-text);
    border: none;
    border-radius: var(--border-radius-medium);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.plan-card .subscribe-btn:hover {
    background-color: var(--button-primary-hover-bg);
}

/* Admin Panel Additions */
#admin-upgrade-requests-list .request-item {
    border: 1px solid var(--border-color);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: var(--border-radius-medium);
}

#admin-upgrade-requests-list .request-item p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

#admin-upgrade-requests-list .request-actions {
    margin-top: 1rem;
}

#admin-plan-form {
    display: grid;
    gap: 1rem;
}

#admin-plan-form textarea {
    min-height: 80px;
}

/* --- Flatpickr Dark Theme Styles --- */
body[data-theme="dark"] .flatpickr-calendar {
    background: var(--content-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 3px 13px var(--shadow-color-dark);
    color: var(--text-primary);
}

body[data-theme="dark"] .flatpickr-month {
    color: var(--text-primary);
}

body[data-theme="dark"] .flatpickr-current-month .flatpickr-monthDropdown-months,
body[data-theme="dark"] .flatpickr-current-month input.cur-year {
    background: var(--content-bg);
    color: inherit;
    font-weight: 500;
}

body[data-theme="dark"] .flatpickr-weekday {
    color: var(--text-accent);
    font-weight: 500;
}

body[data-theme="dark"] .flatpickr-day {
    color: var(--text-primary);
}

body[data-theme="dark"] .flatpickr-day:hover,
body[data-theme="dark"] .flatpickr-day:focus {
    background: var(--sidebar-hover-bg);
    border-color: var(--sidebar-hover-bg);
    outline: none;
}

body[data-theme="dark"] .flatpickr-day.today {
    border-color: var(--text-accent);
}

body[data-theme="dark"] .flatpickr-day.today:hover,
body[data-theme="dark"] .flatpickr-day.today:focus {
    background: var(--text-accent);
    border-color: var(--text-accent);
    color: var(--button-primary-text);
}

body[data-theme="dark"] .flatpickr-day.selected,
body[data-theme="dark"] .flatpickr-day.startRange,
body[data-theme="dark"] .flatpickr-day.endRange {
    background: var(--primary-accent-color);
    border-color: var(--primary-accent-color);
    color: var(--button-primary-text);
}

body[data-theme="dark"] .flatpickr-day.disabled,
body[data-theme="dark"] .flatpickr-day.prevMonthDay,
body[data-theme="dark"] .flatpickr-day.nextMonthDay {
    color: var(--text-muted);
    opacity: 0.7;
}

body[data-theme="dark"] .flatpickr-time {
    border-top: 1px solid var(--border-color);
}

body[data-theme="dark"] .flatpickr-time .numInput,
body[data-theme="dark"] .flatpickr-time .numInput:hover {
    background: transparent;
    color: inherit;
}

body[data-theme="dark"] .flatpickr-time .flatpickr-am-pm:hover {
    background: var(--sidebar-hover-bg);
}

body[data-theme="dark"] .flatpickr-prev-month,
body[data-theme="dark"] .flatpickr-next-month {
    fill: var(--text-primary);
}

body[data-theme="dark"] .flatpickr-prev-month:hover,
body[data-theme="dark"] .flatpickr-next-month:hover {
    fill: var(--primary-accent-color);
}

.flatpickr-input {
    padding: 0rem;
    font-size: 0.85rem;
    line-height: 1.0;
    height: auto;
    /* Allows the field to resize based on padding/font */
}

/* --- Styles for Label Action Buttons --- */
.delete-label-btn {
    margin-left: 0.25rem;
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;

    /* Use theme variables for colors */
    background-color: var(--border-light);
    color: var(--text-secondary);
}

.delete-label-btn i {
    font-size: 0.9rem;
}

/* Use theme variables for the hover effect */
.delete-label-btn:hover {
    color: var(--button-primary-text);
    background-color: var(--button-danger-bg);
    border-color: var(--button-danger-hover-bg);
}

/* --- Styles for Label Management List --- */
#existing-labels-list .simple-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

#existing-labels-list .label-list-item {
    /* These styles are copied from the .template-list-item for consistency */
    background-color: var(--content-bg);
    border: 1px solid var(--border-light);
    border-left-width: 5px;
    border-left-color: #7f8c8d;
    /* Using the same accent color as templates */
    border-radius: var(--border-radius-medium);
    padding: 0.7rem 1rem;
    margin-bottom: 0.6rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 6px var(--shadow-color-light);
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, background-color 0.3s ease;
}

/* This adds the "lift" effect on hover, just like the templates list */
#existing-labels-list .label-list-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color-medium);
}

/* This keeps the last item from having a border-bottom, which is now redundant */
#existing-labels-list .label-list-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

#existing-labels-list .label-list-item:last-child {
    border-bottom: none;
}

#recurring-payment-form .custom-select-wrapper:not(.custom-select-disabled-in-edit)>.custom-select-display[readonly] {
    background-color: var(--input-bg);
    opacity: 1;
    cursor: pointer;
}

#recurring-payment-form .custom-datepicker {
    cursor: pointer;
}

/* --- Styles for Header Status Badge in Settings --- */
.status-badge-header {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    border-radius: 1rem; /* pill shape */
    margin-left: 0.75rem;
    text-transform: capitalize;
}

/* Colors for different statuses */
.status-badge-header.status-free {
    background-color: var(--text-muted);
    color: var(--button-primary-text);
}
.status-badge-header.status-paid {
    background-color: var(--income-color);
    color: var(--button-primary-text);
}
.status-badge-header.status-admin {
    background-color: var(--expense-color);
    color: var(--button-primary-text);
}

.status-expiry-header {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: -0.75rem; /* Pulls it closer to the h2 */
    margin-bottom: 1.5rem;
}

/* Media Queries (Responsive Styles) */
/* -------------------------------------------------------------------------- */
@media (max-width: 860px) {

    html {
        font-size: var(--base-font-size);
    }

    .dashboard-summary-and-filters-container {
        flex-direction: column;
    }

    #summary {
        flex-basis: auto;
        width: 100%;
        margin-bottom: 1rem;
    }

    .dashboard-summary-and-filters-container>#summary:only-child,
    .dashboard-summary-and-filters-container>#summary:last-child {
        margin-bottom: 0;
    }

    .filter-info-span {
        margin-bottom: 0.5rem;
    }

    #admin-stats-overview .admin-date-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .flatpickr-input {
        padding: 0.35rem 0.5rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {

    html {
        font-size: var(--base-font-size);
    }

    .app-header {
        padding: 0 0.8rem;
        height: 4rem;
    }

    #main-content-wrapper {
        padding-top: 4rem;
    }

    .header-logo {
        height: 3.2rem;
    }

    #sidebar-toggle-btn {
        margin-right: 0.6rem;
        font-size: 1.3rem;
    }

    .app-view {
        padding: 1rem;
    }

    .app-view h2,
    #app-content h2,
    #account-overview-section h2,
    #transactions-section h2,
    #create-account-form-container h3,
    #existing-accounts-list h3,
    #create-category-form h3,
    #existing-categories-list h3,
    #recurring-management-view h2,
    #recurring-payment-form h3,
    #existing-recurring-payments-list-container h3,
    #reports-master-section h2 {
        font-size: 1.1rem;
    }

    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    textarea {
        padding: 0.6rem 0.7rem;
        font-size: 0.9rem;
    }

    #transaction-search-input {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    .custom-select-display {
        padding-top: 0.6rem;
        padding-bottom: 0.6rem;
        padding-left: 0.7rem;
        padding-right: 34px;
    }

    .settings-list .custom-select-display {
        padding-top: 0.35rem;
        padding-bottom: 0.35rem;
        padding-left: 0.6rem;
        padding-right: 32px;
    }

    #transaction-form button[type="submit"],
    #create-account-form button[type="submit"],
    #create-category-form button[type="submit"],
    #cancel-edit-account-btn,
    #cancel-edit-category-btn,
    #cancel-edit-rp-btn {
        font-size: 0.9rem;
        padding: 0.6rem 1.1rem;
    }

    .account-block {
        flex-basis: calc(50% - 0.4rem);
        max-width: calc(50% - 0.4rem);
        min-height: 70px;
        padding: 0.5rem;
    }

    .account-block .account-name {
        font-size: 0.85rem;
    }

    .account-block .account-balance {
        font-size: 1rem;
    }

    .dashboard-transactions-container {
        padding: 0.8rem;
    }

    .transaction-item {
        display: flex;
        flex-direction: row;
        /* Keep it as a horizontal row */
        justify-content: space-between;
        /* Push details and amount apart */
        align-items: flex-start;
        /* Align items to the top */
        padding: 0.5rem;
        margin-bottom: 0.4rem;
    }

    .transaction-item .details {
        flex-grow: 1;
        /* Allow details section to take available space */
        width: auto;
        /* Remove fixed width */
        margin-bottom: 0;
        margin-right: 0.5rem;
        /* Add a little space */
    }

    .transaction-item .amount-section {
        display: flex;
        flex-direction: column;
        /* Stack amount and buttons vertically */
        align-items: flex-end;
        /* Right-align the content */
        text-align: right;
        flex-shrink: 0;
        /* Prevent this section from shrinking */
        width: auto;
        margin-top: 0;
    }

    /* Add this new rule for better spacing */
    .transaction-item span.amount-display {
        margin-bottom: 4px;
    }

    .transaction-item span.amount-display {
        margin-right: 0.5rem;
        font-size: 0.95rem;
    }

    .transaction-item .actions {
        margin-top: 0;
        flex-shrink: 0;
    }

    .transaction-item .details strong {
        font-size: 0.9rem;
        margin-bottom: 0;
    }

    .transaction-item .details small {
        font-size: 0.75rem;
        line-height: 1.2;
        margin-top: 0;
    }

    .transaction-item .actions button {
        font-size: 0.8rem;
        padding: 0.2rem 0.35rem;
    }

    .transaction-item .actions button i {
        font-size: 0.85rem;
    }

    #summary {
        padding: 0.7rem;
    }

    #summary p {
        font-size: 0.85rem;
        padding-bottom: 0.3rem;
        margin-bottom: 0.3rem;
    }

    #summary p span {
        font-size: 0.85rem;
    }

    #total-income,
    #total-expenses,
    #net-balance {
        font-size: 0.8rem;
        padding: 0.1rem 0.3rem;
    }

    #summary #summary-note {
        font-size: 0.7rem;
        padding: 0.3rem;
        margin-top: 0.5rem;
    }

    .transaction-date-header {
        font-size: 1rem;
        padding: 0.3rem 0.5rem;
    }

    .transaction-date-group .transaction-item {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
        width: calc(100% - 1rem);
    }

    .date-filters-container {
        width: 100%;
        align-items: stretch;
    }

    .inline-date-filters {
        justify-content: space-between;
    }

    .inline-date-filters input[type="date"] {
        flex-grow: 1;
    }

    .preset-date-filters {
        margin-top: 0.5rem;
        justify-content: flex-end;
    }

    .auth-page-logo {
        height: 100px;
        margin-bottom: 1.2rem;
    }

    #multi-currency-transfer-fields label,
    #preferred-currency-rate-field label {
        margin-right: 0.7rem;
        display: inline-block;
        margin-bottom: 0.3rem;
        font-size: 0.85rem;
    }

    #multi-currency-transfer-fields div>label:first-child,
    #preferred-currency-rate-field label:first-of-type {
        margin-bottom: 0.5rem;
    }

    #account-overview-section h2 .filter-info-span,
    #transactions-section h2 .filter-info-span,
    #summary h3 .filter-info-span {
        margin-left: 0;
        margin-top: 0.3rem;
        font-size: 0.7rem;
        display: block;
        margin-bottom: 0.5rem;
    }

    .modal-content {
        width: 92%;
        /* Make the modal wider on tablets */
        max-width: none;
        /* Remove the 500px desktop width limit */
        padding: 1rem;
    }

    .modal-content h3 {
        font-size: 1.1rem;
        margin-bottom: 0.6rem;
        padding-bottom: 0.4rem;
    }

    .modal-search-container input[type="text"] {
        padding: 0.4rem;
        font-size: 0.8rem;
    }

    .modal-selection-item {
        padding: 5px 7px;
    }

    .modal-selection-item strong {
        font-size: 0.85rem;
    }

    .modal-selection-item small {
        font-size: 0.75em;
    }

    .modal-content p {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    .modal-content p strong {
        min-width: 100px;
        font-size: 0.9rem;
        margin-right: 0.5rem;
    }

    .modal-content p span {
        font-size: 0.85rem;
    }

    #modal-type-specific-details h4 {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
    }

    #modal-type-specific-details p {
        font-size: 0.8rem;
    }

    .progress-bar-text-left,
    .progress-bar-text-right {
        font-size: 0.65rem;
        padding: 0 0.15rem;
    }

    .progress-bar-container {
        height: 16px;
    }

    .recurring-payment-item .rp-description {
        font-size: 0.95rem;
    }

    .recurring-payment-item .rp-amount {
        font-size: 0.95rem;
    }

    .recurring-payment-item .rp-schedule-details small {
        font-size: 0.75rem;
    }

    .recurring-payment-item .rp-actions button {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }

    #admin-stats-content {
        grid-template-columns: 1fr;
    }

    #admin-user-list-table-container .report-table th,
    #admin-user-list-table-container .report-table td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    #admin-user-list-table-container .report-table td button {
        padding: 0.25rem 0.45rem;
        font-size: 0.75rem;
        display: inline-block;
        margin-bottom: 0.25rem;
    }

    #admin-user-list-table-container {
        overflow-x: auto;
    }

    #admin-stats-overview .admin-date-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .flatpickr-input {
        padding: 0.35rem 0.5rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 500px) {

    html {
        font-size: var(--base-font-size);
    }

    .app-header {
        height: 3.8rem;
    }

    #main-content-wrapper {
        padding-top: 3.8rem;
    }

    .header-logo {
        height: 4rem;
    }

    #sidebar-toggle-btn {
        font-size: 1.2rem;
    }

    .app-view {
        padding: 0.1rem;
    }

    .sidebar {
        width: 200px;
    }

    .sidebar-nav li a {
        padding: 0.6rem 0.9rem;
        font-size: 0.85rem;
    }

    .sidebar-nav li a i {
        margin-right: 0.6rem;
    }

    .sidebar-title {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .settings-list .theme-toggle-label,
    .settings-list .setting-label {
        font-size: 0.8rem;
        gap: 0.4rem;
    }

    .theme-switch {
        width: 44px;
        height: 22px;
    }

    .theme-slider:before {
        height: 16px;
        width: 16px;
        left: 3px;
        bottom: 3px;
    }

    input:checked+.theme-slider:before {
        transform: translateX(20px);
    }

    .settings-list .custom-select-display {
        font-size: 0.75rem;
        padding-top: 0.35rem;
        padding-bottom: 0.35rem;
        padding-left: 0.55rem;
        padding-right: 30px;
    }

    .app-view h2,
    #app-content h2,
    #account-overview-section h2,
    #transactions-section h2,
    #create-account-form-container h3,
    #existing-accounts-list h3,
    #create-category-form h3,
    #existing-categories-list h3,
    #recurring-management-view h2,
    #recurring-payment-form h3,
    #existing-recurring-payments-list-container h3,
    #reports-master-section h2 {
        font-size: 1.05rem;
    }

    #account-blocks-container {
        gap: 0.3rem;
    }

    .account-block {
        flex-basis: calc(50% - 0.25rem);
        max-width: calc(50% - 0.25rem);
        min-height: 65px;
        padding: 0.4rem;
    }

    .account-block .account-name {
        font-size: 0.8rem;
    }

    .account-block .account-balance {
        font-size: 0.95rem;
    }

    .account-block .add-transaction-btn {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
        line-height: 20px;
    }

    .dashboard-transactions-container {
        padding: 0.1rem;
    }

    #transaction-search-input {
        padding: 0.4rem;
        font-size: 0.8rem;
    }

    #summary-header-with-filters h3 {
        width: 100%;
        text-align: center;
        margin-right: 0;
    }

    .filter-info-span {
        margin-bottom: 0.5rem;
    }

    .date-filters-container {
        width: 100%;
        align-items: stretch;
    }

    .inline-date-filters {
        flex-direction: column;
        gap: 0.4rem;
        justify-content: stretch;
        width: 100%;
    }

    .inline-date-filters input[type="date"] {
        width: 100%;
        max-width: none;
    }

    .preset-date-filters {
        justify-content: space-between;
        gap: 0.4rem;
    }

    .preset-filter-btn {
        flex-grow: 1;
        font-size: 0.7rem;
        padding: 0.35rem 0.45rem;
    }

    #transaction-form label,
    #create-account-form label,
    #create-category-form label,
    #recurring-payment-form label {
        font-size: 0.85rem;
        margin-bottom: 0.2rem;
    }

    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    textarea {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    .custom-select-display {
        padding-top: 0.6rem;
        padding-bottom: 0.6rem;
        padding-left: 0.6rem;
        padding-right: 34px;
    }

    #transaction-form button[type="submit"],
    #create-account-form button[type="submit"],
    #create-category-form button[type="submit"],
    #cancel-edit-account-btn,
    #cancel-edit-category-btn,
    #cancel-edit-rp-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .conditional-fields {
        padding-left: 0.7rem;
        margin-top: 0.5rem;
        margin-bottom: 0.7rem;
    }

    .transaction-item {
        padding: 0.4rem 0.5rem;
        margin-bottom: 0.3rem;
    }

    .transaction-item .details {
        margin-bottom: 0.3rem;
    }

    .transaction-item .details strong {
        font-size: 0.9rem;
        margin-bottom: 0;
    }

    .transaction-item .details small {
        font-size: 0.75rem;
        line-height: 1.2;
        margin-top: 0.5px;
    }

    .transaction-item span.amount-display {
        font-size: 0.9rem;
    }

    .transaction-item .actions button {
        font-size: 0.8rem;
        padding: 0.25rem 0.35rem;
    }

    .transaction-item .actions button i {
        font-size: 0.85rem;
    }

    #summary {
        padding: 0.6rem;
    }

    #summary p {
        font-size: 0.8rem;
        padding-bottom: 0.25rem;
        margin-bottom: 0.25rem;
    }

    #summary p span {
        font-size: 0.8rem;
    }

    #total-income,
    #total-expenses,
    #net-balance {
        font-size: 0.75rem;
        padding: 0.1rem 0.25rem;
    }

    #summary #summary-note {
        font-size: 0.65rem;
        padding: 0.3rem;
        margin-top: 0.4rem;
    }

    .transaction-date-header {
        font-size: 0.95rem;
        padding: 0.25rem 0.4rem;
    }

    .transaction-date-group .transaction-item {
        margin-left: 0.2rem;
        margin-right: 0.2rem;
        width: calc(100% - 0.4rem);
    }

    .auth-page-logo {
        height: 80px;
        margin-bottom: 1rem;
    }

    .modal-content {
        padding: 1rem;
    }

    .modal-content h3 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
        padding-bottom: 0.3rem;
    }

    .modal-search-container input[type="text"] {
        padding: 0.3rem;
        font-size: 0.75rem;
    }

    .modal-selection-item {
        padding: 4px 6px;
    }

    .modal-selection-item strong {
        font-size: 0.8rem;
    }

    .modal-selection-item small {
        font-size: 0.7em;
    }

    .modal-content p {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }

    .modal-content p strong {
        min-width: 90px;
        font-size: 0.8rem;
        margin-right: 0.4rem;
    }

    .modal-content p span {
        font-size: 0.8rem;
    }

    #modal-type-specific-details h4 {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }

    #modal-type-specific-details p {
        font-size: 0.75rem;
    }

    .progress-bar-text-left,
    .progress-bar-text-right {
        font-size: 0.6rem;
        padding: 0 0.1rem;
    }

    .progress-bar-container {
        height: 14px;
    }

    .recurring-payment-item .rp-description {
        font-size: 0.9rem;
    }

    .recurring-payment-item .rp-amount {
        font-size: 0.9rem;
    }

    .recurring-payment-item .rp-schedule-details small {
        font-size: 0.7rem;
    }

    .recurring-payment-item .rp-actions button {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }

    #transaction-form button[type="submit"],
    #transaction-form button[type="button"] {
        display: block;
        width: 100%;
        margin-left: 0;
        margin-bottom: 0.6rem;
    }

    #transaction-form button[type="button"]:last-of-type {
        margin-bottom: 0;
    }

    #force-password-change-view .modal-content {
        padding: 1.2rem;
        width: 95%;
    }

    #force-password-change-view #force-password-change-title {
        font-size: 1.15rem;
    }

    #force-password-change-view p {
        font-size: 0.9rem;
    }

    #force-password-change-form input[type="password"] {
        padding: 0.6rem;
        font-size: 0.95rem;
    }

    #force-password-change-form #fp-submit-btn {
        padding: 0.6rem;
        font-size: 0.95rem;
    }

    #admin-stats-overview .admin-date-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .flatpickr-input {
        padding: 0.35rem 0.5rem;
        font-size: 0.8rem;
    }
}

.progress-bar-container .progress-bar-text-left,
.progress-bar-container .progress-bar-text-right {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0 0.3rem;
    white-space: nowrap;
    z-index: 1;
    color: #ffffff;
    text-shadow: 0px 0px 3px rgba(0, 0, 0, 0.65);
}

body[data-theme="dark"] .progress-bar-container .progress-bar-text-left,
body[data-theme="dark"] .progress-bar-container .progress-bar-text-right {
    color: #f0f0f0;
    text-shadow: none;
}

.progress-bar-container .progress-bar-text-left {
    left: 0.3rem;
}

.progress-bar-container .progress-bar-text-right {
    right: 0.3rem;
}


/* --- START: Robust Print Preview Styling --- */

/* This class is still useful for hiding elements in the print preview dialog */
body.printing-active #app-sidebar,
body.printing-active .app-header,
body.printing-active #account-overview-section,
body.printing-active #budget-overview-section,
body.printing-active #quick-templates-section,
body.printing-active .dashboard-summary-and-filters-container,
body.printing-active .dashboard-transactions-container,
body.printing-active #account-management-view,
body.printing-active #category-management-view,
body.printing-active #recurring-management-view,
body.printing-active #settings-view {
    display: none !important;
}

body.printing-active #reports-master-section>h2,
body.printing-active #reports-master-section>.report-filters {
    display: none !important;
}

body.printing-active .report-content-area {
    display: none !important;
}

body.printing-active .report-content-area.printing-this-report {
    display: block !important;
    position: static;
    box-shadow: none !important;
    border: none !important;
    margin: 5px !important;
    padding: 0 !important;
}


/* --- END: Robust Print Preview Styling --- */


/* Print Styles */
/* -------------------------------------------------------------------------- */
@media print {

    /*
      FIX: Redefine the core CSS variables for the print media type.
      This forces a light theme for printing regardless of the active on-screen theme.
      This is more robust than relying on a JavaScript-added class.
    */
    :root {
        --body-bg: #ffffff !important;
        --content-bg: #ffffff !important;
        --text-primary: #000000 !important;
        --text-secondary: #333333 !important;
        --text-muted: #555555 !important;
        --border-color: #cccccc !important;
        --border-light: #eeeeee !important;
        --table-header-bg: #f2f2f2 !important;
        --income-color: #27ae60 !important;
        --expense-color: #e74c3c !important;
        --primary-accent-color: #2980b9 !important;
        --shadow-color-light: transparent !important;
        --sidebar-bg-secondary: #f2f2f2 !important;
    }

    *,
    *::before,
    *::after {
        box-shadow: none !important;
        text-shadow: none !important;
    }

    body {
        background-color: #ffffff !important;
        color: var(--text-primary) !important;
        font-family: 'Times New Roman', Times, serif;
        font-size: 10pt !important;
        margin: 0 !important;
        padding: 0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Hide all non-report elements */
    #app-sidebar,
    .app-header,
    .report-filters,
    .print-report-btn,
    #account-overview-section,
    .dashboard-summary-and-filters-container,
    .dashboard-transactions-container,
    #auth-section,
    #add-transaction-view,
    #account-management-view,
    #category-management-view,
    #exchange-rate-management-view,
    #recurring-management-view,
    .modal-overlay,
    #offline-indicator,
    #report-toggle-master-category-btn,
    #master-category-report-content .report-type-filters,
    .excluded-account-filter-container {
        display: none !important;
    }

    /* Ensure the report content is visible and takes up the full page */
    /* --- Corrected Rules --- */

    #reports-master-section {
        background-color: #ffffff;
    }

    .report-content-area {
        display: none !important;
        /* This new rule hides all report bodies by default in print mode */
    }

    .report-content-area.printing-this-report {
        display: block !important;
        /* This rule shows ONLY the report that was clicked */
        width: 100% !important;
        margin: 0 !important;
        padding: 12px !important;
        border: 1px solid #b0b0b0 !important;
        background-color: #ffffff !important;
        color: #000000 !important;
    }

    .report-total-line {
        background-color: #ffffff;
        color: #000000;
    }

    .report-main-title {
        display: block !important;
        font-size: 18pt !important;
        margin-bottom: 3px !important;
        padding-bottom: 0 !important;
        border-bottom: none !important;
        color: #000000;
    }

    .report-subtitle {
        display: block !important;
        font-size: 12pt !important;
        margin-top: 0 !important;
        margin-bottom: 18px !important;
        padding-bottom: 6px !important;
        border-bottom: 1px solid #b0b0b0 !important;
    }

    /* ... all other specific print styles from the original file ... */
    .report-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 12px;
        font-size: 9pt;
    }

    .report-table .reporting-head-row td {
        background-color: #f2f2f2 !important;
        /* Light grey for headers */
        font-weight: 700 !important;
        color: #000000;
    }

    .report-table th,
    .report-table td {
        padding: 2px 4px;
        border: 1px solid #c0c0c0;
        background-color: #ffffff;
    }

    .report-table th {
        background-color: #f2f2f2 !important;
        font-weight: 700;
    }

    .card-utilization-item-print-block {
        background-color: #ffffff;

    }

    .card-utilization-item-print-block .card-print-name {
        color: #000000;
    }

    .card-utilization-item-print-block .progress-bar-container {
        background-color: #ffffff;
        border: 1px solid #cccccc;

    }

    .card-utilization-item-print-block .progress-bar-fill {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .card-utilization-item-print-block .progress-bar-text-left {
        color: #ffffff !important;
        text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5) !important;
    }

    .card-utilization-item-print-block .progress-bar-text-right {
        color: #ffffff !important;
        text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5) !important;
    }

    .chart-label {
    font-size: 0.8rem;
    color: #000000;
    white-space: nowrap;
    text-align: left;
    width: 120px;
    padding-right: 10px;
    padding-left: 2px;
    flex-shrink: 0;
}
}