/* =====================================================
   RESET
===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800;900&display=swap');

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

html {
    direction: rtl;
}

body {
    font-family:
        "Vazirmatn",
        Tahoma,
        Arial,
        sans-serif;

    background: #f4f6f8;

    color: #202124;

    min-height: 100vh;
}


/* =====================================================
   APP
===================================================== */

.app-shell {

    width: 100%;

    max-width: 520px;

    min-height: 100vh;

    margin: 0 auto;

    background: #f4f6f8;

    padding-bottom: 90px;
}


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

.top-header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 22px 18px 8px;
}

.welcome-text {

    font-size: 13px;

    color: #777;

    margin-bottom: 5px;
}

.app-title {

    font-size: 23px;

    font-weight: 800;
}

.header-icon-button {

    width: 44px;

    height: 44px;

    border: none;

    border-radius: 14px;

    background: white;

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

    font-size: 20px;

    cursor: pointer;
}


/* =====================================================
   DATE
===================================================== */

.today-date {

    padding: 0 18px 18px;

    color: #777;

    font-size: 13px;
}


/* =====================================================
   HERO
===================================================== */

.hero-card {

    margin: 0 16px 16px;

    padding: 24px;

    border-radius: 24px;

    background:
        linear-gradient(
            135deg,
            #263238,
            #455a64
        );

    color: white;

    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.12);
}

.hero-title {

    font-size: 14px;

    opacity: 0.8;

    margin-bottom: 12px;
}

.hero-amount {

    font-size: 30px;

    font-weight: 900;

    margin-bottom: 7px;
}

.hero-subtitle {

    font-size: 12px;

    opacity: 0.7;
}


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

.quick-input-card,
.dashboard-section {

    margin: 0 16px 16px;

    background: white;

    border-radius: 20px;

    padding: 18px;

    box-shadow:
        0 5px 20px rgba(0, 0, 0, 0.05);
}

.section-title {

    font-size: 16px;

    font-weight: 800;

    margin-bottom: 5px;
}

.section-subtitle {

    font-size: 12px;

    color: #888;
}

.section-header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    margin-bottom: 16px;
}


/* =====================================================
   INPUT
===================================================== */

.quick-input-wrapper {

    display: flex;

    gap: 8px;

    margin-top: 14px;

    margin-bottom: 12px;
}

.quick-input {

    flex: 1;

    min-width: 0;

    height: 50px;

    border: 1px solid #e2e5e8;

    border-radius: 14px;

    padding: 0 15px;

    font-family: inherit;

    font-size: 14px;

    outline: none;

    background: #fafafa;
}

.quick-input:focus {

    border-color: #607d8b;

    background: white;
}

.voice-button {

    width: 50px;

    height: 50px;

    border: none;

    border-radius: 14px;

    background: #eceff1;

    font-size: 21px;

    cursor: pointer;
}

.voice-button:disabled {

    cursor: not-allowed;

    opacity: 0.5;
}

.voice-button.recording {

    transform: scale(1.08);

    animation:
        voicePulse 1s infinite;
}

@keyframes voicePulse {

    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.55;
    }

    100% {
        opacity: 1;
    }
}


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

.primary-button {

    border: none;

    border-radius: 13px;

    min-height: 46px;

    padding: 0 18px;

    background: #263238;

    color: white;

    font-family: inherit;

    font-size: 14px;

    font-weight: bold;

    cursor: pointer;
}

.primary-button:hover {

    opacity: 0.92;
}

.primary-button:disabled {

    opacity: 0.55;

    cursor: not-allowed;
}

.full-width {

    width: 100%;
}

.secondary-button {

    border: 1px solid #e1e4e6;

    border-radius: 13px;

    min-height: 46px;

    padding: 0 18px;

    background: white;

    color: #444;

    font-family: inherit;

    font-size: 14px;

    cursor: pointer;
}

.secondary-button:hover {

    background: #f7f7f7;
}

.small-action-button {

    width: 38px;

    height: 38px;

    border: none;

    border-radius: 11px;

    background: #f2f4f5;

    font-size: 20px;

    cursor: pointer;
}


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

.summary-grid {

    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 10px;
}

.summary-card {

    background: #f7f8f9;

    border-radius: 16px;

    padding: 15px;

    min-width: 0;
}

.summary-icon {

    font-size: 22px;

    margin-bottom: 10px;
}

.summary-label {

    font-size: 11px;

    color: #888;

    margin-bottom: 7px;
}

.summary-value {

    font-size: 15px;

    font-weight: 800;

    line-height: 1.6;

    word-break: break-word;
}


/* =====================================================
   MONTHLY COMPARISON
===================================================== */

.monthly-comparison {

    margin-top: 12px;

    padding: 14px 15px;

    border-radius: 15px;

    background: #f7f8f9;

    border: 1px solid #edf0f2;

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;

    min-width: 0;
}

.comparison-label {

    font-size: 11px;

    color: #777;

    white-space: nowrap;
}

.comparison-value {

    font-size: 12px;

    font-weight: 800;

    line-height: 1.7;

    text-align: left;

    direction: rtl;

    min-width: 0;
}

.comparison-value.positive {

    color: #c62828;
}

.comparison-value.negative {

    color: #2e7d32;
}

.comparison-value.increase {

    color: #c62828;
}

.comparison-value.decrease {

    color: #2e7d32;
}

.comparison-value.neutral {

    color: #777;
}


/* =====================================================
   CATEGORIES
===================================================== */

.category-list {

    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 9px;

    width: 100%;

    max-width: 100%;
}

.category-item {

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    min-height: 82px;

    min-width: 0;

    border-radius: 15px;

    background: #f7f8f9;

    padding: 8px;

    overflow: hidden;
}

.category-icon {

    font-size: 24px;

    margin-bottom: 7px;
}

.category-name {

    width: 100%;

    font-size: 11px;

    text-align: center;

    color: #555;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}


/* =====================================================
   CATEGORY SUMMARY
   3 COLUMNS
===================================================== */

#categoryList {

    display: grid !important;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 9px;

    width: 100%;

    max-width: 100%;

    box-sizing: border-box;
}

#categoryList .category-summary-item {

    display: block;

    width: 100%;

    max-width: 100%;

    min-width: 0;

    margin: 0;

    padding: 10px 7px;

    border-radius: 15px;

    background: #ffffff;

    border: 1px solid #eeeeee;

    box-sizing: border-box;

    overflow: hidden;
}

#categoryList .category-summary-header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 5px;

    width: 100%;

    min-width: 0;

    box-sizing: border-box;
}

#categoryList .category-summary-title {

    display: flex;

    align-items: center;

    gap: 5px;

    min-width: 0;

    flex: 1;

    overflow: hidden;
}

#categoryList .category-summary-icon {

    width: 31px;

    height: 31px;

    flex-shrink: 0;

    border-radius: 10px;

    background: #f5f7fa;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 17px;
}

#categoryList .category-summary-name {

    min-width: 0;

    max-width: 100%;

    font-size: 8px;

    font-weight: 700;

    color: #222;

    line-height: 1.5;

    white-space: normal;

    overflow-wrap: break-word;

    word-break: normal;

    text-align: right;
}

#categoryList .category-summary-count {

    margin-top: 2px;

    font-size: 7px;

    color: #999;

    white-space: nowrap;
}

#categoryList .category-summary-amount {

    min-width: 0;

    max-width: 100%;

    flex-shrink: 1;

    font-size: 8px;

    font-weight: 700;

    color: #333;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}

#categoryList .category-progress {

    width: 100%;

    max-width: 100%;

    height: 6px;

    background: #eeeeee;

    border-radius: 10px;

    overflow: hidden;

    margin-top: 8px;

    box-sizing: border-box;
}

#categoryList .category-progress-bar {

    height: 100%;

    min-width: 0;

    border-radius: 10px;

    background:
        linear-gradient(
            90deg,
            #667eea,
            #764ba2
        );

    transition:
        width 0.5s ease;
}

#categoryList .category-summary-footer {

    display: flex;

    align-items: center;

    justify-content: space-between;

    width: 100%;

    margin-top: 5px;

    box-sizing: border-box;

    font-size: 7px;

    color: #999;
}

#categoryList
.category-summary-footer
span:first-child {

    font-weight: 700;

    color: #667eea;
}


/* =====================================================
   CATEGORY CHART
===================================================== */

.category-chart-wrapper {

    margin-top: 16px;

    padding: 16px;

    background: #ffffff;

    border-radius: 18px;

    border: 1px solid #eeeeee;
}

.category-chart-title {

    font-size: 14px;

    font-weight: 700;

    margin-bottom: 12px;

    text-align: right;
}

.category-chart-container {

    position: relative;

    width: 100%;

    height: 280px;
}


/* =====================================================
   EXPENSE LIST
===================================================== */

.expense-list {

    display: flex;

    flex-direction: column;

    gap: 10px;
}

.expense-item {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;

    padding: 13px;

    border-radius: 16px;

    background: #f8f9fa;

    min-width: 0;
}

.expense-main {

    display: flex;

    align-items: center;

    min-width: 0;

    flex: 1;
}

.expense-icon {

    width: 43px;

    height: 43px;

    flex-shrink: 0;

    display: flex;

    align-items: center;

    justify-content: center;

    border-radius: 13px;

    background: white;

    font-size: 20px;

    margin-left: 10px;
}

.expense-info {

    min-width: 0;

    flex: 1;
}

.expense-description {

    font-size: 13px;

    font-weight: bold;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}

.expense-meta {

    display: flex;

    gap: 8px;

    margin-top: 5px;

    color: #888;

    font-size: 10px;
}

.expense-right {

    display: flex;

    flex-direction: column;

    align-items: flex-end;

    gap: 7px;

    flex-shrink: 0;
}

.expense-amount {

    font-size: 13px;

    font-weight: 800;

    white-space: nowrap;
}

.expense-actions {

    display: flex;

    align-items: center;

    gap: 4px;
}

.expense-edit-button,
.expense-delete-button {

    width: 31px;

    height: 31px;

    border: none;

    border-radius: 9px;

    background: white;

    cursor: pointer;

    font-size: 15px;

    display: flex;

    align-items: center;

    justify-content: center;
}

.expense-edit-button:hover {

    background: #eaf3f7;
}

.expense-delete-button:hover {

    background: #ffe9e9;
}


/* =====================================================
   EMPTY / LOADING
===================================================== */

.loading {

    text-align: center;

    color: #888;

    font-size: 13px;

    padding: 25px 10px;
}

.empty-state {

    text-align: center;

    color: #888;

    font-size: 13px;

    padding: 25px 10px;
}

.empty-icon {

    font-size: 35px;

    margin-bottom: 10px;
}


/* =====================================================
   BOTTOM NAV
===================================================== */

.bottom-nav {

    position: fixed;

    left: 50%;

    bottom: 0;

    transform: translateX(-50%);

    width: min(520px, 100%);

    height: 72px;

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

    border-top:
        1px solid #e8eaec;

    display: flex;

    align-items: center;

    justify-content: space-around;

    z-index: 100;
}

.bottom-nav-item {

    border: none;

    background: transparent;

    min-width: 58px;

    display: flex;

    flex-direction: column;

    align-items: center;

    gap: 4px;

    color: #999;

    font-family: inherit;

    cursor: pointer;
}

.bottom-nav-item span {

    font-size: 19px;
}

.bottom-nav-item small {

    font-size: 10px;
}

.bottom-nav-item.active {

    color: #263238;

    font-weight: bold;
}

.bottom-nav-add {

    width: 54px;

    height: 54px;

    border-radius: 18px;

    border: none;

    background: #263238;

    color: white;

    font-size: 30px;

    line-height: 1;

    cursor: pointer;

    box-shadow:
        0 7px 20px
        rgba(0, 0, 0, 0.18);
}


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

.modal-overlay {

    position: fixed;

    inset: 0;

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

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 20px;

    z-index: 1000;
}

.modal-overlay.hidden {

    display: none;
}

.modal-card {

    width: 100%;

    max-width: 430px;

    max-height: 90vh;

    overflow-y: auto;

    background: white;

    border-radius: 24px;

    padding: 20px;

    box-shadow:
        0 20px 60px
        rgba(0, 0, 0, 0.25);
}

.modal-header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    margin-bottom: 20px;
}

.modal-header h2 {

    font-size: 18px;
}

.modal-close {

    width: 35px;

    height: 35px;

    border: none;

    border-radius: 10px;

    background: #f1f2f3;

    font-size: 24px;

    line-height: 1;

    cursor: pointer;
}

.modal-actions {

    display: flex;

    gap: 10px;

    margin-top: 20px;
}

.modal-actions button {

    flex: 1;
}


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

.confirmation-content {

    text-align: center;

    padding: 5px 0 10px;
}

.confirmation-icon {

    font-size: 45px;

    margin-bottom: 12px;
}

.confirmation-description {

    font-size: 17px;

    font-weight: bold;

    margin-bottom: 10px;
}

.confirmation-amount {

    font-size: 23px;

    font-weight: 900;

    margin-bottom: 12px;
}

.confirmation-category,
.confirmation-date {

    color: #777;

    font-size: 12px;

    margin-top: 5px;
}


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

.edit-form {

    display: flex;

    flex-direction: column;

    gap: 8px;
}

.edit-form label {

    font-size: 12px;

    color: #666;

    margin-top: 5px;
}

.edit-form input,
.edit-form select {

    width: 100%;

    height: 46px;

    border: 1px solid #ddd;

    border-radius: 12px;

    padding: 0 12px;

    font-family: inherit;

    font-size: 14px;

    outline: none;

    background: white;
}

.edit-form input:focus,
.edit-form select:focus {

    border-color: #607d8b;
}


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

.delete-modal-card {

    text-align: center;
}

.delete-expense-content {

    padding: 5px 0 5px;
}

.delete-warning {

    font-size: 48px;

    margin-bottom: 12px;
}

.delete-question {

    font-size: 14px;

    font-weight: bold;

    margin-bottom: 16px;
}

.delete-expense-info {

    background: #f7f8f9;

    border-radius: 15px;

    padding: 15px;
}

.delete-description {

    font-size: 14px;

    font-weight: bold;

    margin-bottom: 8px;
}

.delete-amount {

    font-size: 18px;

    font-weight: 900;
}

.delete-confirm-button {

    border: none;

    border-radius: 13px;

    min-height: 46px;

    padding: 0 18px;

    background: #c62828;

    color: white;

    font-family: inherit;

    font-size: 14px;

    font-weight: bold;

    cursor: pointer;
}

.delete-confirm-button:hover {

    background: #b71c1c;
}

.delete-confirm-button:disabled {

    opacity: 0.55;

    cursor: not-allowed;
}


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

.toast {

    position: fixed;

    left: 50%;

    bottom: 88px;

    transform:
        translateX(-50%)
        translateY(20px);

    width: calc(100% - 32px);

    max-width: 480px;

    background: #263238;

    color: white;

    padding: 13px 16px;

    border-radius: 13px;

    text-align: center;

    font-size: 13px;

    opacity: 0;

    pointer-events: none;

    transition:
        opacity 0.25s ease,
        transform 0.25s ease;

    z-index: 2000;
}

.toast.show {

    opacity: 1;

    transform:
        translateX(-50%)
        translateY(0);
}


/* =====================================================
   NUMERIC FONT
===================================================== */

.hero-amount,
.summary-value,
.expense-amount,
.category-summary-amount,
.category-summary-footer,
.confirmation-amount,
.delete-amount,
.comparison-value,
.subscription-plan-price {

    font-family:
        "Vazirmatn",
        Tahoma,
        Arial,
        sans-serif;

    font-variant-numeric:
        tabular-nums;

    direction: rtl;
}

.hero-amount {

    font-weight: 800;

    letter-spacing: 0;
}

.summary-value {

    font-weight: 800;
}

.expense-amount {

    font-weight: 700;

    font-size: 13px;
}

.category-summary-amount {

    font-weight: 700;
}

.category-summary-footer span:first-child {

    font-family:
        "Vazirmatn",
        Tahoma,
        Arial,
        sans-serif;

    font-weight: 700;
}

.confirmation-amount {

    font-size: 23px;

    font-weight: 900;
}

.delete-amount {

    font-size: 18px;

    font-weight: 900;
}


/* =====================================================
   SUBSCRIPTION ICON
===================================================== */

.subscription-icon-button {

    width: 38px;

    height: 38px;

    border: none;

    background: transparent;

    display: flex;

    align-items: center;

    justify-content: center;

    border-radius: 50%;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        background 0.2s ease;
}

.subscription-icon-button:hover {

    background:
        rgba(0, 0, 0, 0.04);
}

.subscription-icon-button:active {

    transform:
        scale(0.9);
}

.subscription-icon {

    font-size: 19px;

    line-height: 1;
}


/* =====================================================
   SUBSCRIPTION STATUS
===================================================== */

.subscription-icon-button.trial .subscription-icon {

    opacity: 0.65;
}

.subscription-icon-button.warning .subscription-icon {

    opacity: 0.9;

    filter:
        saturate(1.4);
}

.subscription-icon-button.expired .subscription-icon {

    opacity: 1;

    filter:
        grayscale(1)
        sepia(1)
        saturate(6)
        hue-rotate(315deg);
}

.subscription-icon-button.active .subscription-icon {

    opacity: 1;
}


/* =====================================================
   SUBSCRIPTION PAYWALL
===================================================== */

.subscription-paywall {

    position: fixed;

    inset: 0;

    z-index: 5000;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 16px;

    background:
        rgba(20, 24, 28, 0.48);

    backdrop-filter:
        blur(5px);

    -webkit-backdrop-filter:
        blur(5px);

    direction: rtl;
}

.subscription-paywall.hidden {

    display: none;
}


/* =====================================================
   PAYWALL CARD
===================================================== */

.subscription-paywall-card {

    position: relative;

    width: 100%;

    max-width: 350px;

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

    overflow-y: auto;

    padding:
        30px
        22px
        20px;

    background: #ffffff;

    border-radius: 24px;

    box-shadow:
        0 20px 60px
        rgba(0, 0, 0, 0.22);

    text-align: center;

    direction: rtl;
}


/* =====================================================
   PAYWALL CLOSE
===================================================== */

.subscription-paywall-close {

    position: absolute;

    top: 11px;

    left: 11px;

    width: 32px;

    height: 32px;

    padding: 0;

    border: none;

    border-radius: 50%;

    background: #f3f4f5;

    color: #555;

    font-family: inherit;

    font-size: 22px;

    line-height: 32px;

    display: flex;

    align-items: center;

    justify-content: center;

    cursor: pointer;

    z-index: 3;
}

.subscription-paywall-close:hover {

    background: #e9ebed;
}


/* =====================================================
   PAYWALL ICON
===================================================== */

.subscription-paywall-icon {

    width: 62px;

    height: 62px;

    margin:
        0 auto
        13px;

    border-radius: 18px;

    background: #f7f8f9;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 34px;

    line-height: 1;
}


/* =====================================================
   PAYWALL TITLE
===================================================== */

.subscription-paywall-title {

    width: 100%;

    margin-bottom: 8px;

    font-size: 17px;

    font-weight: 800;

    line-height: 1.8;

    color: #222;

    text-align: center;
}


/* =====================================================
   PAYWALL DESCRIPTION
===================================================== */

.subscription-paywall-description {

    width: 100%;

    max-width: 285px;

    margin:
        0 auto
        16px;

    font-size: 11px;

    line-height: 2;

    color: #777;

    text-align: center;
}


/* =====================================================
   PLAN
===================================================== */

.subscription-plan {

    width: 100%;

    margin:
        0 auto
        16px;

    padding:
        14px
        12px;

    border-radius: 17px;

    background: #f7f8f9;

    border:
        1px solid #edf0f2;

    text-align: center;
}

.subscription-plan-label {

    font-size: 10px;

    color: #888;

    margin-bottom: 4px;

    text-align: center;
}

.subscription-plan-price {

    font-size: 22px;

    font-weight: 900;

    line-height: 1.7;

    color: #263238;

    white-space: nowrap;

    text-align: center;
}

.subscription-plan-period {

    font-size: 9px;

    color: #999;

    margin-top: 1px;

    text-align: center;
}


/* =====================================================
   FEATURES
===================================================== */

.subscription-feature-list {

    width: 100%;

    margin:
        0 auto
        17px;

    padding: 0;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    gap: 4px;

    direction: rtl;

    text-align: center;
}

.subscription-feature-list div {

    width: 100%;

    max-width: 270px;

    padding:
        4px
        8px;

    border-radius: 8px;

    color: #555;

    font-size: 10px;

    line-height: 1.8;

    text-align: center;

    background: #fafafa;
}


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

.subscription-paywall-card
.primary-button,
.subscription-paywall-card
.secondary-button {

    display: block;

    width: 100%;

    min-width: 0;

    margin-left: auto;

    margin-right: auto;

    text-align: center;

    box-sizing: border-box;
}

.subscription-paywall-card
.primary-button {

    margin-bottom: 9px;
}


/* =====================================================
   BODY LOCK
===================================================== */

body.subscription-modal-open {

    overflow: hidden;
}


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

.settings-modal {

    position: fixed;

    inset: 0;

    z-index: 3000;

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

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 16px;

    direction: rtl;
}

.settings-modal.hidden {

    display: none;
}

.settings-card {

    width: 100%;

    max-width: 520px;

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

    overflow-y: auto;

    background: #ffffff;

    border-radius: 24px;

    box-shadow:
        0 20px 60px
        rgba(0, 0, 0, 0.18);
}


/* =====================================================
   SETTINGS HEADER
   قرارداد ثابت:
   عنوان سمت راست
   دکمه بستن سمت چپ
===================================================== */

.settings-header {

    position: sticky;

    top: 0;

    z-index: 2;

    background: #ffffff;

    padding: 20px;

    border-bottom:
        1px solid #eeeeee;

    display: flex;

    flex-direction: row;

    align-items: center;

    justify-content: space-between;

    direction: rtl;

    min-height: 84px;
}

.settings-header-title {

    display: flex;

    align-items: center;

    gap: 12px;

    min-width: 0;

    flex: 1;

    order: 1;

    text-align: right;
}

.settings-header-icon {

    width: 44px;

    height: 44px;

    flex:
        0 0
        44px;

    border-radius: 14px;

    display: flex;

    align-items: center;

    justify-content: center;

    background: #f5f5f5;

    font-size: 22px;
}

.settings-title {

    font-size: 19px;

    font-weight: 800;

    color: #222222;

    line-height: 1.6;

    text-align: right;
}

.settings-subtitle {

    margin-top: 4px;

    font-size: 12px;

    color: #888888;

    line-height: 1.6;

    text-align: right;
}

.settings-close {

    width: 38px;

    height: 38px;

    flex:
        0 0
        38px;

    border: none;

    border-radius: 12px;

    background: #f5f5f5;

    color: #555555;

    font-size: 18px;

    line-height: 1;

    cursor: pointer;

    order: 2;

    display: flex;

    align-items: center;

    justify-content: center;

    margin-right: 12px;

    margin-left: 0;
}

.settings-close:hover {

    background: #eceeef;

}

.settings-close:active {

    transform:
        scale(0.94);
}


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

.settings-content {

    padding:
        10px
        16px
        20px;
}


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

.settings-item {

    width: 100%;

    border: none;

    background: transparent;

    padding:
        15px
        4px;

    display: flex;

    align-items: center;

    gap: 13px;

    text-align: right;

    direction: rtl;

    cursor: pointer;

    border-bottom:
        1px solid #f0f0f0;

    font-family: inherit;
}

.settings-item:last-child {

    border-bottom: none;
}

.settings-item:hover {

    background:
        rgba(
            0,
            0,
            0,
            0.015
        );
}

.settings-item:active {

    opacity: 0.7;
}

.settings-item-icon {

    width: 42px;

    height: 42px;

    flex:
        0 0
        42px;

    border-radius: 13px;

    display: flex;

    align-items: center;

    justify-content: center;

    background: #f7f7f7;

    font-size: 20px;
}

.settings-item-text {

    flex: 1;

    min-width: 0;

    text-align: right;
}

.settings-item-title {

    font-size: 14px;

    font-weight: 700;

    color: #222222;

    line-height: 1.6;

    text-align: right;
}

.settings-item-description {

    margin-top: 4px;

    font-size: 11px;

    color: #8a8a8a;

    line-height: 1.6;

    text-align: right;
}

.settings-item-arrow {

    width: 20px;

    flex:
        0 0
        20px;

    font-size: 25px;

    color: #aaaaaa;

    line-height: 1;

    display: flex;

    align-items: center;

    justify-content: center;
}

body.settings-modal-open {

    overflow: hidden;
}


/* =====================================================
   SETTINGS DETAIL MODAL
===================================================== */

#settingsDetailModal {

    z-index: 4000;
}

#settingsDetailModal .settings-card {

    max-width: 520px;
}

#settingsDetailModal .settings-content {

    padding:
        18px
        20px
        22px;
}

#settingsDetailModal .edit-form {

    width: 100%;
}

#settingsDetailModal .settings-item {

    width: 100%;

    border:
        1px solid #eeeeee;

    border-radius: 16px;

    background: #f9fafb;

    margin: 0;

    padding: 14px;

    cursor: default;
}

#settingsDetailModal .settings-item:hover {

    background: #f9fafb;
}


/* =====================================================
   SETTINGS DETAIL BUTTONS
===================================================== */

#settingsDetailModal
.primary-button {

    margin-top: 8px;
}


/* =====================================================
   CATEGORY MANAGEMENT
===================================================== */

.category-management-card {

    max-width: 560px;
}

.category-management-list {

    padding:
        8px
        16px;
}

.category-management-item {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 12px;

    padding:
        14px
        4px;

    border-bottom:
        1px solid #eeeeee;

    direction: rtl;
}

.category-management-item:last-child {

    border-bottom: none;
}

.category-management-main {

    display: flex;

    align-items: center;

    gap: 12px;

    min-width: 0;

    flex: 1;
}

.category-management-icon {

    width: 44px;

    height: 44px;

    flex:
        0 0
        44px;

    border-radius: 14px;

    background: #f7f7f7;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 21px;
}

.category-management-info {

    min-width: 0;

    flex: 1;

    text-align: right;
}

.category-management-name {

    font-size: 14px;

    font-weight: 700;

    color: #222;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

    text-align: right;
}

.category-management-status {

    margin-top: 4px;

    font-size: 11px;

    text-align: right;
}

.category-management-status.active {

    color: #2e8b57;
}

.category-management-status.inactive {

    color: #c62828;
}

.category-management-actions {

    display: flex;

    align-items: center;

    gap: 6px;

    direction: ltr;

    flex-shrink: 0;
}

.category-action-button {

    width: 36px;

    height: 36px;

    border: none;

    border-radius: 11px;

    background: #f5f5f5;

    cursor: pointer;

    font-size: 16px;

    display: flex;

    align-items: center;

    justify-content: center;
}

.category-action-button:hover {

    background: #eceff1;
}

.category-action-button:active {

    opacity: 0.65;

    transform:
        scale(0.95);
}

.category-management-footer {

    padding:
        14px
        16px
        20px;
}

.category-management-footer
.primary-button {

    width: 100%;
}

.category-management-loading,
.category-management-empty,
.category-management-error {

    text-align: center;

    padding:
        30px
        15px;

    font-size: 13px;

    color: #888;
}

.category-management-error {

    color: #c62828;
}


/* ============================================================
   MOBILE
=========================================================== */

@media (max-width: 520px) {

    .app-title {

        font-size: 21px;
    }

    .hero-card {

        margin:
            0 14px 14px;

        padding: 20px;
    }

    .quick-input-card,
    .dashboard-section {

        margin:
            0 14px 14px;

        padding: 15px;
    }


    /* -----------------------------------------------
       MONTH COMPARISON
    ----------------------------------------------- */

    .monthly-comparison {

        padding: 12px;

        gap: 8px;
    }

    .comparison-label {

        font-size: 10px;
    }

    .comparison-value {

        font-size: 10px;

        text-align: left;
    }


    /* -----------------------------------------------
       CATEGORY SUMMARY
    ----------------------------------------------- */

    #categoryList {

        grid-template-columns:
            repeat(3, minmax(0, 1fr));

        gap: 7px;
    }

    #categoryList
    .category-summary-item {

        padding:
            9px 5px;

        border-radius: 13px;
    }

    #categoryList
    .category-summary-header {

        gap: 3px;
    }

    #categoryList
    .category-summary-title {

        gap: 4px;
    }

    #categoryList
    .category-summary-icon {

        width: 28px;

        height: 28px;

        font-size: 15px;

        border-radius: 9px;
    }

    #categoryList
    .category-summary-name {

        font-size: 7px;

        line-height: 1.4;
    }

    #categoryList
    .category-summary-count {

        font-size: 6px;
    }

    #categoryList
    .category-summary-amount {

        font-size: 7px;
    }

    #categoryList
    .category-progress {

        height: 5px;

        margin-top: 7px;
    }

    #categoryList
    .category-summary-footer {

        margin-top: 4px;

        font-size: 6px;
    }

    .expense-amount {

        font-size: 11px;
    }


    /* -----------------------------------------------
       CHART
    ----------------------------------------------- */

    .category-chart-wrapper {

        padding: 13px;

        margin-top: 14px;
    }

    .category-chart-title {

        font-size: 13px;
    }

    .category-chart-container {

        height: 250px;
    }


    /* -----------------------------------------------
       SUBSCRIPTION
    ----------------------------------------------- */

    .subscription-paywall {

        padding: 12px;
    }

    .subscription-paywall-card {

        max-width: 340px;

        padding:
            27px
            17px
            17px;

        border-radius: 22px;
    }

    .subscription-paywall-icon {

        width: 58px;

        height: 58px;

        font-size: 31px;

        margin-bottom: 10px;
    }

    .subscription-paywall-title {

        font-size: 16px;
    }

    .subscription-paywall-description {

        font-size: 10px;

        max-width: 275px;
    }

    .subscription-plan {

        padding:
            13px
            10px;
    }

    .subscription-plan-price {

        font-size: 20px;
    }

    .subscription-feature-list {

        margin-bottom: 15px;
    }

    .subscription-feature-list div {

        max-width: 250px;

        font-size: 9px;
    }


    /* -----------------------------------------------
       SETTINGS
    ----------------------------------------------- */

    .settings-modal {

        align-items: flex-end;

        padding: 0;
    }

    .settings-card {

        max-width: none;

        max-height: 90vh;

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

    .settings-header {

        padding: 17px;

        min-height: 78px;
    }

    .settings-header-title {

        gap: 9px;
    }

    .settings-header-icon {

        width: 40px;

        height: 40px;

        flex-basis: 40px;

        border-radius: 12px;

        font-size: 20px;
    }

    .settings-title {

        font-size: 17px;
    }

    .settings-subtitle {

        font-size: 10px;
    }

    .settings-close {

        width: 36px;

        height: 36px;

        flex-basis: 36px;

        margin-right: 9px;

        border-radius: 11px;
    }

    .settings-content {

        padding:
            8px
            14px
            18px;
    }

    .settings-item {

        padding:
            14px
            2px;
    }

    .settings-item-icon {

        width: 39px;

        height: 39px;

        flex-basis: 39px;

        border-radius: 12px;

        font-size: 19px;
    }

    .settings-item-title {

        font-size: 13px;
    }

    .settings-item-description {

        font-size: 10px;

        margin-top: 3px;
    }

    .settings-item-arrow {

        font-size: 23px;
    }


    /* -----------------------------------------------
       SETTINGS DETAIL
    ----------------------------------------------- */

    #settingsDetailModal .settings-content {

        padding:
            15px
            16px
            20px;
    }

    #settingsDetailModal .settings-item {

        padding: 13px;
    }


    /* -----------------------------------------------
       CATEGORY MANAGEMENT
    ----------------------------------------------- */

    .category-management-card {

        max-height: 90vh;

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

    .category-management-list {

        padding:
            6px
            14px;
    }

    .category-management-item {

        padding:
            13px
            2px;

        gap: 8px;
    }

    .category-management-main {

        gap: 9px;
    }

    .category-management-icon {

        width: 40px;

        height: 40px;

        flex-basis: 40px;

        border-radius: 12px;

        font-size: 19px;
    }

    .category-management-name {

        font-size: 13px;
    }

    .category-management-status {

        font-size: 10px;

        margin-top: 3px;
    }

    .category-management-actions {

        gap: 4px;
    }

    .category-action-button {

        width: 33px;

        height: 33px;

        border-radius: 10px;

        font-size: 14px;
    }

    .category-management-footer {

        padding:
            12px
            14px
            18px;
    }
}


/* ============================================================
   VERY SMALL MOBILE
=========================================================== */

@media (max-width: 380px) {

    .app-title {

        font-size: 19px;
    }

    .hero-amount {

        font-size: 26px;
    }


    /* -----------------------------------------------
       MONTH COMPARISON
    ----------------------------------------------- */

    .monthly-comparison {

        display: flex;

        flex-direction: column;

        align-items: flex-start;

        gap: 3px;
    }

    .comparison-label {

        font-size: 9px;
    }

    .comparison-value {

        font-size: 10px;

        width: 100%;

        text-align: right;
    }


    /* -----------------------------------------------
       CATEGORY
    ----------------------------------------------- */

    #categoryList {

        grid-template-columns:
            repeat(3, minmax(0, 1fr));

        gap: 5px;
    }

    #categoryList
    .category-summary-item {

        padding:
            7px 4px;
    }

    #categoryList
    .category-summary-icon {

        width: 25px;

        height: 25px;

        font-size: 13px;
    }

    #categoryList
    .category-summary-name {

        font-size: 6px;

        line-height: 1.4;
    }

    #categoryList
    .category-summary-amount {

        font-size: 6px;
    }

    #categoryList
    .category-summary-footer {

        font-size: 5px;
    }


    /* -----------------------------------------------
       EXPENSE ACTIONS
    ----------------------------------------------- */

    .expense-edit-button,
    .expense-delete-button {

        width: 28px;

        height: 28px;

        font-size: 13px;
    }


    /* -----------------------------------------------
       CHART
    ----------------------------------------------- */

    .category-chart-container {

        height: 220px;
    }


    /* -----------------------------------------------
       SUBSCRIPTION
    ----------------------------------------------- */

    .subscription-paywall {

        padding: 8px;
    }

    .subscription-paywall-card {

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

        padding:
            23px
            14px
            14px;

        border-radius: 20px;
    }

    .subscription-paywall-icon {

        width: 54px;

        height: 54px;

        font-size: 29px;
    }

    .subscription-paywall-title {

        font-size: 15px;

        line-height: 1.7;
    }

    .subscription-paywall-description {

        font-size: 9px;

        max-width: 250px;

        line-height: 1.9;
    }

    .subscription-plan {

        padding:
            11px
            8px;

        margin-bottom: 13px;
    }

    .subscription-plan-label {

        font-size: 9px;
    }

    .subscription-plan-price {

        font-size: 18px;
    }

    .subscription-plan-period {

        font-size: 8px;
    }

    .subscription-feature-list {

        gap: 3px;

        margin-bottom: 13px;
    }

    .subscription-feature-list div {

        max-width: 230px;

        padding:
            3px
            6px;

        font-size: 8px;

        line-height: 1.7;
    }


    /* -----------------------------------------------
       SETTINGS
    ----------------------------------------------- */

    .settings-header {

        padding:
            15px
            14px;
    }

    .settings-header-icon {

        width: 36px;

        height: 36px;

        flex-basis: 36px;

        font-size: 18px;
    }

    .settings-title {

        font-size: 15px;
    }

    .settings-subtitle {

        font-size: 9px;
    }

    .settings-close {

        width: 34px;

        height: 34px;

        flex-basis: 34px;

        margin-right: 7px;

        font-size: 17px;
    }

    .settings-item-icon {

        width: 36px;

        height: 36px;

        flex-basis: 36px;

        font-size: 17px;
    }

    .settings-item-title {

        font-size: 12px;
    }

    .settings-item-description {

        font-size: 9px;
    }

    .settings-item-arrow {

        font-size: 21px;
    }


    /* -----------------------------------------------
       CATEGORY MANAGEMENT
    ----------------------------------------------- */

    .category-management-icon {

        width: 36px;

        height: 36px;

        flex-basis: 36px;

        font-size: 17px;
    }

    .category-management-name {

        font-size: 12px;
    }

    .category-management-status {

        font-size: 9px;
    }

    .category-action-button {

        width: 30px;

        height: 30px;

        font-size: 13px;
    }

    .category-management-footer
    .primary-button {

        min-height: 44px;

        font-size: 13px;
    }
}

/* =====================================================
   REPORTS PAGE
===================================================== */

.app-view[hidden] {
    display: none !important;
}

.reports-page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 2px 16px 16px;
    padding: 4px 2px;
}

.reports-page-heading h1 {
    font-size: 21px;
    font-weight: 900;
    margin-bottom: 5px;
}

.reports-page-heading p {
    color: #7a858c;
    font-size: 12px;
    line-height: 1.8;
}

.reports-heading-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 16px;
    background: #e9eef1;
    font-size: 23px;
}

.report-range-options {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.report-range-button {
    border: 1px solid #e2e7ea;
    border-radius: 12px;
    background: #f8fafb;
    color: #53616a;
    min-height: 38px;
    padding: 0 12px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.report-range-button.active {
    background: #263238;
    color: #fff;
    border-color: #263238;
}

.report-custom-dates {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.report-custom-dates[hidden] {
    display: none !important;
}

.report-date-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.report-date-field label {
    font-size: 11px;
    color: #68757d;
}

.report-date-field input:not([type="hidden"]) {
    width: 100%;
    min-width: 0;
    height: 43px;
    padding: 0 8px;
    border: 1px solid #dfe4e7;
    border-radius: 11px;
    background: #fff;
    color: #263238;
    font-family: inherit;
    font-size: 12px;
    text-align: center;
    direction: ltr;
    cursor: pointer;
}

.report-date-field input:not([type="hidden"]):focus {
    outline: none;
    border-color: #607d8b;
    box-shadow: 0 0 0 3px rgba(96, 125, 139, 0.12);
}

.report-date-field input[type="hidden"] {
    display: none !important;
}

/* Self-contained Jalali date picker: no external library/CDN required. */
.report-date-input-wrap {
    display: flex;
    align-items: stretch;
    gap: 6px;
    width: 100%;
    min-width: 0;
}

.edit-date-input-wrap {
    margin: 0 0 2px;
}

.edit-date-input-wrap input.report-jalali-date-input {
    text-align: right;
    direction: ltr;
}

.report-date-input-wrap input.report-jalali-date-input {
    flex: 1 1 auto;
    width: 0;
    min-width: 0;
    cursor: text;
    user-select: text;
    -webkit-user-select: text;
    touch-action: manipulation;
}

.report-date-picker-trigger {
    flex: 0 0 40px;
    width: 40px;
    height: 43px;
    border: 1px solid #dfe4e7;
    border-radius: 11px;
    background: #f6f8f9;
    color: #263238;
    font-family: inherit;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.report-date-picker-trigger:hover,
.report-date-picker-trigger:focus-visible {
    background: #eaf0f3;
    border-color: #8da0aa;
    outline: none;
}

.report-jalali-picker[hidden] {
    display: none !important;
}

.report-jalali-picker {
    position: fixed;
    z-index: 99999;
    width: 310px;
    max-width: calc(100vw - 16px);
    padding: 12px;
    direction: rtl;
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
    color: #263238;
    background: #fff;
    border: 1px solid #dce3e7;
    border-radius: 16px;
    box-shadow: 0 12px 38px rgba(23, 35, 42, .22);
}

.report-jalali-picker-header {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    align-items: center;
    gap: 8px;
    margin-bottom: 11px;
}

.report-jalali-picker-title {
    text-align: center;
    font-size: 14px;
    font-weight: 800;
}

.report-jalali-nav {
    width: 38px;
    height: 36px;
    border: 1px solid #e0e5e8;
    border-radius: 10px;
    background: #f6f8f9;
    color: #263238;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.report-jalali-nav:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.report-jalali-weekdays,
.report-jalali-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.report-jalali-weekdays {
    margin-bottom: 5px;
}

.report-jalali-weekdays span {
    display: grid;
    place-items: center;
    height: 28px;
    color: #77858d;
    font-size: 11px;
    font-weight: 700;
}

.report-jalali-empty-day {
    min-height: 35px;
}

.report-jalali-day {
    display: grid;
    place-items: center;
    min-width: 0;
    height: 35px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: #263238;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
}

.report-jalali-day:hover:not(:disabled) {
    border-color: #8da0aa;
    background: #eef3f5;
}

.report-jalali-day.today {
    border-color: #607d8b;
    font-weight: 800;
}

.report-jalali-day.selected {
    background: #263238;
    color: #fff;
    font-weight: 800;
}

.report-jalali-day:disabled {
    color: #c4cbd0;
    cursor: not-allowed;
    text-decoration: line-through;
}

.report-jalali-picker-footer {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    border-top: 1px solid #edf0f2;
    margin-top: 10px;
    padding-top: 10px;
}

.report-jalali-picker-footer button {
    border: 0;
    border-radius: 9px;
    padding: 7px 12px;
    background: #f0f3f5;
    color: #263238;
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
}

.report-apply-button {
    grid-column: 1 / -1;
    width: 100%;
}

.reports-status {
    min-height: 20px;
    margin-top: 10px;
    color: #76838a;
    font-size: 11px;
    line-height: 1.8;
}

.reports-status.error {
    color: #c62828;
}

.reports-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.report-stat-card {
    min-width: 0;
    min-height: 136px;
    padding: 14px;
    border: 1px solid #edf0f2;
    border-radius: 17px;
    background: #fafbfc;
}

.report-stat-primary {
    background: #edf2f4;
    border-color: #dfe7eb;
}

.report-stat-icon {
    font-size: 20px;
    margin-bottom: 9px;
}

.report-stat-label {
    color: #7e898f;
    font-size: 11px;
    margin-bottom: 7px;
}

.report-stat-value {
    font-size: 15px;
    font-weight: 900;
    line-height: 1.8;
    overflow-wrap: anywhere;
}

.report-stat-category {
    font-size: 14px;
}

.report-stat-caption {
    color: #7e898f;
    font-size: 10px;
    margin-top: 2px;
    overflow-wrap: anywhere;
}

.report-comparison {
    border: 1px solid #edf0f2;
    background: #f8fafb;
    border-radius: 15px;
    padding: 14px;
    margin-top: 12px;
}

.report-comparison-title {
    font-size: 11px;
    color: #78848b;
    margin-bottom: 7px;
}

.report-comparison-value {
    font-size: 14px;
    font-weight: 900;
    line-height: 1.8;
}

.report-comparison-value.increase {
    color: #c62828;
}

.report-comparison-value.decrease {
    color: #2e7d32;
}

.report-comparison-value.neutral {
    color: #68757d;
}

.report-comparison-caption {
    margin-top: 5px;
    color: #8a949a;
    font-size: 10px;
}

.report-trend-chart-container {
    width: 100%;
    height: 260px;
    position: relative;
}

.report-category-chart-container {
    width: 100%;
    max-width: 360px;
    height: 270px;
    position: relative;
    margin: 0 auto 16px;
}

.report-category-breakdown {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.report-category-row {
    min-width: 0;
}

.report-category-row-top,
.report-category-name,
.report-category-row-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.report-category-name {
    justify-content: flex-start;
    min-width: 0;
    font-size: 12px;
    font-weight: 700;
}

.report-category-name > span:last-child {
    overflow-wrap: anywhere;
}

.report-category-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: #f0f3f5;
    font-size: 16px;
}

.report-category-amount {
    text-align: left;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.report-category-progress {
    height: 6px;
    margin-top: 8px;
    background: #edf0f2;
    border-radius: 20px;
    overflow: hidden;
}

.report-category-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #607d8b, #80cbc4);
}

.report-category-row-footer {
    margin-top: 5px;
    color: #89949a;
    font-size: 10px;
}

html[data-theme="dark"] .reports-page-heading p,
html[data-theme="dark"] .report-stat-label,
html[data-theme="dark"] .report-stat-caption,
html[data-theme="dark"] .report-comparison-title,
html[data-theme="dark"] .report-comparison-caption,
html[data-theme="dark"] .report-category-row-footer,
html[data-theme="dark"] .report-date-field label,
html[data-theme="dark"] .reports-status {
    color: #aab2b8;
}

html[data-theme="dark"] .report-range-button,
html[data-theme="dark"] .report-stat-card,
html[data-theme="dark"] .report-comparison,
html[data-theme="dark"] .report-category-icon {
    background: #20262b;
    border-color: #333b41;
    color: #e8eaed;
}

html[data-theme="dark"] .report-range-button.active {
    background: #607d8b;
    border-color: #607d8b;
    color: #fff;
}

html[data-theme="dark"] .report-stat-primary {
    background: #26343b;
    border-color: #394951;
}

html[data-theme="dark"] .report-date-field input:not([type="hidden"]) {
    background: #20262b;
    border-color: #3b444b;
    color: #f1f3f4;
}


@media (max-width: 380px) {
    .reports-page-heading h1 {
        font-size: 19px;
    }

    .report-range-options {
        gap: 5px;
    }

    .report-range-button {
        padding: 0 9px;
        font-size: 11px;
    }

    .report-stat-card {
        padding: 11px;
    }

    .report-stat-value {
        font-size: 13px;
    }
}


html[data-theme="dark"] .report-date-picker-trigger,
html[data-theme="dark"] .report-jalali-picker,
html[data-theme="dark"] .report-jalali-nav {
    background: #20262b;
    border-color: #3b444b;
    color: #f1f3f4;
}

html[data-theme="dark"] .report-jalali-day {
    color: #f1f3f4;
}

html[data-theme="dark"] .report-jalali-day:hover:not(:disabled) {
    background: #303a41;
}

html[data-theme="dark"] .report-jalali-day.selected {
    background: #607d8b;
    color: #fff;
}

html[data-theme="dark"] .report-jalali-day:disabled {
    color: #58636a;
}

html[data-theme="dark"] .report-jalali-picker-footer {
    border-top-color: #333b41;
}

html[data-theme="dark"] .report-jalali-picker-footer button {
    background: #303a41;
    color: #f1f3f4;
}



/* =====================================================
   ACCOUNTS PAGE
===================================================== */
.accounts-page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 18px 18px;
}
.accounts-page-heading h1 { font-size: 22px; font-weight: 900; margin-bottom: 5px; }
.accounts-page-heading p { color: #7e898f; font-size: 12px; line-height: 1.8; }
.accounts-add-button { flex-shrink: 0; padding: 0 13px; min-height: 42px; font-size: 12px; }
.accounts-overview-section { padding: 15px; }
.accounts-total-card {
    padding: 20px;
    border-radius: 19px;
    color: #fff;
    background: linear-gradient(135deg, #24343b, #476773);
    box-shadow: 0 10px 25px rgba(38, 50, 56, .13);
}
.accounts-total-label { font-size: 12px; color: #d6e1e4; margin-bottom: 10px; }
.accounts-total-value { font-size: clamp(20px, 5.8vw, 29px); font-weight: 900; line-height: 1.7; overflow-wrap: anywhere; }
.accounts-total-note { font-size: 10px; color: #d6e1e4; line-height: 1.8; }
.accounts-metrics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.accounts-metric-card { display: grid; grid-template-columns: 30px 1fr; align-items: center; column-gap: 7px; row-gap: 5px; padding: 13px; border-radius: 15px; background: #f6f8f9; min-width: 0; }
.accounts-metric-icon { grid-row: span 2; font-size: 22px; }
.accounts-metric-label { color: #77838a; font-size: 10px; }
.accounts-metric-card strong { font-size: 13px; font-weight: 900; overflow-wrap: anywhere; }
.accounts-list-toolbar { display: flex; justify-content: flex-start; margin: -3px 0 12px; }
.accounts-inactive-toggle { display: inline-flex; align-items: center; gap: 7px; color: #748087; font-size: 11px; cursor: pointer; }
.accounts-inactive-toggle input { accent-color: #455a64; }
.accounts-status { color: #7b878d; font-size: 11px; margin-bottom: 10px; min-height: 0; }
.accounts-status.error { color: #c62828; }
.accounts-list { display: flex; flex-direction: column; gap: 12px; }
.account-card { border: 1px solid #e8edef; border-radius: 18px; padding: 15px; min-width: 0; background: #fff; }
.account-card-inactive { opacity: .76; background: #f8f9fa; }
.account-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.account-card-identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.account-card-icon { width: 47px; height: 47px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: #edf3f5; border-radius: 15px; font-size: 23px; }
.account-card-names { min-width: 0; }
.account-card-names h3 { font-size: 14px; font-weight: 900; overflow-wrap: anywhere; margin-bottom: 4px; }
.account-card-names span { color: #818d93; font-size: 10px; }
.account-card-menu { display: flex; align-items: center; gap: 5px; }
.account-icon-action { width: 34px; height: 34px; border: 0; border-radius: 10px; background: #f3f6f7; cursor: pointer; }
.account-icon-danger { color: #b85b50; }
.account-balance-block { margin-top: 17px; padding: 13px 14px; border-radius: 13px; background: #f6f9fa; }
.account-balance-block span { display: block; font-size: 10px; color: #7e8b90; margin-bottom: 4px; }
.account-balance-block strong { display: block; font-size: 21px; font-weight: 900; overflow-wrap: anywhere; }
.account-card-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 8px; padding: 14px 1px 12px; }
.account-card-stats div { min-width: 0; }
.account-card-stats span { display: block; color: #77868d; font-size: 10px; line-height: 1.6; margin-bottom: 5px; }
.account-card-stats strong { display: block; font-size: 11px; line-height: 1.7; font-weight: 800; overflow-wrap: anywhere; }
.account-transactions-button { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 1px solid #e4ebee; border-radius: 12px; padding: 11px 13px; background: #fff; color: #354c55; font: inherit; font-size: 11px; font-weight: 800; cursor: pointer; }
.account-transactions-button span { font-size: 18px; }
.accounts-empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; border: 1px dashed #d5dfe3; border-radius: 18px; padding: 25px 15px; color: #69777d; }
.accounts-empty-state strong { color: #33464e; font-size: 14px; }
.accounts-empty-state p { font-size: 12px; line-height: 1.9; }
.accounts-empty-icon { font-size: 36px; }
.accounts-empty-state.compact { padding: 20px 12px; }
.accounts-help-note { margin: 0 16px 16px; padding: 13px 15px; background: #edf3f5; border-radius: 14px; color: #63737a; font-size: 10px; line-height: 2; }
.account-form-help { color: #859198; font-size: 10px; line-height: 1.9; margin-top: 2px; }
.account-select-input { width: 100%; min-height: 46px; border: 1px solid #dce3e6; border-radius: 12px; padding: 0 12px; color: #263238; background: #fff; font-family: inherit; font-size: 13px; outline: none; }
.confirmation-account-field { margin-top: 18px; padding: 14px; border-radius: 15px; background: #f6f8f9; text-align: right; }
.confirmation-account-field label { display: block; font-size: 12px; font-weight: 800; margin-bottom: 8px; }
.confirmation-account-hint { color: #74828a; font-size: 10px; line-height: 1.8; margin-top: 6px; }
.text-action-button { background: transparent; border: 0; color: #455f6a; font-family: inherit; font-size: 11px; padding: 8px 0 0; cursor: pointer; font-weight: 800; }
.account-transactions-modal-card { max-width: 500px; }
.account-transactions-summary { color: #77858c; font-size: 11px; margin: -9px 0 14px; }
.account-transactions-list { display: flex; flex-direction: column; gap: 8px; max-height: 55vh; overflow-y: auto; }
.account-transaction-row { display: flex; align-items: center; gap: 10px; padding: 11px; border-radius: 13px; background: #f7f9fa; }
.account-transaction-icon { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0; color: #ae554c; background: #fbecea; font-size: 18px; }
.account-transaction-main { flex: 1; min-width: 0; }
.account-transaction-main strong { display: block; font-size: 12px; overflow-wrap: anywhere; }
.account-transaction-main span { display: block; color: #829097; font-size: 10px; margin-top: 4px; }
.account-transaction-amount { color: #b84e45; font-size: 11px; font-weight: 900; white-space: nowrap; }

html[data-theme="dark"] .accounts-page-heading p,
html[data-theme="dark"] .accounts-metric-label,
html[data-theme="dark"] .account-card-names span,
html[data-theme="dark"] .account-balance-block span,
html[data-theme="dark"] .account-card-stats span,
html[data-theme="dark"] .accounts-status,
html[data-theme="dark"] .accounts-inactive-toggle,
html[data-theme="dark"] .account-form-help,
html[data-theme="dark"] .confirmation-account-hint,
html[data-theme="dark"] .account-transactions-summary,
html[data-theme="dark"] .account-transaction-main span { color: #aab2b8; }
html[data-theme="dark"] .account-card,
html[data-theme="dark"] .accounts-metric-card,
html[data-theme="dark"] .account-card-inactive,
html[data-theme="dark"] .account-balance-block,
html[data-theme="dark"] .account-transactions-button,
html[data-theme="dark"] .account-transaction-row,
html[data-theme="dark"] .confirmation-account-field,
html[data-theme="dark"] .account-select-input { background: #20262b; border-color: #333b41; color: #e8eaed; }
html[data-theme="dark"] .account-card-names h3,
html[data-theme="dark"] .accounts-empty-state strong { color: #f1f3f4; }
html[data-theme="dark"] .account-card-icon,
html[data-theme="dark"] .account-icon-action { background: #303940; }
html[data-theme="dark"] .accounts-empty-state { border-color: #3b444b; color: #aab2b8; }
html[data-theme="dark"] .accounts-help-note { background: #202a30; color: #aab2b8; }
html[data-theme="dark"] .text-action-button { color: #a6c1cb; }

@media (max-width: 380px) {
    .accounts-page-heading { padding-left: 13px; padding-right: 13px; gap: 7px; }
    .accounts-page-heading h1 { font-size: 19px; }
    .accounts-add-button { font-size: 10px; padding: 0 9px; }
    .account-card { padding: 12px; }
    .account-card-stats { gap: 4px; }
    .account-card-stats strong { font-size: 9px; }
    .account-balance-block strong { font-size: 18px; }
}

/* Account credit / income entry and transaction colors */
.accounts-metrics-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.account-credit-button {
    display: flex; align-items: center; justify-content: center; width: 100%;
    margin: 0 0 8px; padding: 11px 12px; border: 1px solid #d9e9e2;
    border-radius: 12px; background: #f0f8f4; color: #267354;
    font: inherit; font-size: 11px; font-weight: 800; cursor: pointer;
}
.account-credit-button:hover { background: #e6f4ed; }
.account-transaction-icon.incoming { color: #267354; background: #e4f4eb; }
.account-transaction-icon.outgoing { color: #ae554c; background: #fbecea; }
.account-transaction-amount.incoming { color: #267354; }
.account-transaction-amount.outgoing { color: #b84e45; }
.account-credit-modal-card { max-width: 440px; }
#accountCreditDateJalali { direction: ltr; text-align: left; }
html[data-theme="dark"] .account-credit-button { color: #b4e5ce; background: #233b31; border-color: #355b48; }
html[data-theme="dark"] .account-credit-button:hover { background: #294739; }
html[data-theme="dark"] .account-transaction-icon.incoming { color: #b4e5ce; background: #233b31; }
html[data-theme="dark"] .account-transaction-icon.outgoing { color: #ffc6bf; background: #452b2b; }
html[data-theme="dark"] .account-transaction-amount.incoming { color: #91d8b3; }
html[data-theme="dark"] .account-transaction-amount.outgoing { color: #ffaaa1; }
@media (max-width: 390px) {
    .accounts-metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .accounts-metric-card:last-child { grid-column: 1 / -1; }
}

.account-balance-block.account-balance-negative { background: #fff0ee; border: 1px solid #f4d2cd; }
.account-balance-block.account-balance-negative strong { color: #b3261e; }
@media (max-width: 390px) {
    .account-card-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
html[data-theme="dark"] .account-balance-block.account-balance-negative { background: #422b2a; border-color: #64403e; }
html[data-theme="dark"] .account-balance-block.account-balance-negative strong { color: #ffb4ab; }


/* Account-to-account transfer UI */
.accounts-page-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-shrink: 0; }
.accounts-transfer-button { min-height: 42px; padding: 0 11px; font-size: 11px; white-space: nowrap; border-color: #dce5e8; }
.account-transfer-modal-card { max-width: 460px; }
.account-transfer-modal-card #accountTransferDateJalali { direction: ltr; text-align: left; }
#accountTransferBalanceHint.error { color: #b42318; }
html[data-theme="dark"] .accounts-transfer-button { background: #20262b; color: #e8eaed; border-color: #3b444b; }
html[data-theme="dark"] #accountTransferBalanceHint.error { color: #ffaaa1; }
@media (max-width: 430px) {
    .accounts-page-heading { align-items: flex-start; flex-wrap: wrap; }
    .accounts-page-actions { width: 100%; }
    .accounts-page-actions > button { flex: 1; }
}


/* Clear account breakdown: transfer effects are displayed separately from income/expenses. */
.account-card-stats .account-stat-positive { color: #247a57; }
.account-card-stats .account-stat-negative { color: #b3261e; }
html[data-theme="dark"] .account-card-stats .account-stat-positive { color: #91d8b3; }
html[data-theme="dark"] .account-card-stats .account-stat-negative { color: #ffb4ab; }


/* =====================================================
   SMART SPENDING INSIGHTS
===================================================== */
.spending-insights-section {
    position: relative;
    border: 1px solid #f0ddb5;
    background: linear-gradient(135deg, #fffdf7 0%, #fff8e9 100%);
    overflow: hidden;
}
.spending-insights-section[hidden] {
    display: none !important;
}
.spending-insights-header {
    align-items: flex-start;
    padding-left: 30px;
}
.spending-insights-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 12px;
    background: #fff0c8;
    font-size: 20px;
}
.spending-insights-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.spending-insight-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px;
    border-radius: 15px;
    border: 1px solid #f1e3c5;
    background: rgba(255, 255, 255, 0.82);
    min-width: 0;
}
.spending-insight-item-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 12px;
    background: #fff4da;
    font-size: 19px;
}
.spending-insight-content {
    min-width: 0;
    flex: 1;
}
.spending-insight-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}
.spending-insight-title-row strong {
    color: #5d4317;
    font-size: 13px;
    line-height: 1.8;
}
.spending-insight-change {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 800;
    color: #a85a21;
    background: #fff0d9;
    border-radius: 8px;
    padding: 4px 7px;
}
.spending-insight-content p {
    font-size: 12px;
    line-height: 1.9;
    color: #655d50;
    margin: 0 0 9px;
}
.spending-insight-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 14px;
    font-size: 10px;
    color: #81786b;
}
.spending-insight-metrics b {
    color: #34312c;
    font-weight: 800;
}
.spending-insights-dismiss {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 27px;
    height: 27px;
    border: 0;
    border-radius: 8px;
    background: rgba(113, 91, 50, 0.09);
    color: #6a5936;
    font-size: 21px;
    line-height: 1;
    cursor: pointer;
}
html[data-theme="dark"] .spending-insights-section {
    background: #272720;
    border-color: #5b4a27;
}
html[data-theme="dark"] .spending-insight-item {
    background: #22251f;
    border-color: #514329;
}
html[data-theme="dark"] .spending-insights-icon,
html[data-theme="dark"] .spending-insight-item-icon,
html[data-theme="dark"] .spending-insight-change {
    background: #40351e;
    color: #f0cd80;
}
html[data-theme="dark"] .spending-insight-title-row strong,
html[data-theme="dark"] .spending-insight-metrics b {
    color: #f0e3c6;
}
html[data-theme="dark"] .spending-insight-content p,
html[data-theme="dark"] .spending-insight-metrics {
    color: #c3b89f;
}
html[data-theme="dark"] .spending-insights-dismiss {
    background: #383225;
    color: #f0e3c6;
}
@media (max-width: 380px) {
    .spending-insight-title-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .spending-insight-metrics {
        flex-direction: column;
        gap: 4px;
    }
}


/* =====================================================
   AUTH GATE + DEFINITIVE PERSIAN FORM TYPOGRAPHY
===================================================== */
html, body, body button, body input, body select, body textarea {
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif !important;
}
#editExpenseModal,
#editExpenseModal *,
#confirmationModal,
#confirmationModal *,
#deleteExpenseModal,
#deleteExpenseModal *,
#accountModal,
#accountModal *,
#accountCreditModal,
#accountCreditModal *,
#accountTransferModal,
#accountTransferModal *,
#settingsModal,
#settingsModal * {
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif !important;
}
#editExpenseModal input,
#editExpenseModal select,
#editExpenseModal button,
#editExpenseModal textarea {
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif !important;
    font-size: 14px;
}
#editExpenseModal input[type="date"],
#editExpenseModal input[type="number"],
#editExpenseModal input[type="text"] {
    font-variant-numeric: normal;
    font-feature-settings: "kern" 1;
}
.app-shell.auth-pending { visibility: hidden !important; }
.auth-gate {
    position: fixed; inset: 0; z-index: 5000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px; background: rgba(242, 245, 247, .98);
    direction: rtl; overflow-y: auto;
}
.auth-gate[hidden] { display: none !important; }
.auth-card {
    width: 100%; max-width: 410px; padding: 28px 24px 22px;
    border: 1px solid #e8edf0; border-radius: 24px; background: #fff;
    box-shadow: 0 18px 50px rgba(25, 43, 50, .12); color: #263238;
}
.auth-brand-icon {
    width: 58px; height: 58px; margin: 0 auto 12px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 18px; background: #edf3f4; font-size: 29px;
}
.auth-card h1 { margin: 0; text-align: center; font-size: 23px; font-weight: 900; }
.auth-description { margin: 8px 0 22px; text-align: center; color: #718089; font-size: 12px; line-height: 1.9; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; margin-bottom: 18px; border-radius: 14px; background: #f2f5f6; }
.auth-tab { min-height: 42px; border: 0; border-radius: 10px; background: transparent; color: #62727a; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
.auth-tab.active { background: #263238; color: #fff; box-shadow: 0 3px 9px rgba(38,50,56,.14); }
.auth-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.auth-field label { color: #52636b; font-size: 12px; font-weight: 700; }
.auth-field input { width: 100%; min-height: 48px; border: 1px solid #dce3e6; border-radius: 12px; background: #fff; color: #263238; padding: 0 13px; outline: none; direction: rtl; text-align: right; font: inherit; font-size: 14px; }
.auth-field input:focus { border-color: #526f78; box-shadow: 0 0 0 3px rgba(82,111,120,.10); }
.auth-submit { margin-top: 5px; min-height: 49px; }
.auth-message { margin: 4px 0 12px; padding: 10px 12px; border-radius: 10px; background: #fff0ef; color: #a12f27; font-size: 12px; line-height: 1.8; }
.auth-message[hidden] { display: none !important; }
.auth-note { margin: 17px 0 0; text-align: center; color: #87949a; font-size: 10px; }
.auth-logout-button { border: 1px solid #e0e6e8; border-radius: 11px; padding: 8px 10px; background: #fff; color: #586971; font: inherit; font-size: 11px; cursor: pointer; }
html[data-theme="dark"] .auth-gate { background: rgba(18, 22, 25, .98); }
html[data-theme="dark"] .auth-card { background: #1b2024; border-color: #333b41; color: #f1f3f4; }
html[data-theme="dark"] .auth-description, html[data-theme="dark"] .auth-note, html[data-theme="dark"] .auth-field label { color: #aab2b8; }
html[data-theme="dark"] .auth-field input { background: #20262b; color: #f1f3f4; border-color: #3b444b; }
html[data-theme="dark"] .auth-tabs { background: #20262b; }
html[data-theme="dark"] .auth-logout-button { background: #252c31; color: #e8eaed; border-color: #333b41; }
@media (max-width: 420px) { .auth-card { padding: 24px 18px 20px; } }
