:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --dp-blue: #0040ff;
    --dp-light: #eff6ff;
    --success: #10b981;
    --danger: #ef4444;
    --radius: 14px;
    --shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
}

body.ghabzyar-body {
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    direction: rtl;
}

/* صفحه ورود */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 36px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow);
}

.brand-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.brand-icon {
    background: var(--dp-blue);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.auth-subtitle {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 20px;
}

.auth-features {
    background: var(--bg);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 22px;
    font-size: 13px;
    color: #334155;
}

.feat-item {
    margin-bottom: 6px;
}
.feat-item:last-child { margin-bottom: 0; }

#ghabzyar-loginform p {
    margin-bottom: 14px;
}

#ghabzyar-loginform label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

#ghabzyar-loginform input[type="text"],
#ghabzyar-loginform input[type="password"] {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
}

#ghabzyar-loginform input[type="submit"] {
    width: 100%;
    background: var(--dp-blue);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

/* ساختار اصلی داشبورد */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.logo-box {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #0040ff, #3b82f6);
    color: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.logo-title {
    font-size: 18px;
    font-weight: 800;
}

.logo-sub {
    font-size: 12px;
    color: var(--muted);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: none;
    background: transparent;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    text-align: right;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: var(--bg);
    color: var(--text);
}

.nav-btn.active {
    background: var(--dp-light);
    color: var(--dp-blue);
}

.digipay-wallet-box {
    background: linear-gradient(135deg, #0040ff 0%, #1e40af 100%);
    color: #fff;
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 16px;
}

.wallet-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.dp-badge {
    font-size: 11px;
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 20px;
}

.topup-btn {
    background: #fff;
    color: var(--dp-blue);
    border: none;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.wallet-label {
    font-size: 12px;
    opacity: 0.85;
}

.wallet-amount {
    font-size: 18px;
    font-weight: 800;
    margin-top: 2px;
}

.user-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
}

.user-actions {
    display: flex;
    gap: 8px;
}

.icon-link {
    text-decoration: none;
    padding: 6px 8px;
    border-radius: 8px;
    background: var(--bg);
    font-size: 14px;
}

.main-content {
    flex: 1;
    padding: 32px;
    max-width: 1200px;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 800;
}

.page-header p {
    font-size: 14px;
    color: var(--muted);
}

/* دکمه‌ها */
.btn {
    padding: 10px 18px;
    border-radius: 10px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.btn-primary {
    background: var(--dp-blue);
    color: #fff;
}

.btn-primary:hover {
    background: #0033cc;
}

.btn-secondary {
    background: var(--dp-light);
    color: var(--dp-blue);
}

.btn-lg {
    padding: 13px 28px;
    font-size: 15px;
}

/* آمار */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}

.stat-title {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}

.stat-value {
    font-size: 20px;
    font-weight: 800;
}

.stat-value.primary { color: var(--dp-blue); }
.stat-value.danger { color: var(--danger); }
.stat-value.success { color: var(--success); }

/* فیلترها */
.filter-bar {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

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

.chip {
    padding: 7px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 13px;
    cursor: pointer;
    color: var(--muted);
}

.chip.active {
    background: var(--text);
    color: #fff;
    border-color: var(--text);
}

/* کارت‌های قبض */
.bills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 18px;
}

.bill-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.15s;
}

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

.bill-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}

.bill-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 8px;
    background: var(--bg);
}

.status-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
}

.status-badge.unpaid {
    background: #fef2f2;
    color: var(--danger);
}

.status-badge.paid {
    background: #ecfdf5;
    color: var(--success);
}

.bill-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 10px;
}

.bill-meta {
    background: var(--bg);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 14px;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.meta-row:last-child { margin-bottom: 0; }

.bill-amount-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.bill-price {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
}

.bill-actions {
    display: flex;
    gap: 8px;
}

.bill-actions .btn-pay {
    flex: 1;
}

.btn-delete {
    background: #fef2f2;
    color: var(--danger);
    padding: 10px 12px;
}

/* فرم افزودن قبض */
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 28px;
    max-width: 780px;
    box-shadow: var(--shadow);
}

.form-label {
    display: block;
    font-weight: 700;
    margin-bottom: 12px;
    font-size: 14px;
}

.type-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}

.type-option {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    transition: 0.2s;
}

.type-option input {
    display: none;
}

.type-option.active {
    border-color: var(--dp-blue);
    background: var(--dp-light);
    color: var(--dp-blue);
}

.t-ico {
    font-size: 22px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
}

.input-with-btn {
    display: flex;
    gap: 8px;
}

.form-actions {
    margin-top: 24px;
}

/* جدول تراکنش‌ها */
.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow-x: auto;
    box-shadow: var(--shadow);
}

.tx-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.tx-table th, .tx-table td {
    padding: 14px 16px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

.tx-table th {
    background: var(--bg);
    font-weight: 700;
    color: var(--muted);
}

.empty-cell, .loading-box {
    text-align: center;
    padding: 36px;
    color: var(--muted);
}

/* مودال‌ها */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 9999;
}

.modal-backdrop.open {
    display: flex;
}

.modal-box {
    background: var(--surface);
    border-radius: 20px;
    width: 100%;
    max-width: 460px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.dp-modal-header {
    background: var(--dp-blue);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dp-logo-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dp-dot {
    width: 10px;
    height: 10px;
    background: #38bdf8;
    border-radius: 50%;
}

.modal-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
}

.modal-body {
    padding: 22px;
}

.plan-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.plan-card.selected {
    border-color: var(--dp-blue);
    background: var(--dp-light);
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    padding: 9px 0;
    border-bottom: 1px dashed var(--border);
    font-size: 14px;
}

.toast-box {
    position: fixed;
    bottom: 24px;
    left: 24px;
    background: #0f172a;
    color: #fff;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    display: none;
    z-index: 10000;
}

@media (max-width: 860px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
    .form-grid { grid-template-columns: 1fr; }
}
