* {
    box-sizing: border-box;
}

:root {
    --primary: #0f766e;
    --primary-2: #14b8a6;
    --dark: #0f172a;
    --muted: #64748b;
    --line: #dbe6ee;
    --card: rgba(255,255,255,.96);
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;
    --success-bg: #dcfce7;
    --success-text: #166534;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Times New Roman", Times, serif;
    color: var(--dark);
    background:
        radial-gradient(circle at 80% 10%, rgba(20,184,166,.18), transparent 30%),
        radial-gradient(circle at 15% 85%, rgba(15,118,110,.14), transparent 28%),
        linear-gradient(135deg, #f8fafc, #eefaf7);
}

a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-shell {
    width: 100%;
    max-width: 980px;
    display: grid;
    grid-template-columns: 1fr 1.05fr;
    background: var(--card);
    border: 1px solid rgba(255,255,255,.85);
    border-radius: 34px;
    overflow: hidden;
    box-shadow: 0 30px 90px rgba(15,23,42,.14);
}

.auth-hero {
    padding: 46px 38px;
    background:
        linear-gradient(145deg, rgba(15,118,110,.96), rgba(20,184,166,.9));
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-hero .brand {
    width: 78px;
    height: 78px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.18);
    font-size: 38px;
    margin-bottom: 22px;
}

.auth-hero h2 {
    margin: 0 0 12px;
    font-size: 34px;
}

.auth-hero p {
    margin: 0;
    font-size: 19px;
    line-height: 1.9;
    color: rgba(255,255,255,.92);
}

.hero-list {
    display: grid;
    gap: 12px;
    margin-top: 28px;
}

.hero-item {
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255,255,255,.15);
    font-size: 18px;
}

.auth-panel {
    padding: 44px 42px;
}

.auth-title {
    text-align: center;
    margin-bottom: 24px;
}

.logo-circle {
    width: 72px;
    height: 72px;
    margin: 0 auto 12px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    font-size: 34px;
    box-shadow: 0 18px 35px rgba(15,118,110,.25);
}

h1 {
    margin: 0 0 8px;
    font-size: 38px;
    color: var(--primary);
}

.muted {
    margin: 0;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.7;
}

.form {
    display: grid;
    gap: 15px;
}

.form-group {
    display: grid;
    gap: 7px;
}

.form label {
    font-size: 18px;
    font-weight: bold;
    color: #334155;
}

.input-wrap {
    position: relative;
    width: 100%;
}

.input-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    pointer-events: none;
    opacity: .85;
}

.form input {
    width: 100%;
    height: 52px;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 0 48px 0 16px;
    font-size: 18px;
    font-family: "Times New Roman", Times, serif;
    background: #fff;
    color: var(--dark);
    outline: none;
    transition: .2s ease;
}

.form input:focus {
    border-color: var(--primary-2);
    box-shadow: 0 0 0 5px rgba(20,184,166,.13);
}

.btn {
    width: 100%;
    height: 54px;
    border: 0;
    border-radius: 16px;
    margin-top: 8px;
    font-family: "Times New Roman", Times, serif;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 16px 30px rgba(15,118,110,.22);
    transition: .2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 36px rgba(15,118,110,.28);
}

.auth-link {
    text-align: center;
    font-size: 18px;
    margin: 22px 0 0;
}

.alert {
    margin-bottom: 18px;
    padding: 13px 15px;
    border-radius: 15px;
    font-size: 17px;
    line-height: 1.7;
}

.alert.error {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.alert.success {
    background: var(--success-bg);
    color: var(--success-text);
}

.card {
    width: 100%;
    max-width: 760px;
    background: var(--card);
    border-radius: 30px;
    padding: 38px;
    text-align: center;
    box-shadow: 0 25px 80px rgba(15,23,42,.12);
}

.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 26px 0;
}

.feature {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 16px 10px;
    font-size: 19px;
}

.feature span {
    display: block;
    font-size: 30px;
    margin-bottom: 7px;
}

.actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.actions .btn {
    width: auto;
    min-width: 190px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-light {
    background: #ecfeff;
    color: var(--primary);
    border: 1px solid #99f6e4;
    box-shadow: none;
}

@media (max-width: 820px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-hero {
        display: none;
    }

    .auth-panel {
        padding: 34px 22px;
    }

    h1 {
        font-size: 32px;
    }
}

@media (max-width: 520px) {
    .page {
        padding: 14px;
    }

    .auth-panel,
    .card {
        padding: 28px 18px;
    }

    .features {
        grid-template-columns: 1fr;
    }
}

.password-toggle {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: #f1f5f9;
    color: #334155;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 17px;
}

.password-toggle:hover {
    background: #e2e8f0;
}

.form input.has-toggle {
    padding-left: 58px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 2px;
    font-size: 17px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #334155;
    font-weight: bold;
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.app-body {
    background: #f4f8fb;
    min-height: 100vh;
}

.app-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.sidebar {
    background: #0f766e;
    color: #fff;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.side-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.side-logo {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: rgba(255,255,255,.16);
    display: grid;
    place-items: center;
    font-size: 28px;
}

.side-brand strong {
    display: block;
    font-size: 22px;
}

.side-brand span {
    display: block;
    color: rgba(255,255,255,.75);
    margin-top: 4px;
}

.side-nav {
    display: grid;
    gap: 10px;
}

.side-nav a,
.logout-link {
    color: #fff;
    text-decoration: none;
    padding: 13px 14px;
    border-radius: 15px;
    font-size: 18px;
}

.side-nav a:hover,
.side-nav a.active,
.logout-link:hover {
    background: rgba(255,255,255,.15);
}

.logout-link {
    margin-top: auto;
    background: rgba(255,255,255,.1);
}

.main-content {
    padding: 30px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 24px;
}

.topbar h1 {
    margin: 0;
    color: #0f172a;
}

.topbar p {
    margin: 8px 0 0;
    color: #64748b;
    font-size: 18px;
}

.top-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.mini-btn {
    background: #0f766e;
    color: #fff;
    padding: 12px 16px;
    border-radius: 14px;
    text-decoration: none;
    font-size: 17px;
}

.mini-btn-light {
    background: #ecfeff;
    color: #0f766e;
    border: 1px solid #99f6e4;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 22px;
    padding: 22px;
    box-shadow: 0 14px 35px rgba(15,23,42,.06);
}

.stat-card span {
    font-size: 30px;
}

.stat-card small {
    display: block;
    margin: 12px 0 8px;
    color: #64748b;
    font-size: 17px;
}

.stat-card strong {
    font-size: 25px;
    color: #0f172a;
}

.stat-card.success strong {
    color: #15803d;
}

.stat-card.danger strong {
    color: #b91c1c;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 16px;
}

.panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 14px 35px rgba(15,23,42,.06);
}

.panel h2 {
    margin: 0 0 14px;
    color: #0f766e;
}

.panel p {
    color: #475569;
    font-size: 18px;
    line-height: 1.8;
}

.quick-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
    font-size: 18px;
}

.notice-list {
    display: grid;
    gap: 12px;
}

.notice {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 14px;
}

.notice strong {
    color: #0f172a;
    font-size: 18px;
}

.notice p {
    margin: 6px 0 0;
    font-size: 16px;
}

@media (max-width: 980px) {
    .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .stats-grid,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }
}

.form-panel {
    max-width: 1000px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.app-form select,
.app-form textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 13px 15px;
    font-size: 18px;
    font-family: "Times New Roman", Times, serif;
    background: #fff;
    color: var(--dark);
    outline: none;
}

.app-form select {
    height: 52px;
}

.app-form textarea {
    resize: vertical;
    line-height: 1.7;
}

.app-form select:focus,
.app-form textarea:focus {
    border-color: var(--primary-2);
    box-shadow: 0 0 0 5px rgba(20,184,166,.13);
}

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

.stat-card.warning strong {
    color: #d97706;
}

.filters-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.filters-row select {
    min-width: 180px;
    height: 46px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0 12px;
    font-family: "Times New Roman", Times, serif;
    font-size: 17px;
    background: #fff;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 850px;
}

.data-table th,
.data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid #e2e8f0;
    text-align: right;
    font-size: 17px;
}

.data-table th {
    color: #0f766e;
    background: #f8fafc;
    font-size: 18px;
}

.amount-income {
    color: #15803d;
    font-weight: bold;
}

.amount-expense {
    color: #b91c1c;
    font-weight: bold;
}

.badge {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: bold;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-muted {
    background: #f1f5f9;
    color: #475569;
}

.inline-form {
    margin: 0;
}

.small-action {
    border: 0;
    border-radius: 12px;
    padding: 8px 12px;
    cursor: pointer;
    background: #0f766e;
    color: #fff;
    font-family: "Times New Roman", Times, serif;
    font-size: 16px;
}

.empty-cell {
    text-align: center !important;
    color: #64748b;
    padding: 28px !important;
}

.row-actions {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    align-items: center;
}

.small-link {
    display: inline-flex;
    border-radius: 12px;
    padding: 8px 12px;
    background: #ecfeff;
    color: #0f766e;
    border: 1px solid #99f6e4;
    font-size: 16px;
    text-decoration: none;
}

.danger-action {
    background: #dc2626;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    display: grid;
    place-items: center;
    padding: 20px;
    z-index: 999;
}

.modal-backdrop[hidden] {
    display: none;
}

.modal-box {
    width: 100%;
    max-width: 430px;
    background: #fff;
    border-radius: 26px;
    padding: 28px;
    text-align: center;
    box-shadow: 0 30px 90px rgba(15, 23, 42, 0.22);
}

.modal-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 12px;
    display: grid;
    place-items: center;
    border-radius: 22px;
    background: #fee2e2;
    font-size: 34px;
}

.modal-box h2 {
    margin: 0 0 10px;
    color: #991b1b;
    font-size: 28px;
}

.modal-box p {
    color: #475569;
    font-size: 18px;
    line-height: 1.8;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-btn {
    flex: 1;
    border: 0;
    border-radius: 15px;
    padding: 13px;
    font-family: "Times New Roman", Times, serif;
    font-size: 18px;
    cursor: pointer;
}

.modal-cancel {
    background: #f1f5f9;
    color: #334155;
}

.modal-danger {
    background: #dc2626;
    color: #fff;
}

.wallets-page-grid {
    grid-template-columns: .9fr 1.1fr;
}

.wallet-list {
    display: grid;
    gap: 14px;
}

.wallet-card {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 20px;
    padding: 16px;
    display: grid;
    gap: 12px;
}

.wallet-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wallet-icon {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    background: #ecfeff;
    color: #0f766e;
    display: grid;
    place-items: center;
    font-size: 27px;
}

.wallet-main strong {
    display: block;
    font-size: 20px;
    color: #0f172a;
}

.wallet-main span {
    display: block;
    margin-top: 3px;
    color: #64748b;
    font-size: 16px;
}

.wallet-balance {
    font-size: 24px;
    font-weight: bold;
    color: #0f766e;
    background: #fff;
    border-radius: 16px;
    padding: 12px;
    border: 1px solid #e2e8f0;
}

.full-link {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

@media (max-width: 980px) {
    .wallets-page-grid {
        grid-template-columns: 1fr;
    }
}

.category-list {
    display: grid;
    gap: 14px;
}

.category-card {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 20px;
    padding: 16px;
    display: grid;
    gap: 12px;
}

.category-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-icon {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    font-size: 27px;
    border: 1px solid #e2e8f0;
}

.category-main strong {
    display: block;
    font-size: 20px;
    color: #0f172a;
}

.category-main span {
    display: block;
    margin-top: 3px;
    color: #64748b;
    font-size: 16px;
}

.category-meta {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 11px 12px;
    color: #475569;
    font-size: 17px;
}

.app-form input[type="color"] {
    width: 100%;
    height: 52px;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 5px;
    background: #fff;
}

.category-sections {
    display: grid;
    gap: 18px;
}

.category-section {
    border: 1px solid #e2e8f0;
    border-radius: 22px;
    background: #ffffff;
    padding: 16px;
}

.category-section h3 {
    margin: 0 0 14px;
    color: #0f766e;
    font-size: 22px;
}

.empty-box {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 16px;
    padding: 18px;
    color: #64748b;
    text-align: center;
    font-size: 17px;
}

.side-footer-actions {
    display: grid;
    gap: 10px;
    margin-top: auto;
}

.language-link {
    display: block;
    padding: 12px 14px;
    border-radius: 16px;
    background: #ecfeff;
    color: #0f766e;
    text-decoration: none;
    font-weight: bold;
    border: 1px solid #99f6e4;
}

html[dir="ltr"] body {
    direction: ltr;
}

html[dir="ltr"] .side-nav a,
html[dir="ltr"] .logout-link,
html[dir="ltr"] .language-link,
html[dir="ltr"] .data-table th,
html[dir="ltr"] .data-table td {
    text-align: left;
}

html[dir="ltr"] .topbar,
html[dir="ltr"] .wallet-main,
html[dir="ltr"] .category-main,
html[dir="ltr"] .side-brand {
    direction: ltr;
}

html[dir="ltr"] .main-content {
    direction: ltr;
}

html[dir="ltr"] .stat-card,
html[dir="ltr"] .panel,
html[dir="ltr"] .topbar {
    text-align: left;
}

html[dir="ltr"] .top-actions {
    direction: ltr;
}

/* Center compact auth pages like reset password */
.auth-shell.single-auth,
.auth-body .auth-shell:has(.auth-panel):not(:has(.auth-hero)) {
    min-height: 100vh;
    width: min(560px, calc(100% - 32px));
    margin: 0 auto;
    display: grid;
    place-items: center;
    grid-template-columns: 1fr;
}

.auth-body .auth-shell:has(.auth-panel):not(:has(.auth-hero)) .auth-panel {
    width: 100%;
}

/* Better reset password layout: keep it centered and not too wide */
.auth-body .auth-shell .auth-panel {
    max-width: 620px;
}

/* Password toggle position by direction */
.input-wrap {
    position: relative;
}

.password-toggle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    cursor: pointer;
}

/* Arabic RTL: eye on the left */
html[dir="rtl"] .password-toggle {
    left: 12px;
    right: auto;
}

/* English LTR: eye on the right */
html[dir="ltr"] .password-toggle {
    right: 12px;
    left: auto;
}

/* Make room for the eye button */
html[dir="rtl"] .input-wrap input[type="password"],
html[dir="rtl"] .input-wrap input[type="text"] {
    padding-left: 58px;
}

html[dir="ltr"] .input-wrap input[type="password"],
html[dir="ltr"] .input-wrap input[type="text"] {
    padding-right: 58px;
}

/* Icon position by direction */
html[dir="rtl"] .input-icon {
    right: 14px;
    left: auto;
}

html[dir="ltr"] .input-icon {
    left: 14px;
    right: auto;
}

html[dir="rtl"] .input-wrap input {
    padding-right: 58px;
}

html[dir="ltr"] .input-wrap input {
    padding-left: 58px;
}

/* Auth footer alignment */
html[dir="ltr"] .auth-footer {
    text-align: center;
}

html[dir="rtl"] .auth-footer {
    text-align: center;
}

.compact-auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.compact-auth-shell {
    width: min(560px, 100%);
    margin: 0 auto;
}

.compact-auth-panel {
    width: 100%;
    border-radius: 28px;
    padding: 34px;
}

.compact-auth-icon {
    width: 72px;
    height: 72px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    background: #ecfeff;
    color: #0f766e;
    font-size: 34px;
    margin-bottom: 16px;
}

html[dir="rtl"] .compact-auth-icon {
    margin-left: auto;
    margin-right: 0;
}

html[dir="ltr"] .compact-auth-icon {
    margin-right: auto;
    margin-left: 0;
}

.input-wrap {
    position: relative;
}

.password-toggle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 14px;
    background: #f1f5f9;
    cursor: pointer;
    display: grid;
    place-items: center;
    z-index: 5;
}

html[dir="rtl"] .password-toggle {
    left: 10px;
    right: auto;
}

html[dir="ltr"] .password-toggle {
    right: 10px;
    left: auto;
}

html[dir="rtl"] .input-icon {
    right: 14px;
    left: auto;
}

html[dir="ltr"] .input-icon {
    left: 14px;
    right: auto;
}

html[dir="rtl"] .input-wrap input {
    padding-right: 58px;
    padding-left: 64px;
}

html[dir="ltr"] .input-wrap input {
    padding-left: 58px;
    padding-right: 64px;
}

/* Reset password compact page - polished centered card */
.compact-auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background:
        radial-gradient(circle at top right, rgba(20, 184, 166, .14), transparent 34%),
        radial-gradient(circle at bottom left, rgba(15, 118, 110, .10), transparent 34%),
        #f8fafc;
}

.compact-auth-shell {
    width: min(560px, 100%);
    margin: 0 auto;
}

.compact-auth-panel {
    width: 100%;
    max-width: 560px;
    background: rgba(255, 255, 255, .96);
    border: 1px solid #dbeafe;
    border-radius: 32px;
    padding: 34px;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .14);
    backdrop-filter: blur(12px);
}

.compact-auth-panel .auth-language {
    margin-bottom: 22px;
}

.compact-auth-panel .language-link {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.compact-auth-icon {
    width: 74px;
    height: 74px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #ecfeff, #f8fafc);
    border: 1px solid #ccfbf1;
    color: #0f766e;
    font-size: 35px;
    margin: 0 auto 18px;
    box-shadow: 0 14px 38px rgba(15, 118, 110, .12);
}

.compact-auth-panel h2,
.compact-auth-panel p {
    text-align: center;
}

.compact-auth-panel h2 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #0f172a;
}

.compact-auth-panel p {
    margin-bottom: 24px;
    color: #475569;
}

.compact-auth-panel .form-group label {
    display: block;
    margin-bottom: 8px;
}

.compact-auth-panel .btn {
    margin-top: 8px;
    width: 100%;
}

.compact-auth-panel .auth-footer {
    margin-top: 16px;
    text-align: center;
}

/* Keep reset inputs clean in both directions */
.compact-auth-panel .input-wrap input {
    width: 100%;
}

html[dir="rtl"] .compact-auth-panel .input-wrap input {
    text-align: right;
}

html[dir="ltr"] .compact-auth-panel .input-wrap input {
    text-align: left;
}

@media (max-width: 640px) {
    .compact-auth-body {
        padding: 18px;
    }

    .compact-auth-panel {
        padding: 24px;
        border-radius: 24px;
    }
}

/* Login/Register centered layout */
.compact-auth-body .compact-auth-shell {
    width: min(620px, 100%);
}

.compact-auth-body .compact-auth-panel {
    margin: 0 auto;
}

.compact-auth-panel > h2 {
    text-align: center;
    font-size: 38px;
    margin-bottom: 10px;
}

.compact-auth-panel > p {
    text-align: center;
    color: #475569;
    font-size: 21px;
    line-height: 1.7;
    margin-bottom: 24px;
}

.compact-auth-panel .auth-language {
    margin-bottom: 22px;
}

.compact-auth-panel .auth-language .language-link {
    width: 100%;
    min-height: 58px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.compact-auth-panel .auth-footer {
    text-align: center;
}

.home-body {
    min-height: 100vh;
    padding: 32px;
    background:
        radial-gradient(circle at top right, rgba(20, 184, 166, .16), transparent 34%),
        radial-gradient(circle at bottom left, rgba(15, 118, 110, .12), transparent 34%),
        #f8fafc;
    font-family: "Times New Roman", Times, serif;
}

.home-shell {
    width: min(1120px, 100%);
    margin: 0 auto;
    display: grid;
    gap: 24px;
}

.home-card {
    background: rgba(255, 255, 255, .96);
    border: 1px solid #dbeafe;
    border-radius: 34px;
    padding: 38px;
    text-align: center;
    box-shadow: 0 28px 90px rgba(15, 23, 42, .13);
}

.home-language {
    max-width: 260px;
    margin: 0 auto 24px;
}

.home-logo {
    width: 86px;
    height: 86px;
    border-radius: 28px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    color: #fff;
    font-size: 42px;
    margin: 0 auto 20px;
    box-shadow: 0 18px 38px rgba(20, 184, 166, .24);
}

.home-card h1 {
    margin: 0 0 12px;
    color: #0f172a;
    font-size: clamp(42px, 7vw, 72px);
}

.home-card p {
    width: min(760px, 100%);
    margin: 0 auto 26px;
    color: #475569;
    font-size: 24px;
    line-height: 1.8;
}

.home-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.home-actions .btn,
.home-actions .mini-btn {
    min-width: 180px;
    justify-content: center;
}

.home-features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.home-feature {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 22px;
    box-shadow: 0 16px 45px rgba(15, 23, 42, .08);
}

.home-feature span {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: #ecfeff;
    font-size: 30px;
    margin-bottom: 14px;
}

.home-feature h2 {
    margin: 0 0 8px;
    color: #0f766e;
    font-size: 24px;
}

.home-feature p {
    margin: 0;
    color: #475569;
    font-size: 18px;
    line-height: 1.7;
}

html[dir="ltr"] .home-feature {
    text-align: left;
}

html[dir="rtl"] .home-feature {
    text-align: right;
}

@media (max-width: 980px) {
    .home-features {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .home-body {
        padding: 18px;
    }

    .home-card {
        padding: 26px;
    }

    .home-features {
        grid-template-columns: 1fr;
    }
}

.branding-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.branding-preview {
    border: 1px solid #e2e8f0;
    border-radius: 22px;
    background: #f8fafc;
    padding: 16px;
    display: grid;
    gap: 12px;
}

.branding-preview img {
    max-width: 100%;
    height: 90px;
    object-fit: contain;
    background: #fff;
    border-radius: 16px;
    border: 1px dashed #cbd5e1;
    padding: 10px;
}

.branding-preview .favicon-preview {
    width: 90px;
    height: 90px;
    margin: 0 auto;
}

.empty-preview {
    height: 90px;
    border: 1px dashed #cbd5e1;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: #fff;
    font-size: 34px;
}

.settings-inline-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.feature-toggle-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.feature-toggle {
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: #f8fafc;
    padding: 16px;
    display: grid;
    gap: 10px;
    cursor: pointer;
}

.feature-toggle span {
    font-weight: bold;
    color: #0f172a;
}

.feature-toggle strong {
    color: #0f766e;
}

.feature-toggle input {
    width: 22px;
    height: 22px;
}

.mini-btn.danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

@media (max-width: 760px) {
    .branding-preview-grid,
    .feature-toggle-grid {
        grid-template-columns: 1fr;
    }
}

/* Settings page polish fix */
.settings-grid {
    align-items: start;
}

.settings-panel {
    border-radius: 28px;
    padding: 28px;
    overflow: hidden;
}

.settings-panel .form {
    width: 100%;
}

.settings-panel input,
.settings-panel select {
    width: 100%;
    min-height: 58px;
    border: 1px solid #dbeafe;
    border-radius: 18px;
    background: #fff;
    color: #0f172a;
    font-family: "Times New Roman", Times, serif;
    font-size: 20px;
    padding: 0 18px;
    outline: none;
    box-sizing: border-box;
}

.settings-panel input:focus,
.settings-panel select:focus {
    border-color: #14b8a6;
    box-shadow: 0 0 0 5px rgba(20, 184, 166, .12);
}

.settings-panel label {
    display: block;
    margin-bottom: 8px;
    color: #1e293b;
    font-size: 20px;
    font-weight: bold;
}

.settings-panel .btn {
    width: 100%;
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
}

.settings-panel-head {
    align-items: center;
    margin-bottom: 6px;
}

html[dir="rtl"] .settings-panel {
    text-align: right;
}

html[dir="ltr"] .settings-panel {
    text-align: left;
}

html[dir="rtl"] .settings-panel input,
html[dir="rtl"] .settings-panel select {
    text-align: right;
}

html[dir="ltr"] .settings-panel input,
html[dir="ltr"] .settings-panel select {
    text-align: left;
}

.settings-currency-form {
    align-items: end;
}

.feature-toggle {
    position: relative;
}

.feature-toggle input {
    width: 24px;
    min-height: auto;
    height: 24px;
    padding: 0;
}

.feature-toggle strong {
    font-size: 18px;
}

.branding-preview input[type="file"] {
    padding: 14px;
    height: auto;
    min-height: 58px;
}

@media (max-width: 1100px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

/* Restore desktop dashboard layout */
@media (min-width: 901px) {
    body.dashboard-body {
        min-height: 100vh;
        display: grid !important;
        align-items: start;
        gap: 0;
        background: #f8fafc;
    }

    html[dir="rtl"] body.dashboard-body {
        grid-template-columns: minmax(0, 1fr) 320px !important;
    }

    html[dir="ltr"] body.dashboard-body {
        grid-template-columns: 320px minmax(0, 1fr) !important;
    }

    body.dashboard-body > .sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
        width: 320px;
        max-width: 320px;
        box-sizing: border-box;
    }

    html[dir="rtl"] body.dashboard-body > .sidebar {
        grid-column: 2;
        grid-row: 1;
    }

    html[dir="rtl"] body.dashboard-body > .main-content {
        grid-column: 1;
        grid-row: 1;
    }

    html[dir="ltr"] body.dashboard-body > .sidebar {
        grid-column: 1;
        grid-row: 1;
    }

    html[dir="ltr"] body.dashboard-body > .main-content {
        grid-column: 2;
        grid-row: 1;
    }

    body.dashboard-body > .main-content {
        min-width: 0;
        width: 100%;
        padding: 28px;
        box-sizing: border-box;
    }

    .settings-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 18px;
        align-items: start;
    }

    .settings-wide {
        grid-column: 1 / -1 !important;
    }

    .settings-currency-form {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 16px;
    }

    .settings-currency-form button {
        grid-column: 1 / -1;
    }
}

/* Tablet/mobile only: stack layout */
@media (max-width: 900px) {
    body.dashboard-body {
        display: block !important;
    }

    body.dashboard-body > .sidebar {
        width: 100%;
        max-width: none;
        height: auto;
        position: relative;
    }

    body.dashboard-body > .main-content {
        padding: 18px;
    }

    .settings-grid,
    .settings-currency-form,
    .branding-preview-grid,
    .feature-toggle-grid {
        grid-template-columns: 1fr !important;
    }

    .settings-wide {
        grid-column: auto !important;
    }
}

/* Keep dashboard sidebar on the right for both Arabic and English */
@media (min-width: 901px) {
    body.dashboard-body {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) 320px !important;
        align-items: start;
    }

    body.dashboard-body > .sidebar {
        grid-column: 2 !important;
        grid-row: 1 !important;
        width: 320px;
        max-width: 320px;
        height: 100vh;
        position: sticky;
        top: 0;
        overflow-y: auto;
    }

    body.dashboard-body > .main-content {
        grid-column: 1 !important;
        grid-row: 1 !important;
        min-width: 0;
        width: 100%;
        padding: 28px;
        box-sizing: border-box;
    }
}

/* Keep English content readable while sidebar stays right */
html[dir="ltr"] .main-content {
    direction: ltr;
}

html[dir="ltr"] .topbar,
html[dir="ltr"] .panel,
html[dir="ltr"] .settings-panel,
html[dir="ltr"] .data-table th,
html[dir="ltr"] .data-table td {
    text-align: left;
}

html[dir="ltr"] .settings-panel-head,
html[dir="ltr"] .topbar,
html[dir="ltr"] .wallet-main,
html[dir="ltr"] .category-main {
    direction: ltr;
}

/* Force admin/dashboard sidebar to the RIGHT on desktop for both Arabic and English */
@media (min-width: 901px) {
    body.dashboard-body {
        display: block !important;
        min-height: 100vh;
        background: #f8fafc;
    }

    body.dashboard-body > .sidebar {
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        left: auto !important;
        width: 320px !important;
        max-width: 320px !important;
        height: 100vh !important;
        overflow-y: auto !important;
        z-index: 50 !important;
        box-sizing: border-box !important;
    }

    body.dashboard-body > .main-content {
        width: auto !important;
        min-width: 0 !important;
        margin-right: 320px !important;
        margin-left: 0 !important;
        padding: 32px !important;
        box-sizing: border-box !important;
    }

    html[dir="ltr"] body.dashboard-body > .main-content {
        direction: ltr;
        text-align: left;
    }

    html[dir="rtl"] body.dashboard-body > .main-content {
        direction: rtl;
        text-align: right;
    }
}

/* Mobile: sidebar returns to normal stacked layout */
@media (max-width: 900px) {
    body.dashboard-body > .sidebar {
        position: relative !important;
        right: auto !important;
        left: auto !important;
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
    }

    body.dashboard-body > .main-content {
        margin-right: 0 !important;
        margin-left: 0 !important;
        padding: 18px !important;
    }
}

/* Dynamic site logo in sidebar */
.side-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.side-brand {
    align-items: center;
}

/* Three branding upload cards: Arabic logo, English logo, favicon */
.branding-preview-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 980px) {
    .branding-preview-grid-three {
        grid-template-columns: 1fr !important;
    }
}

/* Branding settings: Arabic logo, English logo, favicon */
.branding-preview-grid-three {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

@media (max-width: 1100px) {
    .branding-preview-grid-three {
        grid-template-columns: 1fr !important;
    }
}

/* Dashboard sidebar follows current language direction */
@media (min-width: 901px) {
    body.dashboard-body {
        display: block !important;
        min-height: 100vh;
        background: #f8fafc;
    }

    body.dashboard-body > .sidebar {
        position: fixed !important;
        top: 0 !important;
        width: 320px !important;
        max-width: 320px !important;
        height: 100vh !important;
        overflow-y: auto !important;
        z-index: 50 !important;
        box-sizing: border-box !important;
    }

    /* Arabic: sidebar on right */
    html[dir="rtl"] body.dashboard-body > .sidebar {
        right: 0 !important;
        left: auto !important;
    }

    html[dir="rtl"] body.dashboard-body > .main-content {
        margin-right: 320px !important;
        margin-left: 0 !important;
        direction: rtl;
        text-align: right;
    }

    /* English: sidebar on left */
    html[dir="ltr"] body.dashboard-body > .sidebar {
        left: 0 !important;
        right: auto !important;
    }

    html[dir="ltr"] body.dashboard-body > .main-content {
        margin-left: 320px !important;
        margin-right: 0 !important;
        direction: ltr;
        text-align: left;
    }

    body.dashboard-body > .main-content {
        width: auto !important;
        min-width: 0 !important;
        padding: 32px !important;
        box-sizing: border-box !important;
    }
}

/* Mobile: stacked layout */
@media (max-width: 900px) {
    body.dashboard-body > .sidebar {
        position: relative !important;
        right: auto !important;
        left: auto !important;
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
    }

    body.dashboard-body > .main-content {
        margin-right: 0 !important;
        margin-left: 0 !important;
        padding: 18px !important;
    }
}

/* Mobile hamburger sidebar */
.mobile-menu-toggle,
.mobile-menu-backdrop {
    display: none;
}

@media (max-width: 900px) {
    body.dashboard-body {
        padding-top: 74px;
        overflow-x: hidden;
    }

    .mobile-menu-toggle {
        position: fixed;
        top: 14px;
        z-index: 1002;
        width: 52px;
        height: 52px;
        border: 1px solid rgba(15, 118, 110, .18);
        border-radius: 18px;
        background: linear-gradient(135deg, #0f766e, #14b8a6);
        box-shadow: 0 18px 40px rgba(15, 118, 110, .28);
        display: grid;
        place-items: center;
        gap: 0;
        cursor: pointer;
    }

    html[dir="rtl"] .mobile-menu-toggle {
        right: 16px;
        left: auto;
    }

    html[dir="ltr"] .mobile-menu-toggle {
        left: 16px;
        right: auto;
    }

    .mobile-menu-toggle span {
        width: 24px;
        height: 3px;
        border-radius: 999px;
        background: #fff;
        display: block;
        transition: transform .22s ease, opacity .22s ease;
        margin: 2px 0;
    }

    .mobile-menu-toggle.is-open span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .mobile-menu-toggle.is-open span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-toggle.is-open span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .mobile-menu-backdrop {
        position: fixed;
        inset: 0;
        z-index: 998;
        border: 0;
        background: rgba(15, 23, 42, .45);
        backdrop-filter: blur(3px);
        opacity: 0;
        pointer-events: none;
        transition: opacity .22s ease;
    }

    body.mobile-sidebar-open .mobile-menu-backdrop {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    body.dashboard-body > .sidebar {
        position: fixed !important;
        top: 0 !important;
        width: min(86vw, 340px) !important;
        max-width: 340px !important;
        height: 100vh !important;
        overflow-y: auto !important;
        z-index: 1000 !important;
        padding-top: 82px !important;
        box-shadow: 0 24px 70px rgba(15, 23, 42, .35);
        transition: transform .25s ease;
    }

    html[dir="rtl"] body.dashboard-body > .sidebar {
        right: 0 !important;
        left: auto !important;
        transform: translateX(105%);
    }

    html[dir="ltr"] body.dashboard-body > .sidebar {
        left: 0 !important;
        right: auto !important;
        transform: translateX(-105%);
    }

    html[dir="rtl"] body.mobile-sidebar-open.dashboard-body > .sidebar,
    html[dir="rtl"] body.mobile-sidebar-open > .sidebar {
        transform: translateX(0);
    }

    html[dir="ltr"] body.mobile-sidebar-open.dashboard-body > .sidebar,
    html[dir="ltr"] body.mobile-sidebar-open > .sidebar {
        transform: translateX(0);
    }

    body.dashboard-body > .main-content {
        margin: 0 !important;
        padding: 18px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .topbar {
        padding-top: 8px;
    }
}

/* Mawzena global mobile hamburger sidebar for every dashboard page */
.mobile-menu-toggle,
.mobile-menu-backdrop {
    display: none;
}

@media (max-width: 900px) {
    body.dashboard-body {
        padding-top: 76px !important;
        overflow-x: hidden !important;
        min-height: 100vh;
    }

    .mobile-menu-toggle {
        position: fixed !important;
        top: 14px !important;
        z-index: 1002 !important;
        width: 54px !important;
        height: 54px !important;
        border: 1px solid rgba(15, 118, 110, .18) !important;
        border-radius: 18px !important;
        background: linear-gradient(135deg, #0f766e, #14b8a6) !important;
        box-shadow: 0 18px 40px rgba(15, 118, 110, .28) !important;
        display: grid !important;
        place-items: center !important;
        cursor: pointer !important;
        padding: 0 !important;
    }

    html[dir="rtl"] .mobile-menu-toggle {
        right: 16px !important;
        left: auto !important;
    }

    html[dir="ltr"] .mobile-menu-toggle {
        left: 16px !important;
        right: auto !important;
    }

    .mobile-menu-toggle span {
        width: 25px !important;
        height: 3px !important;
        border-radius: 999px !important;
        background: #fff !important;
        display: block !important;
        transition: transform .22s ease, opacity .22s ease !important;
        margin: 2px 0 !important;
    }

    .mobile-menu-toggle.is-open span:nth-child(1) {
        transform: translateY(7px) rotate(45deg) !important;
    }

    .mobile-menu-toggle.is-open span:nth-child(2) {
        opacity: 0 !important;
    }

    .mobile-menu-toggle.is-open span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg) !important;
    }

    .mobile-menu-backdrop {
        position: fixed !important;
        inset: 0 !important;
        z-index: 998 !important;
        border: 0 !important;
        background: rgba(15, 23, 42, .48) !important;
        backdrop-filter: blur(3px) !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transition: opacity .22s ease !important;
    }

    body.mobile-sidebar-open .mobile-menu-backdrop {
        display: block !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    body.dashboard-body > .sidebar {
        position: fixed !important;
        top: 0 !important;
        width: min(88vw, 340px) !important;
        max-width: 340px !important;
        height: 100vh !important;
        overflow-y: auto !important;
        z-index: 1000 !important;
        padding-top: 84px !important;
        box-shadow: 0 24px 70px rgba(15, 23, 42, .35) !important;
        transition: transform .25s ease !important;
        margin: 0 !important;
    }

    html[dir="rtl"] body.dashboard-body > .sidebar {
        right: 0 !important;
        left: auto !important;
        transform: translateX(105%) !important;
    }

    html[dir="ltr"] body.dashboard-body > .sidebar {
        left: 0 !important;
        right: auto !important;
        transform: translateX(-105%) !important;
    }

    html[dir="rtl"] body.mobile-sidebar-open.dashboard-body > .sidebar,
    html[dir="ltr"] body.mobile-sidebar-open.dashboard-body > .sidebar {
        transform: translateX(0) !important;
    }

    body.dashboard-body > .main-content {
        margin: 0 !important;
        padding: 18px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .topbar {
        padding-top: 4px !important;
    }

    .settings-grid,
    .stats-grid,
    .wallets-grid,
    .categories-grid,
    .home-features {
        grid-template-columns: 1fr !important;
    }

    .panel,
    .settings-panel,
    .stat-card,
    .wallet-card,
    .category-card {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .data-table-wrap,
    .table-wrap {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* === MAWZENA FINAL GLOBAL MOBILE HAMBURGER MENU === */
.mobile-menu-toggle,
.mobile-menu-backdrop {
    display: none;
}

@media (max-width: 900px) {
    html,
    body {
        overflow-x: hidden !important;
    }

    body.dashboard-body {
        display: block !important;
        padding-top: 76px !important;
        min-height: 100vh !important;
        background: #f8fafc !important;
    }

    body.dashboard-body > .main-content,
    .dashboard-body .main-content {
        margin: 0 !important;
        padding: 18px !important;
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .mobile-menu-toggle {
        display: grid !important;
        position: fixed !important;
        top: 14px !important;
        z-index: 2001 !important;
        width: 54px !important;
        height: 54px !important;
        place-items: center !important;
        border: 1px solid rgba(15, 118, 110, .18) !important;
        border-radius: 18px !important;
        background: linear-gradient(135deg, #0f766e, #14b8a6) !important;
        box-shadow: 0 18px 40px rgba(15, 118, 110, .28) !important;
        cursor: pointer !important;
        padding: 0 !important;
    }

    html[dir="rtl"] .mobile-menu-toggle {
        right: 16px !important;
        left: auto !important;
    }

    html[dir="ltr"] .mobile-menu-toggle {
        left: 16px !important;
        right: auto !important;
    }

    .mobile-menu-toggle span {
        display: block !important;
        width: 25px !important;
        height: 3px !important;
        margin: 2px 0 !important;
        background: #fff !important;
        border-radius: 999px !important;
        transition: transform .22s ease, opacity .22s ease !important;
    }

    .mobile-menu-toggle.is-open span:nth-child(1) {
        transform: translateY(7px) rotate(45deg) !important;
    }

    .mobile-menu-toggle.is-open span:nth-child(2) {
        opacity: 0 !important;
    }

    .mobile-menu-toggle.is-open span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg) !important;
    }

    .mobile-menu-backdrop {
        position: fixed !important;
        inset: 0 !important;
        z-index: 1998 !important;
        width: 100vw !important;
        height: 100vh !important;
        border: 0 !important;
        background: rgba(15, 23, 42, .48) !important;
        backdrop-filter: blur(3px) !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transition: opacity .22s ease !important;
    }

    body.mobile-sidebar-open .mobile-menu-backdrop {
        display: block !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    body.dashboard-body > .sidebar,
    .dashboard-body .sidebar {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        width: min(88vw, 340px) !important;
        max-width: 340px !important;
        height: 100vh !important;
        min-height: 100vh !important;
        overflow-y: auto !important;
        z-index: 2000 !important;
        padding-top: 84px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        box-shadow: 0 24px 70px rgba(15, 23, 42, .35) !important;
        transition: transform .25s ease !important;
    }

    html[dir="rtl"] body.dashboard-body > .sidebar,
    html[dir="rtl"] .dashboard-body .sidebar {
        right: 0 !important;
        left: auto !important;
        transform: translateX(110%) !important;
    }

    html[dir="ltr"] body.dashboard-body > .sidebar,
    html[dir="ltr"] .dashboard-body .sidebar {
        left: 0 !important;
        right: auto !important;
        transform: translateX(-110%) !important;
    }

    html[dir="rtl"] body.mobile-sidebar-open.dashboard-body > .sidebar,
    html[dir="rtl"] body.mobile-sidebar-open .sidebar,
    html[dir="ltr"] body.mobile-sidebar-open.dashboard-body > .sidebar,
    html[dir="ltr"] body.mobile-sidebar-open .sidebar {
        transform: translateX(0) !important;
    }

    .topbar {
        padding-top: 4px !important;
    }

    .settings-grid,
    .stats-grid,
    .wallets-grid,
    .categories-grid,
    .feature-toggle-grid,
    .branding-preview-grid,
    .settings-currency-form {
        grid-template-columns: 1fr !important;
    }

    .panel,
    .settings-panel,
    .stat-card,
    .wallet-card,
    .category-card {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .data-table-wrap,
    .table-wrap {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* FINAL OVERRIDE: mobile sidebar must be hidden by default on every dashboard page */
@media only screen and (max-width: 900px) {
    body.dashboard-body > aside.sidebar,
    body.dashboard-body aside.sidebar,
    aside.sidebar {
        position: fixed !important;
        top: 0 !important;
        width: min(88vw, 340px) !important;
        max-width: 340px !important;
        height: 100vh !important;
        min-height: 100vh !important;
        overflow-y: auto !important;
        z-index: 2000 !important;
        padding-top: 84px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        box-shadow: 0 24px 70px rgba(15, 23, 42, .35) !important;
        transition: transform .25s ease !important;
        display: block !important;
        visibility: visible !important;
    }

    html[dir="rtl"] body.dashboard-body > aside.sidebar,
    html[dir="rtl"] body.dashboard-body aside.sidebar,
    html[dir="rtl"] aside.sidebar {
        right: 0 !important;
        left: auto !important;
        transform: translate3d(110%, 0, 0) !important;
    }

    html[dir="ltr"] body.dashboard-body > aside.sidebar,
    html[dir="ltr"] body.dashboard-body aside.sidebar,
    html[dir="ltr"] aside.sidebar {
        left: 0 !important;
        right: auto !important;
        transform: translate3d(-110%, 0, 0) !important;
    }

    html[dir="rtl"] body.dashboard-body.mobile-sidebar-open > aside.sidebar,
    html[dir="rtl"] body.dashboard-body.mobile-sidebar-open aside.sidebar,
    html[dir="rtl"] body.mobile-sidebar-open aside.sidebar,
    html[dir="ltr"] body.dashboard-body.mobile-sidebar-open > aside.sidebar,
    html[dir="ltr"] body.dashboard-body.mobile-sidebar-open aside.sidebar,
    html[dir="ltr"] body.mobile-sidebar-open aside.sidebar {
        transform: translate3d(0, 0, 0) !important;
    }

    body.dashboard-body > .main-content,
    body.dashboard-body main.main-content,
    main.main-content {
        margin-right: 0 !important;
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 18px !important;
        box-sizing: border-box !important;
    }

    body.dashboard-body {
        padding-top: 76px !important;
    }

    body.dashboard-body:not(.mobile-sidebar-open) .mobile-menu-backdrop {
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    body.dashboard-body.mobile-sidebar-open .mobile-menu-backdrop {
        display: block !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .mobile-menu-toggle {
        display: grid !important;
    }
}

/* === CLEAN FINAL MOBILE SIDEBAR / HAMBURGER === */
.mobile-menu-toggle,
.mobile-menu-backdrop {
    display: none;
}

@media only screen and (max-width: 900px) {
    html,
    body {
        overflow-x: hidden !important;
    }

    body.dashboard-body {
        display: block !important;
        min-height: 100vh !important;
        background: #f8fafc !important;
        padding-top: 0 !important;
    }

    body.dashboard-body > .main-content,
    body.dashboard-body main.main-content,
    main.main-content {
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding: 18px !important;
        box-sizing: border-box !important;
    }

    /* Keep hamburger from covering page title */
    body.dashboard-body .topbar {
        min-height: 74px !important;
        padding-top: 8px !important;
        box-sizing: border-box !important;
    }

    html[dir="ltr"] body.dashboard-body .topbar {
        padding-left: 78px !important;
        padding-right: 0 !important;
        text-align: left !important;
    }

    html[dir="rtl"] body.dashboard-body .topbar {
        padding-right: 78px !important;
        padding-left: 0 !important;
        text-align: right !important;
    }

    .mobile-menu-toggle {
        display: grid !important;
        position: fixed !important;
        top: 18px !important;
        z-index: 3001 !important;
        width: 54px !important;
        height: 54px !important;
        place-items: center !important;
        border: 1px solid rgba(15, 118, 110, .18) !important;
        border-radius: 18px !important;
        background: linear-gradient(135deg, #0f766e, #14b8a6) !important;
        box-shadow: 0 18px 40px rgba(15, 118, 110, .28) !important;
        cursor: pointer !important;
        padding: 0 !important;
    }

    html[dir="rtl"] .mobile-menu-toggle {
        right: 16px !important;
        left: auto !important;
    }

    html[dir="ltr"] .mobile-menu-toggle {
        left: 16px !important;
        right: auto !important;
    }

    .mobile-menu-toggle span {
        display: block !important;
        width: 25px !important;
        height: 3px !important;
        margin: 2px 0 !important;
        background: #fff !important;
        border-radius: 999px !important;
        transition: transform .22s ease, opacity .22s ease !important;
    }

    .mobile-menu-toggle.is-open span:nth-child(1) {
        transform: translateY(7px) rotate(45deg) !important;
    }

    .mobile-menu-toggle.is-open span:nth-child(2) {
        opacity: 0 !important;
    }

    .mobile-menu-toggle.is-open span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg) !important;
    }

    .mobile-menu-backdrop {
        position: fixed !important;
        inset: 0 !important;
        z-index: 2998 !important;
        width: 100vw !important;
        height: 100vh !important;
        border: 0 !important;
        background: rgba(15, 23, 42, .48) !important;
        backdrop-filter: blur(3px) !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transition: opacity .22s ease !important;
    }

    body.dashboard-body.mobile-sidebar-open .mobile-menu-backdrop {
        display: block !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    body.dashboard-body > aside.sidebar,
    body.dashboard-body aside.sidebar,
    body.dashboard-body > .sidebar,
    body.dashboard-body .sidebar {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        width: min(88vw, 340px) !important;
        max-width: 340px !important;
        height: 100vh !important;
        min-height: 100vh !important;
        overflow-y: auto !important;
        z-index: 3000 !important;
        padding-top: 92px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        box-shadow: 0 24px 70px rgba(15, 23, 42, .35) !important;
        transition: transform .25s ease !important;
        visibility: visible !important;
    }

    html[dir="rtl"] body.dashboard-body > aside.sidebar,
    html[dir="rtl"] body.dashboard-body aside.sidebar,
    html[dir="rtl"] body.dashboard-body > .sidebar,
    html[dir="rtl"] body.dashboard-body .sidebar {
        right: 0 !important;
        left: auto !important;
        transform: translate3d(110%, 0, 0) !important;
    }

    html[dir="ltr"] body.dashboard-body > aside.sidebar,
    html[dir="ltr"] body.dashboard-body aside.sidebar,
    html[dir="ltr"] body.dashboard-body > .sidebar,
    html[dir="ltr"] body.dashboard-body .sidebar {
        left: 0 !important;
        right: auto !important;
        transform: translate3d(-110%, 0, 0) !important;
    }

    html[dir="rtl"] body.dashboard-body.mobile-sidebar-open > aside.sidebar,
    html[dir="rtl"] body.dashboard-body.mobile-sidebar-open aside.sidebar,
    html[dir="rtl"] body.dashboard-body.mobile-sidebar-open > .sidebar,
    html[dir="rtl"] body.dashboard-body.mobile-sidebar-open .sidebar,
    html[dir="ltr"] body.dashboard-body.mobile-sidebar-open > aside.sidebar,
    html[dir="ltr"] body.dashboard-body.mobile-sidebar-open aside.sidebar,
    html[dir="ltr"] body.dashboard-body.mobile-sidebar-open > .sidebar,
    html[dir="ltr"] body.dashboard-body.mobile-sidebar-open .sidebar {
        transform: translate3d(0, 0, 0) !important;
    }

    .settings-grid,
    .stats-grid,
    .wallets-grid,
    .categories-grid,
    .feature-toggle-grid,
    .branding-preview-grid,
    .settings-currency-form {
        grid-template-columns: 1fr !important;
    }

    .panel,
    .settings-panel,
    .stat-card,
    .wallet-card,
    .category-card {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .data-table-wrap,
    .table-wrap {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* Better feature toggles in settings */
.feature-toggle-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.feature-toggle {
    position: relative;
    min-height: 68px;
    border: 1px solid #dbeafe;
    border-radius: 22px;
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    padding: 14px 18px;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .04);
    cursor: pointer;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.feature-toggle:hover {
    transform: translateY(-1px);
    border-color: #99f6e4;
    box-shadow: 0 16px 34px rgba(15, 118, 110, .10);
}

.feature-toggle span {
    color: #0f172a;
    font-size: 19px;
    font-weight: bold;
    line-height: 1.4;
}

.feature-toggle input[type="checkbox"] {
    width: 24px !important;
    min-width: 24px !important;
    height: 24px !important;
    min-height: 24px !important;
    margin: 0 !important;
    padding: 0 !important;
    accent-color: #0f766e;
    cursor: pointer;
}

.feature-toggle strong {
    min-width: 58px;
    border-radius: 999px;
    padding: 6px 10px;
    background: #ecfeff;
    color: #0f766e;
    font-size: 15px;
    text-align: center;
}

/* Arabic order: feature name -> checkbox -> status from the right */
html[dir="rtl"] .feature-toggle {
    direction: rtl;
    text-align: right;
    flex-direction: row;
}

html[dir="rtl"] .feature-toggle span {
    margin-inline-end: 0;
    margin-inline-start: auto;
}

html[dir="rtl"] .feature-toggle input[type="checkbox"] {
    order: 2;
}

html[dir="rtl"] .feature-toggle strong {
    order: 3;
}

/* English order: feature name -> checkbox -> status from the left */
html[dir="ltr"] .feature-toggle {
    direction: ltr;
    text-align: left;
    flex-direction: row;
}

html[dir="ltr"] .feature-toggle span {
    margin-inline-start: 0;
    margin-inline-end: auto;
}

html[dir="ltr"] .feature-toggle input[type="checkbox"] {
    order: 2;
}

html[dir="ltr"] .feature-toggle strong {
    order: 3;
}

/* Disabled visual state when checkbox is not checked */
.feature-toggle:has(input[type="checkbox"]:not(:checked)) {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.feature-toggle:has(input[type="checkbox"]:not(:checked)) strong {
    background: #f1f5f9;
    color: #64748b;
}

/* Mobile */
@media (max-width: 900px) {
    .feature-toggle-grid {
        grid-template-columns: 1fr !important;
    }

    .feature-toggle {
        min-height: 62px;
        padding: 13px 15px;
    }

    .feature-toggle span {
        font-size: 18px;
    }
}

/* Final feature toggle layout: checkbox first, title beside it, status below title */
.feature-toggle-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.feature-toggle {
    position: relative;
    min-height: 74px;
    border: 1px solid #dbeafe;
    border-radius: 22px;
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    padding: 15px 18px;
    display: grid !important;
    grid-template-columns: 28px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 3px;
    align-items: center;
    justify-content: initial !important;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .04);
    cursor: pointer;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.feature-toggle:hover {
    transform: translateY(-1px);
    border-color: #99f6e4;
    box-shadow: 0 16px 34px rgba(15, 118, 110, .10);
}

.feature-toggle input[type="checkbox"] {
    grid-column: 1;
    grid-row: 1 / span 2;
    width: 24px !important;
    min-width: 24px !important;
    height: 24px !important;
    min-height: 24px !important;
    margin: 0 !important;
    padding: 0 !important;
    accent-color: #0f766e;
    cursor: pointer;
    align-self: start;
    margin-top: 3px !important;
}

.feature-toggle span {
    grid-column: 2;
    grid-row: 1;
    color: #0f172a;
    font-size: 19px;
    font-weight: bold;
    line-height: 1.35;
    margin: 0 !important;
}

.feature-toggle strong {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    width: fit-content;
    border-radius: 999px;
    padding: 3px 9px;
    background: #ecfeff;
    color: #0f766e;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
    margin: 0 !important;
}

/* Same visual order in Arabic and English: checkbox first, title beside it */
html[dir="rtl"] .feature-toggle,
html[dir="ltr"] .feature-toggle {
    direction: inherit;
    text-align: inherit;
    flex-direction: initial !important;
}

html[dir="rtl"] .feature-toggle {
    direction: rtl;
}

html[dir="ltr"] .feature-toggle {
    direction: ltr;
}

html[dir="rtl"] .feature-toggle span,
html[dir="rtl"] .feature-toggle strong {
    text-align: right;
}

html[dir="ltr"] .feature-toggle span,
html[dir="ltr"] .feature-toggle strong {
    text-align: left;
}

/* Disabled visual state */
.feature-toggle:has(input[type="checkbox"]:not(:checked)) {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.feature-toggle:has(input[type="checkbox"]:not(:checked)) strong {
    background: #f1f5f9;
    color: #64748b;
}

@media (max-width: 900px) {
    .feature-toggle-grid {
        grid-template-columns: 1fr !important;
    }

    .feature-toggle {
        min-height: 68px;
        padding: 14px 15px;
    }

    .feature-toggle span {
        font-size: 18px;
    }
}

/* Settings buttons should not be stretched like full-width bars */
.settings-panel .btn {
    width: auto !important;
    min-width: 190px !important;
    max-width: max-content !important;
    min-height: 52px !important;
    padding: 0 26px !important;
    border-radius: 16px !important;
    margin-top: 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Keep main form actions aligned nicely by language */
html[dir="rtl"] .settings-panel .form > .btn {
    margin-right: auto !important;
    margin-left: 0 !important;
}

html[dir="ltr"] .settings-panel .form > .btn {
    margin-left: auto !important;
    margin-right: 0 !important;
}

/* Feature save button can be centered because it controls the whole section */
.settings-panel.settings-wide .form > .btn {
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Branding delete buttons: compact and placed cleanly */
.settings-inline-actions {
    margin-top: 14px !important;
    padding-top: 14px !important;
    border-top: 1px dashed #dbeafe !important;
    display: flex !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
    align-items: center !important;
}

html[dir="rtl"] .settings-inline-actions {
    justify-content: flex-start !important;
}

html[dir="ltr"] .settings-inline-actions {
    justify-content: flex-end !important;
}

.settings-inline-actions form {
    margin: 0 !important;
}

.settings-inline-actions .mini-btn,
.settings-inline-actions .mini-btn.danger {
    width: auto !important;
    min-width: auto !important;
    min-height: 38px !important;
    padding: 7px 13px !important;
    border-radius: 12px !important;
    font-size: 15px !important;
    line-height: 1.2 !important;
    box-shadow: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
}

/* Branding upload save button: keep it tidy under the cards */
.branding-preview-grid + .btn,
.branding-preview-grid-three + .btn {
    margin-top: 14px !important;
}

/* File upload boxes should not make the branding card feel crowded */
.branding-preview {
    padding: 14px !important;
    gap: 10px !important;
}

.branding-preview input[type="file"] {
    min-height: 46px !important;
    height: auto !important;
    padding: 9px 10px !important;
    border-radius: 14px !important;
    font-size: 15px !important;
}

/* Smaller cards on wide screens so the section breathes */
.branding-preview img,
.empty-preview {
    height: 78px !important;
}

/* General settings forms: smaller action area */
.settings-panel .form {
    gap: 14px !important;
}

/* Mobile: buttons become comfortable but not huge */
@media (max-width: 900px) {
    .settings-panel .btn {
        width: 100% !important;
        max-width: none !important;
        min-height: 52px !important;
    }

    .settings-inline-actions {
        justify-content: stretch !important;
    }

    .settings-inline-actions form {
        flex: 1 1 100% !important;
    }

    .settings-inline-actions .mini-btn,
    .settings-inline-actions .mini-btn.danger {
        width: 100% !important;
        min-height: 42px !important;
    }
}

/* Sidebar logo box: light background for better logo visibility */
.side-logo {
    background: rgba(255, 255, 255, .92) !important;
    border: 1px solid rgba(255, 255, 255, .75) !important;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .16) !important;
}

.side-logo img {
    background: transparent !important;
    border-radius: 12px !important;
    padding: 4px !important;
    object-fit: contain !important;
}

/* Slightly softer on mobile/sidebar */
@media (max-width: 900px) {
    .side-logo {
        background: #ffffff !important;
    }
}

/* Monthly dashboard navigation */
.monthly-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.month-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #dbeafe;
    border-radius: 22px;
    padding: 8px;
    box-shadow: 0 16px 38px rgba(15, 23, 42, .06);
}

.month-btn {
    min-height: 44px;
    padding: 0 14px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #0f766e;
    background: #ecfeff;
    border: 1px solid #99f6e4;
    text-decoration: none;
    font-weight: bold;
    white-space: nowrap;
}

.month-current {
    min-width: 170px;
    text-align: center;
    display: grid;
    gap: 2px;
}

.month-current span {
    color: #0f172a;
    font-size: 22px;
    font-weight: bold;
}

.month-current a {
    color: #0f766e;
    font-size: 15px;
    text-decoration: none;
}

.monthly-stats-grid .stat-card-wide {
    grid-column: span 2;
}

.dashboard-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 18px 0;
}

.monthly-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.empty-state {
    border: 1px dashed #cbd5e1;
    border-radius: 18px;
    background: #f8fafc;
    padding: 22px;
    color: #64748b;
    text-align: center;
    font-size: 18px;
}

.top-expense-list,
.budget-list {
    display: grid;
    gap: 12px;
}

.top-expense-item,
.budget-item {
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: #f8fafc;
    padding: 14px;
}

.top-expense-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.top-expense-item > div,
.budget-head > div {
    display: flex;
    align-items: center;
    gap: 9px;
}

.expense-icon,
.budget-head span {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: #ecfeff;
}

.top-expense-item strong,
.budget-head strong {
    color: #0f172a;
    font-size: 18px;
}

.top-expense-item b,
.budget-head b {
    color: #0f766e;
    white-space: nowrap;
}

.budget-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.budget-bar {
    height: 12px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
    margin: 12px 0 8px;
}

.budget-bar i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(135deg, #0f766e, #14b8a6);
}

.budget-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: #64748b;
    font-size: 15px;
}

@media (max-width: 1100px) {
    .monthly-topbar,
    .month-switcher {
        flex-direction: column;
        align-items: stretch;
    }

    .month-btn,
    .month-current {
        width: 100%;
    }

    .monthly-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .monthly-stats-grid .stat-card-wide {
        grid-column: auto;
    }
}

/* Debts page */
.debt-stats-grid {
    margin-bottom: 18px;
}

.debts-layout {
    display: grid;
    grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.debt-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.debt-form-full {
    grid-column: 1 / -1;
}

.debt-form textarea {
    width: 100%;
    border: 1px solid #dbeafe;
    border-radius: 18px;
    padding: 14px;
    font-family: "Times New Roman", Times, serif;
    font-size: 18px;
    resize: vertical;
    box-sizing: border-box;
}

.debt-form .btn {
    grid-column: 1 / -1;
}

.debt-list {
    display: grid;
    gap: 14px;
}

.debt-card {
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    padding: 18px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .06);
}

.debt-status-overdue {
    border-color: #fecaca;
    background: linear-gradient(135deg, #fff, #fff7f7);
}

.debt-status-completed {
    border-color: #bbf7d0;
    background: linear-gradient(135deg, #fff, #f0fdf4);
}

.debt-card-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
}

.debt-card h3 {
    margin: 8px 0 4px;
    color: #0f172a;
    font-size: 25px;
}

.debt-card p {
    margin: 0;
    color: #64748b;
}

.debt-type-badge,
.debt-status {
    border-radius: 999px;
    padding: 6px 11px;
    background: #ecfeff;
    color: #0f766e;
    font-size: 15px;
    white-space: nowrap;
}

.debt-status-overdue .debt-status {
    background: #fee2e2;
    color: #991b1b;
}

.debt-status-completed .debt-status {
    background: #dcfce7;
    color: #166534;
}

.debt-money-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 16px 0;
}

.debt-money-grid div {
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: #fff;
    padding: 12px;
}

.debt-money-grid small {
    display: block;
    color: #64748b;
    margin-bottom: 5px;
}

.debt-money-grid b {
    color: #0f766e;
    font-size: 18px;
}

.debt-progress {
    height: 12px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.debt-progress i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(135deg, #0f766e, #14b8a6);
}

.debt-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: #64748b;
    margin-top: 10px;
}

.debt-payment-details {
    margin-top: 14px;
    border: 1px dashed #cbd5e1;
    border-radius: 18px;
    padding: 12px;
    background: #fff;
}

.debt-payment-details summary {
    cursor: pointer;
    color: #0f766e;
    font-weight: bold;
}

.debt-payment-form {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.debt-check-row {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    align-items: center;
    color: #334155;
}

.debt-check-row input {
    width: 20px;
    height: 20px;
    accent-color: #0f766e;
}

.debt-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.debt-actions form {
    margin: 0;
}

.mini-btn.danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

@media (max-width: 1100px) {
    .debts-layout,
    .debt-form,
    .debt-payment-form,
    .debt-money-grid {
        grid-template-columns: 1fr;
    }

    .debt-card-head {
        flex-direction: column;
    }
}

/* Full debts and installments system */
.full-debts-layout {
    grid-template-columns: minmax(340px, 430px) minmax(0, 1fr) !important;
}

.installment-box {
    border: 1px dashed #99f6e4;
    border-radius: 20px;
    background: #f0fdfa;
    padding: 14px;
}

.installment-input-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.debt-list-head {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
}

.debt-filter-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.debt-filter-row a {
    text-decoration: none;
    border: 1px solid #dbeafe;
    color: #0f766e;
    background: #fff;
    border-radius: 999px;
    padding: 7px 12px;
    font-weight: bold;
}

.debt-filter-row a.active {
    background: #0f766e;
    color: #fff;
    border-color: #0f766e;
}

.debt-type-badge.gold {
    background: #fef3c7;
    color: #92400e;
}

.installment-table-wrap {
    overflow-x: auto;
    margin-top: 12px;
}

.installment-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    min-width: 980px;
}

.installment-table th {
    color: #64748b;
    font-size: 14px;
    text-align: start;
    padding: 6px 8px;
}

.installment-table td {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 8px;
    vertical-align: top;
}

.installment-table td:first-child {
    border-inline-start: 1px solid #e2e8f0;
    border-start-start-radius: 14px;
    border-end-start-radius: 14px;
}

.installment-table td:last-child {
    border-inline-end: 1px solid #e2e8f0;
    border-start-end-radius: 14px;
    border-end-end-radius: 14px;
}

.installment-status {
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 13px;
    display: inline-flex;
    white-space: nowrap;
}

.installment-status.status-pending {
    background: #e0f2fe;
    color: #075985;
}

.installment-status.status-paid {
    background: #dcfce7;
    color: #166534;
}

.installment-status.status-overdue {
    background: #fee2e2;
    color: #991b1b;
}

.inline-pay-form {
    display: grid;
    gap: 6px;
    min-width: 260px;
}

.inline-pay-form input,
.inline-pay-form select {
    min-height: 38px;
    border-radius: 12px;
    border: 1px solid #dbeafe;
    padding: 6px 9px;
}

.inline-pay-form label {
    font-size: 13px;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 6px;
}

.payment-history-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.payment-history-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 16px;
    padding: 12px;
}

.payment-history-item > div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.empty-state.small {
    padding: 12px;
    font-size: 16px;
}

@media (max-width: 1100px) {
    .full-debts-layout,
    .installment-input-grid {
        grid-template-columns: 1fr !important;
    }

    .payment-history-item {
        flex-direction: column;
        align-items: stretch;
    }
}

/* FINAL Debts page UI cleanup */
.debts-layout.full-debts-layout {
    grid-template-columns: minmax(360px, 460px) minmax(0, 1fr) !important;
    gap: 22px !important;
    align-items: start !important;
}

.debt-form-panel,
.debts-list-panel {
    overflow: visible !important;
}

.debt-form-panel h2,
.debts-list-panel h2 {
    margin-bottom: 18px !important;
}

.debt-form {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 18px 14px !important;
}

.debt-form .form-group {
    min-width: 0 !important;
}

.debt-form label,
.debt-payment-form label {
    display: block !important;
    margin-bottom: 8px !important;
    color: #334155 !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
}

.debt-form input,
.debt-form select,
.debt-form textarea,
.debt-payment-form input,
.debt-payment-form select,
.debt-payment-form textarea {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 52px !important;
    box-sizing: border-box !important;
    border: 1px solid #dbeafe !important;
    border-radius: 16px !important;
    background: #fff !important;
    padding: 10px 14px !important;
    font-size: 17px !important;
    font-family: "Times New Roman", Times, serif !important;
    color: #0f172a !important;
}

.debt-form textarea {
    min-height: 92px !important;
    resize: vertical !important;
}

.debt-form input[type="date"],
.debt-payment-form input[type="date"],
.inline-pay-form input[type="date"] {
    direction: ltr !important;
    text-align: start !important;
    unicode-bidi: plaintext !important;
    appearance: auto !important;
    -webkit-appearance: auto !important;
    padding-inline: 12px !important;
}

html[dir="rtl"] .debt-form input[type="date"],
html[dir="rtl"] .debt-payment-form input[type="date"],
html[dir="rtl"] .inline-pay-form input[type="date"] {
    text-align: right !important;
}

.installment-box {
    grid-column: 1 / -1 !important;
    border: 1px dashed #5eead4 !important;
    border-radius: 22px !important;
    background: linear-gradient(135deg, #f0fdfa, #ffffff) !important;
    padding: 16px !important;
    overflow: visible !important;
}

.installment-box .debt-check-row {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    margin-bottom: 12px !important;
}

.installment-box .debt-check-row input[type="checkbox"] {
    width: 22px !important;
    min-width: 22px !important;
    height: 22px !important;
    min-height: 22px !important;
    accent-color: #0f766e !important;
}

.installment-input-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 14px !important;
}

.debt-form .btn {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    max-width: none !important;
    margin-top: 6px !important;
}

/* Debt card redesign */
.debt-card {
    border: 1px solid #dbeafe !important;
    border-radius: 26px !important;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
    padding: 20px !important;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .07) !important;
}

.debt-card-head {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    gap: 14px !important;
    align-items: start !important;
}

.debt-card-head > div:first-child {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
}

.debt-card-head h3 {
    width: 100% !important;
    margin: 8px 0 0 !important;
    color: #0f172a !important;
    font-size: 26px !important;
    line-height: 1.35 !important;
}

.debt-card-head p {
    width: 100% !important;
    margin: 0 !important;
    color: #64748b !important;
    font-size: 17px !important;
}

.debt-type-badge,
.debt-status,
.installment-status {
    border-radius: 999px !important;
    padding: 7px 12px !important;
    font-size: 14px !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
}

.debt-type-badge {
    background: #ecfeff !important;
    color: #0f766e !important;
}

.debt-type-badge.gold {
    background: #fef3c7 !important;
    color: #92400e !important;
}

.debt-status {
    background: #e0f2fe !important;
    color: #075985 !important;
}

.debt-status-overdue .debt-status {
    background: #fee2e2 !important;
    color: #991b1b !important;
}

.debt-status-completed .debt-status {
    background: #dcfce7 !important;
    color: #166534 !important;
}

.debt-money-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 12px !important;
    margin: 18px 0 14px !important;
}

.debt-money-grid div {
    border: 1px solid #dbeafe !important;
    border-radius: 20px !important;
    background: #ffffff !important;
    padding: 14px !important;
    min-height: 74px !important;
}

.debt-money-grid small {
    display: block !important;
    color: #64748b !important;
    margin-bottom: 7px !important;
    font-size: 14px !important;
}

.debt-money-grid b {
    display: block !important;
    color: #0f766e !important;
    font-size: 20px !important;
    line-height: 1.2 !important;
    word-break: break-word !important;
}

.debt-progress {
    height: 12px !important;
    border-radius: 999px !important;
    background: #e2e8f0 !important;
    overflow: hidden !important;
    margin: 12px 0 !important;
}

.debt-progress i {
    display: block !important;
    height: 100% !important;
    background: linear-gradient(135deg, #0f766e, #14b8a6) !important;
}

.debt-meta {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    color: #64748b !important;
    font-size: 15px !important;
}

/* Details blocks */
.debt-payment-details {
    margin-top: 14px !important;
    border: 1px dashed #cbd5e1 !important;
    border-radius: 18px !important;
    background: #fff !important;
    padding: 12px !important;
    overflow: hidden !important;
}

.debt-payment-details summary {
    cursor: pointer !important;
    color: #0f766e !important;
    font-weight: 700 !important;
    list-style-position: inside !important;
}

.debt-payment-form {
    margin-top: 14px !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 12px !important;
}

.debt-payment-form .mini-btn {
    align-self: end !important;
}

/* Installment table */
.installment-table-wrap {
    overflow-x: auto !important;
    margin-top: 12px !important;
    padding-bottom: 4px !important;
}

.installment-table {
    width: 100% !important;
    min-width: 980px !important;
    border-collapse: separate !important;
    border-spacing: 0 8px !important;
}

.installment-table th {
    padding: 7px 9px !important;
    color: #64748b !important;
    font-size: 14px !important;
    text-align: start !important;
    white-space: nowrap !important;
}

.installment-table td {
    background: #f8fafc !important;
    border-top: 1px solid #e2e8f0 !important;
    border-bottom: 1px solid #e2e8f0 !important;
    padding: 10px 9px !important;
    vertical-align: top !important;
}

.installment-table td:first-child {
    border-inline-start: 1px solid #e2e8f0 !important;
    border-start-start-radius: 14px !important;
    border-end-start-radius: 14px !important;
}

.installment-table td:last-child {
    border-inline-end: 1px solid #e2e8f0 !important;
    border-start-end-radius: 14px !important;
    border-end-end-radius: 14px !important;
}

.inline-pay-form {
    display: grid !important;
    grid-template-columns: minmax(90px, 1fr) minmax(125px, 1fr);
    gap: 7px !important;
    min-width: 300px !important;
}

.inline-pay-form select,
.inline-pay-form input {
    width: 100% !important;
    min-height: 38px !important;
    border-radius: 12px !important;
    border: 1px solid #dbeafe !important;
    padding: 6px 9px !important;
    font-size: 14px !important;
}

.inline-pay-form label {
    grid-column: 1 / -1 !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 13px !important;
    color: #475569 !important;
}

.inline-pay-form button {
    grid-column: 1 / -1 !important;
}

.payment-history-item {
    border: 1px solid #e2e8f0 !important;
    background: #f8fafc !important;
    border-radius: 16px !important;
    padding: 12px !important;
}

/* Mobile fixes */
@media (max-width: 1100px) {
    .debts-layout.full-debts-layout,
    .debt-form,
    .installment-input-grid,
    .debt-payment-form,
    .debt-money-grid {
        grid-template-columns: 1fr !important;
    }

    .debt-card-head {
        grid-template-columns: 1fr !important;
    }

    .debt-status {
        width: fit-content !important;
    }

    .debt-form input,
    .debt-form select,
    .debt-form textarea {
        min-height: 50px !important;
    }

    .inline-pay-form {
        grid-template-columns: 1fr !important;
        min-width: 260px !important;
    }
}
