/* ============================================================
   محاسبه‌گر تسهیلات — باجه سید سرا
   هم‌راستا با Design System 2.0 سایت اصلی (سبز زمردی + طلایی)
   ============================================================ */
:root {
    --primary: #0e8447;
    --primary-dark: #064e2a;
    --primary-950: #03271a;
    --secondary: #e8a600;
    --secondary-light: #f6b81f;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --text: #0e211a;
    --muted: #5c736a;
    --border: #e3ede7;
    --border-soft: #eef4f0;
    --bg: #f5f9f6;
    --card: #ffffff;
    --radius: 20px;
    --shadow: 0 20px 44px -24px rgba(6, 64, 38, .35);
    --shadow-sm: 0 8px 22px -14px rgba(6, 64, 38, .3);
    --ease: cubic-bezier(.22, .61, .36, 1);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 90px;
}

body {
    margin: 0;
    font-family: 'Vazirmatn', Tahoma, system-ui, sans-serif;
    background:
        radial-gradient(900px 420px at 88% -12%, rgba(246, 184, 31, .14), transparent 62%),
        radial-gradient(760px 400px at 4% 108%, rgba(22, 163, 90, .16), transparent 60%),
        var(--bg);
    color: var(--text);
    line-height: 1.85;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 980px;
    width: 100%;
    margin: 0 auto;
    padding: 22px 20px 40px;
    flex: 1;
}

/* ---------- هدر (فشرده) ---------- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    color: #fff;
    background: linear-gradient(125deg, #03271a 0%, #064e2a 58%, #0a6b3a 100%);
    box-shadow: 0 8px 20px -16px rgba(3, 39, 26, .8);
    border-bottom: 1px solid rgba(246, 184, 31, .45);
}

.header-inner {
    max-width: 980px;
    margin: 0 auto;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.brand-block {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.brand-title {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -.2px;
    line-height: 1.4;
    white-space: nowrap;
}

.brand-sub {
    opacity: .78;
    font-size: .72rem;
    color: #cfe7db;
    white-space: nowrap;
}

.header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.header-back {
    border-radius: 999px;
}

/* ---------- معرفی بالای صفحه ---------- */
.page-hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
    padding: 26px 26px 24px;
    border-radius: 22px;
    color: #fff;
    background: linear-gradient(125deg, #064e2a, #0a6b3a 60%, #0e8447);
    box-shadow: 0 26px 50px -26px rgba(6, 64, 38, .8);
}

.page-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(420px 200px at 12% -30%, rgba(246, 184, 31, .35), transparent 62%),
        repeating-linear-gradient(46deg, rgba(255, 255, 255, .05) 0 2px, transparent 2px 22px);
}

.page-hero > * {
    position: relative;
}

.page-hero h1 {
    margin: 0 0 8px;
    font-size: clamp(1.25rem, 2.6vw, 1.6rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.45;
}

.page-hero p {
    margin: 0;
    color: #d6ecdf;
    font-size: .92rem;
    max-width: 60ch;
}

.hero-steps {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.hero-steps span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 999px;
    padding: 5px 14px;
    font-size: .78rem;
    font-weight: 700;
    backdrop-filter: blur(6px);
}

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

/* ---------- کارت‌ها ---------- */
.card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 24px 24px 26px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: box-shadow .3s var(--ease);
}

.card::before {
    content: '';
    position: absolute;
    inset-inline: 0;
    top: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary-light));
    opacity: .9;
}

.card:hover {
    box-shadow: var(--shadow);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 1.06rem;
    font-weight: 800;
    color: var(--primary-dark);
    padding-bottom: 12px;
    margin: 0 0 18px;
    border-bottom: 1px solid var(--border-soft);
}

.section-title::before {
    content: '';
    width: 8px;
    height: 22px;
    border-radius: 5px;
    background: linear-gradient(180deg, var(--secondary-light), var(--secondary));
    flex-shrink: 0;
}

/* ---------- فرم‌ها ---------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-group {
    margin-bottom: 14px;
}

label {
    display: block;
    font-weight: 700;
    margin-bottom: 7px;
    color: #26382f;
    font-size: .9rem;
}

input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 13px 15px;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    font-family: inherit;
    font-size: .95rem;
    background: #fff;
    color: var(--text);
    transition: border-color .2s, box-shadow .2s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(14, 132, 71, .14);
    outline: none;
}

input::placeholder {
    color: #9fb3a9;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235c736a' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 15px center;
    padding-left: 40px;
}

textarea {
    min-height: 92px;
    resize: vertical;
}

/* ---------- دکمه‌ها ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 14px;
    padding: 12px 20px;
    font-family: inherit;
    font-size: .95rem;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition: transform .22s var(--ease), box-shadow .22s var(--ease), background .22s;
    line-height: 1.5;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: .65;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 14px 26px -14px rgba(6, 78, 42, .85);
}

.btn-primary:hover {
    box-shadow: 0 20px 34px -16px rgba(6, 78, 42, .9);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, #e35060, #c62a3d);
    color: #fff;
}

.btn-outline {
    background: rgba(255, 255, 255, .12);
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, .45);
    backdrop-filter: blur(6px);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, .24);
}

.btn-light {
    background: #fff;
    color: var(--primary-dark);
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.btn-light.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-color: transparent;
}

.btn-gold {
    background: linear-gradient(135deg, var(--secondary-light), var(--secondary));
    color: #3a2b00;
    box-shadow: 0 14px 28px -14px rgba(232, 166, 0, .7);
}

.btn-block {
    width: 100%;
    padding: 15px 20px;
    font-size: 1rem;
}

.btn-sm {
    padding: 7px 12px;
    font-size: .82rem;
    border-radius: 10px;
}

.hidden {
    display: none !important;
}

/* ---------- تب‌ها ---------- */
.tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 6px;
    background: #eef6f1;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
}

.tab-btn {
    flex: 1;
    min-width: 170px;
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    font-weight: 800;
    cursor: pointer;
    transition: all .24s var(--ease);
    font-family: inherit;
    font-size: .93rem;
    line-height: 1.5;
}

.tab-btn:hover {
    color: var(--primary-dark);
    background: rgba(255, 255, 255, .7);
}

.tab-btn.active {
    background: #fff;
    color: var(--primary-dark);
    box-shadow: 0 10px 22px -12px rgba(6, 64, 38, .45);
}

.tab-btn.active::after {
    content: '';
    display: block;
    height: 3px;
    width: 34px;
    margin: 7px auto 0;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--secondary-light), var(--secondary));
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn .28s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* ---------- انتخاب نوع متقاضی ---------- */
.segmented {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.segmented-item {
    position: relative;
    flex: 1;
    min-width: 140px;
}

.segmented-item input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented-item span {
    display: block;
    text-align: center;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 13px;
    background: #fff;
    font-weight: 800;
    color: var(--muted);
    cursor: pointer;
    transition: all .2s var(--ease);
}

.segmented-item span:hover {
    border-color: var(--primary);
    color: var(--primary-dark);
}

.segmented-item input:checked + span {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 12px 24px -14px rgba(6, 78, 42, .8);
}

/* ---------- جعبه توضیحات ---------- */
.info-box {
    background: linear-gradient(135deg, #eef8f2, #f7fcf9);
    border: 1px solid #cbe8d8;
    border-inline-start: 4px solid var(--secondary);
    color: var(--primary-dark);
    border-radius: 14px;
    padding: 15px 18px;
    margin-top: 14px;
    font-size: .92rem;
}

.info-box p {
    margin: 8px 0 0;
    white-space: pre-wrap;
    color: #26382f;
}

/* ---------- خلاصه نتیجه ---------- */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.summary-box {
    background: linear-gradient(160deg, #f7fcf9, #eef7f2);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 14px 16px;
    transition: transform .2s, box-shadow .2s;
}

.summary-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.summary-label {
    display: block;
    color: var(--muted);
    font-size: .8rem;
    margin-bottom: 5px;
    font-weight: 600;
}

.summary-value {
    font-weight: 800;
    color: var(--primary-dark);
    font-size: 1rem;
    word-break: break-word;
}

/* ---------- جدول ---------- */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .93rem;
}

.responsive-table {
    min-width: 650px;
}

.coef-table {
    min-width: 950px;
}

th,
td {
    padding: 12px 11px;
    border-bottom: 1px solid var(--border-soft);
    text-align: center;
    vertical-align: middle;
}

thead th {
    background: linear-gradient(135deg, #eef8f2, #e6f4ec);
    color: var(--primary-dark);
    font-weight: 800;
    white-space: nowrap;
    border-bottom: 2px solid #d3e9dd;
}

tbody tr:nth-child(even) {
    background: #fbfdfc;
}

tbody tr:hover {
    background: #f2faf6;
}

tbody tr:last-child td {
    border-bottom: none;
}

.result-card {
    border-top: none;
}

.result-card::before {
    height: 5px;
    background: linear-gradient(90deg, var(--secondary-light), var(--primary));
}

.error-box {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 14px;
    color: #991b1b;
    padding: 14px 16px;
    border-radius: 14px;
    font-weight: 800;
}

.success-box {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 14px;
    color: #166534;
    padding: 14px 16px;
    font-weight: 800;
    margin-top: 14px;
}

/* ---------- توست ---------- */
.toast-area {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    opacity: 0;
    transform: translateY(-10px);
    transition: .3s var(--ease);
    background: #0e211a;
    color: #fff;
    padding: 12px 16px;
    border-radius: 13px;
    box-shadow: 0 20px 40px -18px rgba(0, 0, 0, .5);
    font-size: .9rem;
    max-width: 320px;
    font-weight: 700;
}

.toast.show {
    opacity: 1;
    transform: none;
}

.toast-error {
    background: linear-gradient(135deg, #e35060, #c62a3d);
}

.toast-success {
    background: linear-gradient(135deg, #16a34a, #0b7a3b);
}

/* ---------- سلول‌های جدول ---------- */
.col-amount {
    font-weight: 800;
    color: var(--primary);
    white-space: nowrap;
}

.col-months {
    white-space: nowrap;
    font-weight: 700;
}

.col-desc {
    color: var(--muted);
    font-size: .85rem;
}

.col-excess {
    white-space: nowrap;
    font-size: .85rem;
}

.col-below-min {
    color: var(--danger) !important;
}

.guidance-box {
    font-size: .78rem;
    color: var(--danger);
    margin-top: 7px;
    text-align: right;
    line-height: 1.7;
}

.guidance-item {
    background: #fff6f6;
    border-inline-start: 3px solid var(--danger);
    padding: 6px 9px;
    border-radius: 9px;
    margin-top: 5px;
}

/* ---------- حالت خالی ---------- */
.empty-state {
    background: #f9fbfa;
    border: 1.5px dashed var(--border);
    color: var(--muted);
    text-align: center;
    padding: 28px;
    border-radius: 16px;
}

/* ---------- پنل مدیریت (admin.php) ---------- */
.months-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px;
    background: #f9fbfa;
    border: 1px dashed var(--border);
    border-radius: 14px;
}

.month-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--border);
    padding: 7px 10px;
    border-radius: 11px;
    box-shadow: var(--shadow-sm);
}

.month-item input {
    width: 76px;
    padding: 7px;
    text-align: center;
}

.remove-btn,
.remove-coef-btn {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    border: none;
    background: linear-gradient(135deg, #e35060, #c62a3d);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s;
}

.remove-btn:hover,
.remove-coef-btn:hover {
    transform: scale(1.08);
}

.add-month-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.add-month-form input {
    width: 120px;
}

.coef-cell {
    min-width: 210px;
}

.coef-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
}

.coef-row input[type="number"] {
    width: 74px;
    padding: 7px;
    text-align: center;
}

.coef-row input[type="text"] {
    flex: 1;
    padding: 7px;
}

.add-coef-btn {
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-radius: 9px;
    padding: 5px 11px;
    cursor: pointer;
    font-size: .78rem;
    font-weight: 800;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group input {
    width: auto;
}

.checkbox-group label {
    margin: 0;
}

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background:
        radial-gradient(700px 380px at 85% -10%, rgba(246, 184, 31, .24), transparent 60%),
        linear-gradient(150deg, #03271a, #0b7a3b);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 22px;
    padding: 30px;
    box-shadow: 0 34px 74px -24px rgba(0, 0, 0, .5);
}

.login-title {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 800;
    margin: 0 0 20px;
    color: var(--primary-dark);
}

.admin-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.dep-cell {
    white-space: nowrap;
    font-weight: 800;
}

.coef-header {
    min-width: 130px;
    white-space: nowrap;
}

/* ---------- فوتر ---------- */
.app-footer {
    text-align: center;
    padding: 22px 16px 30px;
    color: var(--muted);
    font-size: .86rem;
}

.app-footer::before {
    content: '▪ ▪ ▪';
    display: block;
    color: #c7dcd1;
    letter-spacing: 3px;
    margin-bottom: 8px;
}

/* ---------- ریسپانسیو ---------- */
@media (max-width: 900px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .header-inner {
        flex-direction: row;
        align-items: center;
    }
}

@media (max-width: 700px) {
    .container {
        padding: 16px 13px 32px;
    }

    .card {
        padding: 20px 16px 22px;
        border-radius: 18px;
    }

    .header-inner {
        padding: 7px 12px;
    }

    .tabs {
        flex-direction: column;
        gap: 5px;
    }

    .tab-btn {
        width: 100%;
        min-width: 0;
        text-align: right;
        padding: 11px 14px;
    }

    .tab-btn.active::after {
        margin: 6px 0 0;
    }

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

    .responsive-table {
        min-width: 0;
    }

    .responsive-table thead {
        display: none;
    }

    .responsive-table tbody tr {
        display: block;
        border: 1px solid var(--border);
        border-radius: 15px;
        margin-bottom: 10px;
        overflow: hidden;
        background: #fff;
        box-shadow: var(--shadow-sm);
    }

    .responsive-table td {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
        gap: 12px;
        text-align: left;
        padding: 11px 14px;
        border-bottom: 1px solid var(--border-soft);
    }

    .responsive-table td:last-child {
        border-bottom: none;
    }

    .responsive-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: .8rem;
        font-weight: 700;
        flex-shrink: 0;
        text-align: right;
    }

    .toast-area {
        right: 12px;
        left: 12px;
    }

    .toast {
        max-width: none;
    }

    .header-actions {
        width: auto;
    }

    .btn {
        width: auto;
    }

    .btn-block {
        width: 100%;
    }
}

@media (max-width: 560px) {
    .brand-sub {
        display: none;
    }

    .brand-title {
        font-size: .94rem;
    }

    .header-back {
        padding: 6px 10px;
        font-size: .76rem;
    }
}

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

/* ============================================================
   انتخاب طرح + تغییر سریع + کمکِ مبلغ
   ============================================================ */

/* --- انتخاب طرح: دراپ‌داون فشرده (همهٔ دستگاه‌ها، مخصوصاً موبایل) --- */
.plan-select-card {
    padding: 20px 22px;
    margin-bottom: 18px;
}

.plan-select-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.plan-select-step {
    font-size: .7rem;
    font-weight: 800;
    color: #8a5b00;
    background: #fff6e0;
    border: 1px solid #ffe3a3;
    border-radius: 999px;
    padding: 3px 10px;
}

.plan-select-title {
    font-weight: 800;
    color: var(--primary-dark);
    font-size: 1.02rem;
}

.plan-select-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(160deg, #ffffff, #f7fcf9);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    padding: 6px 14px 6px 6px;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}

.plan-select-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(14, 132, 71, .12);
}

.plan-select-ico {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 13px;
    display: grid;
    place-items: center;
    font-size: 22px;
    background: linear-gradient(135deg, #e7f5ee, #f7fcf9);
    border: 1px solid var(--border-soft);
}

.plan-select {
    flex: 1 1 auto;
    min-width: 0;
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 800;
    color: var(--primary-dark);
    padding: 12px 4px;
    cursor: pointer;
}

.plan-select:focus {
    outline: none;
}

.plan-select-arrow {
    flex-shrink: 0;
    color: var(--primary);
    font-size: 1rem;
    pointer-events: none;
}

.plan-info-limits {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

/* --- کارت توضیحات طرح (زیر محاسبه‌گر) --- */
.plan-desc-card {
    background: linear-gradient(160deg, #f7fcf9, #ffffff);
    border-inline-start: 4px solid var(--secondary);
    margin-top: 18px;
}

.plan-desc-title {
    font-weight: 800;
    color: var(--primary-dark);
    font-size: .98rem;
    margin-bottom: 8px;
}

.plan-desc-card p {
    margin: 0;
    color: var(--muted);
    font-size: .88rem;
    line-height: 2;
}

/* --- برچسب سقف/حداقل --- */
.limit-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .72rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef6f1;
    color: var(--primary-dark);
    border: 1px solid var(--border-soft);
    white-space: nowrap;
}

.limit-chip.min {
    background: #fff6e0;
    color: #8a5b00;
    border-color: #ffe3a3;
}

.limit-chip.max {
    background: #e8f3ff;
    color: #14507e;
    border-color: #cfe4f7;
}

/* --- فیلد مبلغ + کمک زنده + پیشنهاد --- */
.amount-field {
    position: relative;
}

.amount-live {
    min-height: 20px;
    margin-top: 6px;
    font-size: .78rem;
    font-weight: 700;
    line-height: 1.6;
    color: var(--muted);
}

.amount-live.ok {
    color: var(--success);
}

.amount-live.warn {
    color: var(--danger);
}

.amount-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 6px;
    margin-top: 8px;
}

.amount-chips-label {
    align-self: center;
    font-size: .74rem;
    font-weight: 800;
    color: var(--muted);
}

.amount-chip {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    border: 1.5px solid #cfe8d8;
    background: linear-gradient(160deg, #f4fbf7, #ffffff);
    border-radius: 12px;
    padding: 7px 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all .18s var(--ease);
    line-height: 1.4;
}

.amount-chip b {
    font-size: .8rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.amount-chip small {
    font-size: .68rem;
    color: var(--muted);
    font-weight: 600;
}

.amount-chip:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    transform: translateY(-2px);
}

.amount-chip:hover b,
.amount-chip:hover small {
    color: #fff;
}

/* ============================================================
   مرحلهٔ ۱: صفحهٔ انتخاب طرح (کارتی)
   ============================================================ */
#plansView {
    animation: plansFade .32s var(--ease);
}

@keyframes plansFade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.plans-hero {
    position: relative;
    overflow: hidden;
    text-align: center;
    padding: 24px 22px;
    margin-bottom: 18px;
    border-radius: 22px;
    color: #fff;
    background: linear-gradient(125deg, #03271a 0%, #064e2a 58%, #0a6b3a 100%);
    box-shadow: 0 22px 40px -30px rgba(3, 39, 26, .9);
    border-bottom: 2px solid rgba(246, 184, 31, .5);
}

.plans-hero::after {
    content: '';
    position: absolute;
    inset-inline-end: -46px;
    top: -54px;
    width: 190px;
    height: 190px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(246, 184, 31, .3), transparent 68%);
    pointer-events: none;
}

.plans-hero h1 {
    margin: 0 0 5px;
    font-size: 1.32rem;
    font-weight: 800;
    line-height: 1.6;
}

.plans-hero-sub {
    margin: 0 0 9px;
    font-size: .8rem;
    font-weight: 700;
    color: var(--secondary-light);
}

.plans-hero-desc {
    margin: 0 auto;
    max-width: 560px;
    font-size: .84rem;
    line-height: 2;
    color: #d6eade;
}

.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
    gap: 13px;
}

.plan-card {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 17px 17px 15px;
    border-radius: 20px;
    background: #fff;
    border: 1.5px solid var(--border);
    box-shadow: 0 16px 30px -28px rgba(6, 78, 42, .6);
    text-decoration: none;
    color: inherit;
    transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s;
}

.plan-card::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary-light));
}

.plan-card:hover {
    transform: translateY(-4px);
    border-color: #bfe3cf;
    box-shadow: 0 24px 44px -28px rgba(6, 78, 42, .55);
}

.plan-card-ico {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    font-size: 19px;
    background: linear-gradient(135deg, #e7f5ee, #f7fcf9);
    border: 1px solid var(--border-soft);
}

.plan-card-name {
    font-size: 1rem;
    font-weight: 800;
    color: var(--primary-dark);
    line-height: 1.7;
}

.plan-card-desc {
    font-size: .78rem;
    line-height: 1.9;
    color: var(--muted);
}

.plan-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: auto;
    padding-top: 3px;
}

.plan-card-go {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
    font-size: .8rem;
    font-weight: 800;
    color: var(--primary);
}

/* --- دکمهٔ بازگشت به همهٔ طرح‌ها (داخل محاسبه‌گر) --- */
.plans-back {
    margin-inline-start: auto;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--primary-dark);
    font-family: inherit;
    font-size: .73rem;
    font-weight: 800;
    border-radius: 999px;
    padding: 5px 11px;
    cursor: pointer;
    white-space: nowrap;
    transition: all .18s var(--ease);
}

.plans-back:hover {
    background: #f1f9f4;
    border-color: #bfe3cf;
}

@media (max-width: 640px) {
    .plan-select-card {
        padding: 16px;
    }

    .plan-select-ico {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .plan-select {
        font-size: .95rem;
    }

    .plans-hero {
        padding: 18px 15px;
        border-radius: 18px;
        margin-bottom: 13px;
    }

    .plans-hero h1 {
        font-size: 1.12rem;
    }

    .plans-hero-desc {
        font-size: .78rem;
        line-height: 1.95;
    }

    .plans-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .plan-card {
        display: grid;
        grid-template-columns: auto 1fr;
        column-gap: 10px;
        row-gap: 4px;
        align-items: center;
        padding: 12px 13px;
        border-radius: 16px;
    }

    .plan-card-ico {
        grid-row: 1 / span 2;
        width: 36px;
        height: 36px;
        font-size: 17px;
        border-radius: 11px;
    }

    .plan-card-name {
        grid-column: 2;
        font-size: .92rem;
    }

    .plan-card-desc {
        grid-column: 1 / -1;
        font-size: .75rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .plan-card-meta {
        grid-column: 1 / -1;
        margin-top: 2px;
    }

    .plan-card-go {
        display: none;
    }

    .plans-back {
        font-size: .7rem;
        padding: 4px 9px;
    }
}

@media (max-width: 420px) {
    .amount-chip {
        flex: 1 1 calc(50% - 3px);
    }
}