:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --surface: #ffffff;
    --bg: #f1f5f9;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    --font-sans: 'Vazirmatn', system-ui, sans-serif;
    --bs-font-sans-serif: var(--font-sans);
    --bs-body-font-family: var(--font-sans);
}

* { box-sizing: border-box; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Sidebar */
.sidebar {
    min-height: 100vh;
    background: var(--sidebar-bg);
    border-left: 1px solid rgba(255,255,255,.06);
    display: flex;
    flex-direction: column;
}
.sidebar-brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 0.25rem 0;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    margin-bottom: 1.25rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.sidebar-profile:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.16);
    color: inherit;
}
.sidebar-profile-avatar {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: linear-gradient(145deg, var(--primary) 0%, #3b82f6 100%);
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}
.sidebar-profile-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.sidebar-profile-name {
    color: #f8fafc;
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-profile-role {
    color: #94a3b8;
    font-size: 0.72rem;
    line-height: 1.3;
}
.sidebar-profile-chevron {
    color: #64748b;
    font-size: 0.75rem;
    flex-shrink: 0;
    opacity: 0.7;
    transition: color 0.2s, transform 0.2s;
}
.sidebar-profile:hover .sidebar-profile-chevron {
    color: #cbd5e1;
    transform: translateX(-2px);
}
.sidebar-nav {
    flex: 1;
}
.sidebar .nav-link {
    color: #94a3b8;
    border-radius: 10px;
    padding: 0.65rem 0.85rem;
    margin: 2px 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all .2s;
}
.sidebar .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}
.sidebar .nav-link.active {
    background: var(--primary);
    color: #fff;
}
/* Page */
.page-header {
    margin-bottom: 1.5rem;
}
.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}
.page-header p {
    color: var(--muted);
    margin: 0.35rem 0 0;
    font-size: 0.9rem;
}

/* Cards */
.card-panel {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 1.25rem;
}
.card-stat {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    transition: transform .15s;
}
.card-stat:hover { transform: translateY(-2px); }
.card-stat .label { color: var(--muted); font-size: 0.85rem; }
.card-stat .value { font-size: 1.75rem; font-weight: 700; margin-top: 0.25rem; }
.card-stat.accent-warning { border-right: 4px solid #f59e0b; }

/* Tables */
.table-panel {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}
.table-panel .table-toolbar {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
}
.table-toolbar-users {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.65rem;
}
.table-toolbar-users .panel-title {
    margin-bottom: 0;
    text-align: start;
    width: 100%;
}
.table-toolbar-users-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}
.table-toolbar-users-row .search-bar {
    max-width: 420px;
    flex: 1 1 280px;
}
.table-toolbar-users-row .ms-auto {
    margin-inline-start: auto !important;
}

/* لیست‌ها با فیلتر + جستجو (مثل کاربران — جستجو سمت راست در RTL) */
.table-toolbar-list {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.65rem;
}
.table-toolbar-list .panel-title {
    margin-bottom: 0;
    text-align: start;
    width: 100%;
}
.table-toolbar-list-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    width: 100%;
    min-height: 0;
}
.table-toolbar-list-row .search-bar {
    flex: 0 1 420px;
    min-width: min(100%, 260px);
    max-width: 100%;
}
.list-filter-bar {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}
.list-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}
.list-filter-row .filter-label {
    font-size: 0.8125rem;
    color: var(--muted);
    font-weight: 500;
    flex: 0 0 auto;
    min-width: 4.75rem;
}
.list-filter-row .btn {
    border-radius: 8px;
}
.list-filter-row .btn.active {
    background: var(--sidebar-bg);
    border-color: var(--sidebar-bg);
    color: #fff;
}
.page-header-with-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}
.page-header-with-actions .page-header-text {
    flex: 1;
    min-width: 200px;
}
.page-help-btn {
    flex-shrink: 0;
}
.settings-help-body h6 {
    font-weight: 700;
    margin: 1rem 0 0.5rem;
    color: var(--text);
}
.settings-help-body h6:first-child {
    margin-top: 0;
}
.settings-help-body ul {
    margin-bottom: 0.5rem;
    padding-inline-start: 1.25rem;
}
.settings-help-body li {
    margin-bottom: 0.35rem;
    color: var(--muted);
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}
.table { margin: 0; }
.table thead th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table tbody td { vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8fafc; }

/* Forms */
.form-control, .form-select {
    border-radius: 10px;
    border-color: var(--border);
    padding: 0.55rem 0.85rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.form-label { font-weight: 500; font-size: 0.9rem; margin-bottom: 0.35rem; }

/* Buttons */
.btn {
    border-radius: 10px;
    padding: 0.5rem 1rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.85rem; }

/* Badge */
.badge-status {
    padding: 0.35em 0.75em;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.8rem;
}

/* File picker */
.file-picker {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    background: #f8fafc;
    position: relative;
}
.file-picker:hover, .file-picker.dragover {
    border-color: var(--primary);
    background: #eff6ff;
}
.file-picker input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}
.file-picker-icon {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}
.file-picker-title { font-weight: 600; }
.file-picker-hint { color: var(--muted); font-size: 0.85rem; margin-top: 0.25rem; }
.file-preview {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #fff;
    border-radius: 10px;
    border: 1px solid var(--border);
    display: none;
    align-items: center;
    gap: 0.75rem;
    text-align: right;
}
.file-preview.show { display: flex; }
.file-preview img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
}
.file-preview .file-name { flex: 1; font-size: 0.9rem; word-break: break-all; }
.file-preview .btn-remove-file {
    color: #ef4444;
    border: none;
    background: none;
    font-size: 1.25rem;
    cursor: pointer;
}

/* Modal */
.modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
}
.modal-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 1.25rem;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 9999;
}
.admin-toast {
    min-width: 280px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    border: none;
}

/* Receipt thumb */
.receipt-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid var(--border);
    transition: transform .15s;
}
.receipt-thumb:hover { transform: scale(1.05); }

/* Search bar */
.search-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    max-width: 420px;
}
.search-bar .form-control {
    flex: 1 1 auto;
    min-width: 0;
    height: calc(1.5em + 0.75rem + 2px);
}
.search-bar .btn {
    flex: 0 0 auto;
    width: auto;
    height: calc(1.5em + 0.75rem + 2px);
    min-height: calc(1.5em + 0.75rem + 2px);
    max-height: calc(1.5em + 0.75rem + 2px);
    padding: 0 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Pagination */
.pagination .page-link {
    border-radius: 8px;
    margin: 0 2px;
    border: 1px solid var(--border);
    color: var(--text);
}
.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}

/* Login */
.login-page {
    min-height: 100vh;
    margin: 0;
    background: linear-gradient(145deg, #0f172a 0%, #1e3a5f 45%, #2563eb 100%);
}
.login-wrap {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.login-card {
    width: 100%;
    max-width: 420px;
    border: none;
    border-radius: 20px;
    background: #fff;
}
.login-card .card-body { padding: 2.25rem 2rem; }
.login-logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    color: #fff;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin: 0 auto 1.25rem;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
}
.login-submit-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
}
.empty-state i { font-size: 3rem; opacity: .4; }

/* Action group */
.btn-group-actions {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}
.table-panel .table .col-actions {
    text-align: center;
    vertical-align: middle;
    min-width: 10.5rem;
    white-space: normal;
}
.table-panel .table .col-receipt {
    text-align: center;
    vertical-align: middle;
}
.btn-icon-view {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    vertical-align: middle;
}
.btn-icon-view .bi {
    font-size: 1.05rem;
    line-height: 1;
    margin: 0;
    display: block;
}

/* Loading */
.btn-loading { pointer-events: none; opacity: .7; }

/* Main layout */
.admin-main {
    min-height: 100vh;
    background: var(--bg);
    max-width: 100%;
    overflow-x: hidden;
}

.panel-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
}
.panel-title i { color: var(--primary); }

.card-panel h5:not(.panel-title) {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.list-group-item {
    border-color: var(--border);
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}
.list-group-item:first-child { border-top-left-radius: 10px; border-top-right-radius: 10px; }
.list-group-item:last-child { border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; }

.alert {
    border-radius: 10px;
    border: none;
    box-shadow: var(--shadow);
}

.table-panel .table-responsive {
    padding: 0 0.25rem 0.25rem;
}

.btn-outline-primary,
.btn-outline-danger,
.btn-outline-secondary {
    border-radius: 8px;
}

.btn-group-actions .btn {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-group-actions .btn-sm.btn-icon-only {
    width: 2rem;
    height: 2rem;
    padding: 0;
}

@media (max-width: 767.98px) {
    .admin-main { padding-top: 1rem !important; }
    .card-stat .value { font-size: 1.35rem; }
    .page-header h1 { font-size: 1.25rem; }
    .table { font-size: 0.85rem; }
    .sidebar { display: none !important; }
}

/* Fix Bootstrap overrides in dark sidebar context */
main .form-control,
main .form-select {
    background: #fff;
}
main .text-muted { color: var(--muted) !important; }

/* Layout polish */
.container-fluid.g-0 { max-width: 100%; }
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.admin-main {
    padding-bottom: 2.5rem;
}
.page-header {
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.75rem !important;
}
.card-panel {
    padding: 1.5rem;
}
.config-form .form-label {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 0.4rem;
}
.catalog-list {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.catalog-list .list-group-item {
    background: #fafbfc;
}
.catalog-list .list-group-item:hover {
    background: #f1f5f9;
}
.table-panel .table thead th {
    padding: 0.85rem 1rem;
}
.table-panel .table tbody td {
    padding: 0.85rem 1rem;
}
.btn-primary {
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}
.card-stat {
    height: 100%;
}
.card-stat .label i {
    margin-left: 0.25rem;
    opacity: 0.7;
}

/* Settings page */
.settings-page .card-panel + .card-panel {
    margin-top: 0;
}
.settings-code {
    display: block;
    padding: 0.65rem 0.85rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.8rem;
    word-break: break-all;
}
.catalog-add-form .input-group .btn {
    padding: 0.45rem 0.75rem;
    border-radius: 0 10px 10px 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
[dir="rtl"] .catalog-add-form .input-group .btn {
    border-radius: 10px 0 0 10px;
}
.catalog-add-form .input-group .form-control {
    border-radius: 0;
}
.catalog-add-form .input-group .form-control:first-child {
    border-radius: 0 10px 10px 0;
}
[dir="rtl"] .catalog-add-form .input-group .form-control:first-child {
    border-radius: 10px 0 0 10px;
}
.catalog-days-input {
    max-width: 5.5rem;
    flex: 0 0 5.5rem;
    text-align: center;
}
.settings-page .panel-title {
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.25rem !important;
}

.chart-wrap {
    position: relative;
    width: 100%;
}
.chart-wrap-lg {
    height: 300px;
}
.chart-wrap-md {
    height: 220px;
}
.chart-wrap canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* Dashboard */
.dashboard-filter-card {
    position: relative;
    overflow: hidden;
    border: 1px solid #dbeafe;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.12), transparent 34%),
        linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}
.dashboard-filter-card::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: linear-gradient(180deg, var(--primary), #10b981);
}
.dashboard-filter-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.dashboard-filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    font-size: 0.82rem;
    font-weight: 600;
}
.dashboard-filter-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: end;
}
.agencies-dashboard-filter-form {
    grid-template-columns: minmax(220px, 0.75fr) minmax(0, 1fr) minmax(0, 1fr) auto;
}
.dashboard-filter-range {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--border);
    border-radius: 14px;
}
.dashboard-range-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
    color: var(--text);
}
.dashboard-range-dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 999px;
    background: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
.dashboard-range-dot.is-end {
    background: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.13);
}
.input-icon-wrap {
    position: relative;
}
.input-icon-wrap > i {
    position: absolute;
    top: 50%;
    inset-inline-start: 0.85rem;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}
.input-icon-wrap .form-control {
    padding-inline-start: 2.35rem;
}
.dashboard-filter-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    justify-self: end;
    gap: 0.5rem;
    min-width: 0;
}
.dashboard-filter-actions .btn {
    justify-content: center;
    white-space: nowrap;
    min-height: 2.65rem;
}
.dashboard-filter-actions .btn-primary {
    min-width: 9rem;
}
.dashboard-filter-actions .btn-outline-secondary {
    min-width: 6.5rem;
    padding-inline: 0.85rem;
    box-shadow: none;
}
.dashboard-time-input {
    font-family: var(--font-sans);
    letter-spacing: 0;
    font-variant-numeric: normal;
    direction: ltr;
}
jdp-container .jdp-time-container {
    max-width: 18rem;
    margin: 0 auto;
    padding: 0.5rem 0.75rem;
}
jdp-container .jdp-time-container .jdp-time select {
    min-height: 2.5rem;
    padding: 0.45rem 0.75rem;
    font-size: 1rem;
}
.dashboard-range-summary {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: #f8fafc;
    color: var(--muted);
    font-size: 0.86rem;
}
.dashboard-range-summary i {
    color: var(--primary);
}
.dashboard-stat-card {
    position: relative;
    height: 100%;
    min-height: 118px;
    padding: 1.15rem 1.2rem 1.1rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.dashboard-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}
.dashboard-stat-card .label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 500;
}
.dashboard-stat-card .value {
    font-size: 1.65rem;
    font-weight: 800;
    line-height: 1.2;
    margin-top: 0.2rem;
}
.card-stat.accent-success {
    border-right: 4px solid #10b981;
}

.table-panel .table thead th,
.table-panel .table tbody td {
    text-align: center;
    vertical-align: middle;
}

/* Mobile */
.admin-mobile-bar {
    position: sticky;
    top: 0;
    z-index: 1040;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    background: var(--sidebar-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
}
.admin-mobile-title {
    flex: 1;
    font-weight: 600;
    font-size: 0.95rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.btn-icon {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
}
.btn-icon:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}
.sidebar-offcanvas {
    background: var(--sidebar-bg);
    color: #94a3b8;
    width: min(88vw, 300px);
}
.sidebar-offcanvas .nav-link {
    color: #94a3b8;
    border-radius: 10px;
    padding: 0.65rem 0.85rem;
    margin: 2px 0;
}
.sidebar-offcanvas .nav-link:hover,
.sidebar-offcanvas .nav-link.active {
    background: var(--sidebar-hover);
    color: #fff;
}
.sidebar-offcanvas .nav-link.active {
    background: var(--primary);
}
.media-link-row code {
    font-size: 0.75rem;
    word-break: break-all;
}
.media-copy-btn {
    white-space: nowrap;
}
.media-upload-form {
    max-width: 720px;
}
.media-upload-form .media-upload-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}
.media-upload-form .media-upload-row .form-control {
    flex: 1 1 240px;
    min-width: 0;
}
.media-upload-form .media-upload-row .btn {
    flex: 0 0 auto;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}
@media (max-width: 767.98px) {
    .admin-main {
        padding-top: 0.75rem !important;
    }
    .page-header h1 {
        font-size: 1.25rem;
    }
    .page-header-with-actions {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.75rem;
    }
    .page-header-with-actions .page-help-btn {
        align-self: flex-start;
    }
    .card-panel {
        padding: 1rem;
    }
    .card-stat .value {
        font-size: 1.45rem;
    }
    .table-panel {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table-panel .table {
        min-width: 560px;
        font-size: 0.85rem;
    }
    .table-panel .table-toolbar {
        padding: 0.75rem 1rem;
    }
    .table-toolbar-list,
    .table-toolbar-users {
        gap: 0.5rem;
        justify-content: flex-start !important;
    }
    .table-toolbar-list-row,
    .table-toolbar-users-row {
        flex-direction: row;
        align-items: center !important;
        width: 100%;
        min-height: 0;
    }
    .table-toolbar-list-row .search-bar,
    .table-toolbar-users-row .search-bar {
        max-width: none;
        width: 100%;
        flex: 1 1 auto;
    }
    .list-filter-bar {
        flex-direction: column;
        align-items: stretch !important;
    }
    .list-filter-bar .form-select,
    .list-filter-bar .btn {
        width: 100%;
    }
    .catalog-add-form .input-group {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .catalog-add-form .input-group .form-control {
        width: 100%;
        border-radius: 10px !important;
    }
    .catalog-add-form .input-group .btn {
        width: 100%;
        border-radius: 10px !important;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.55rem 1rem;
        min-height: 2.5rem;
    }
    .catalog-days-input {
        max-width: none;
        flex: 1 1 100%;
        width: 100%;
    }
    .table-toolbar-users-row .btn-warning {
        width: 100%;
        margin-inline-start: 0 !important;
    }
    .settings-page .d-flex.flex-wrap.gap-2 .btn {
        width: 100%;
    }
    .media-upload-form {
        max-width: none;
    }
    .media-upload-form .media-upload-row {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    .media-upload-form .media-upload-row .form-control {
        width: 100%;
        flex: 1 1 auto;
        margin-bottom: 0;
    }
    .media-upload-form .media-upload-row .btn {
        width: 100%;
        flex: 1 1 auto;
        margin-top: 0.25rem;
    }
    .dashboard-filter-form {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }
    .dashboard-filter-card {
        padding: 0;
    }
    .dashboard-filter-head {
        padding: 1rem 1rem 0;
        margin-bottom: 0.75rem;
    }
    .dashboard-filter-badge {
        display: none;
    }
    .dashboard-filter-range {
        margin: 0 1rem;
        padding: 0.9rem;
    }
    .dashboard-filter-form > .dashboard-filter-range:first-of-type {
        order: 1;
    }
    .dashboard-filter-form > .dashboard-filter-range:nth-of-type(2) {
        order: 2;
    }
    .dashboard-filter-form > .dashboard-filter-range:nth-of-type(3) {
        order: 3;
    }
    .dashboard-filter-actions {
        order: 4;
        min-width: 0;
        flex-direction: column;
        gap: 0.65rem;
        padding: 0.85rem 1rem;
        margin: 0 1rem;
        border: 1px solid #dbeafe;
        border-radius: 14px;
        background: #f8fbff;
    }
    .dashboard-filter-actions .btn {
        width: 100%;
        min-height: 2.75rem;
        box-shadow: none;
    }
    .dashboard-filter-actions .btn-primary {
        min-width: 0;
    }
    .dashboard-filter-actions .btn-outline-secondary {
        min-width: 0;
        background: #fff;
    }
    .dashboard-range-summary {
        order: 5;
        margin-top: 0;
        border-radius: 0 0 var(--radius) var(--radius);
        justify-content: center;
        text-align: center;
    }
    jdp-overlay {
        display: none;
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100%;
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
        background-color: rgba(15, 23, 42, 0.36);
        z-index: 2040 !important;
    }
    jdp-container {
        position: fixed !important;
        top: 50% !important;
        right: auto !important;
        bottom: auto !important;
        left: 50% !important;
        width: min(calc(100vw - 2rem), 340px) !important;
        min-width: 0 !important;
        max-width: calc(100vw - 2rem) !important;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
        border-radius: 18px !important;
        padding: 0.75rem 0 !important;
        box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28) !important;
        transform: translate(-50%, -50%) !important;
        animation: dashboardJdpCenter .18s ease-out !important;
        z-index: 2050 !important;
    }
    jdp-container .jdp-day,
    jdp-container .jdp-day-name {
        height: 34px;
        line-height: 34px;
    }
    jdp-container .jdp-footer {
        padding-inline: 0.75rem;
    }
    jdp-container .jdp-btn-close,
    jdp-container .jdp-btn-empty,
    jdp-container .jdp-btn-today {
        border-radius: 10px;
    }
jdp-container .jdp-time-container {
    max-width: 18rem;
    margin: 0 auto;
    padding: 0.5rem 0.75rem;
}
jdp-container .jdp-time-container .jdp-time select {
    min-height: 2.5rem;
    padding: 0.45rem 0.75rem;
    font-size: 1rem;
}
    .modal-dialog {
        margin: 0.5rem;
    }
}

@keyframes dashboardJdpCenter {
    from {
        opacity: 0;
        transform: translate(-50%, -46%) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@media (max-width: 575.98px) {
    .row.g-3 > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* جدول: ستون اول راست‌چین، بقیه وسط */
.table-cols-center th:not(.col-first),
.table-cols-center td:not(.col-first) {
    text-align: center;
    vertical-align: middle;
}
.table-cols-center th.col-first,
.table-cols-center td.col-first {
    text-align: start;
    vertical-align: middle;
}

/* انتخاب نمایندگی با جستجو */
.agency-search-picker {
    position: relative;
}
.agency-search-wrap {
    position: relative;
}
.agency-search-input {
    width: 100%;
}
.agency-search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    z-index: 1050;
    max-height: 240px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.agency-search-option {
    display: block;
    width: 100%;
    text-align: start;
    border: 0;
    background: transparent;
    padding: 0.55rem 0.85rem;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
}
.agency-search-option:hover,
.agency-search-option:focus {
    background: #eff6ff;
    outline: none;
}
.agency-search-empty {
    padding: 0.65rem 0.85rem;
}

/* انتخاب چند نمایندگی (حالت بروزرسانی و …) */
.agency-multi-picker {
    max-width: 36rem;
}
.agency-multi-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem 0.75rem;
    margin-bottom: 0.5rem;
}
.agency-multi-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.agency-multi-selected {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    max-height: 160px;
    overflow-y: auto;
    padding: 0.65rem 0.75rem;
    background: var(--surface-2, #f8fafc);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 2.75rem;
}
.agency-multi-empty {
    margin: 0;
    width: 100%;
}
.agency-multi-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    max-width: 100%;
    padding: 0.2rem 0.35rem 0.2rem 0.55rem;
    font-size: 0.82rem;
    line-height: 1.35;
    background: #e0f2fe;
    color: #0c4a6e;
    border: 1px solid #bae6fd;
    border-radius: 999px;
}
.agency-multi-chip-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 14rem;
}
.agency-multi-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.75;
}
.agency-multi-chip-remove:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.06);
}
.agency-multi-hidden {
    display: none;
}

.admin-platform-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    vertical-align: middle;
}
.admin-platform-icon-svg {
    display: block;
    width: 100%;
    height: 100%;
}

@media (max-width: 767.98px) {
    .agency-search-dropdown {
        max-height: 50vh;
    }
    .table-cols-center.table {
        min-width: 480px;
    }
}

/* Dashboard v7 parity */
.dashboard-page {
    --dash-blue: #2563eb;
    --dash-green: #059669;
    --dash-amber: #d97706;
    --dash-violet: #7c3aed;
}
#dashboardDynamic.dashboard-loading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.dashboard-filter.card-panel {
    padding: 0;
}
.dashboard-filter {
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, #f8fafc 0%, var(--surface) 42%);
}
.dashboard-filter-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.35rem 0.85rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}
.dashboard-filter-sub {
    margin-top: 0.25rem;
}
.dashboard-filter-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}
.dashboard-filter-title i {
    color: var(--dash-blue);
    margin-left: 0.35rem;
}
.dashboard-filter-body {
    padding: 1.25rem 1.35rem 1.15rem;
}
.dashboard-filter .dashboard-filter-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    margin-top: 1.35rem;
    padding-top: 1.15rem;
    border-top: 1px dashed var(--border);
    justify-self: auto;
    min-width: 0;
}
.dashboard-filter .dashboard-filter-actions .btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    min-height: 2.45rem;
    padding: 0.55rem 1.15rem;
}
.dashboard-filter .dashboard-range-block .form-control {
    padding: 0.55rem 0.85rem;
    min-height: 2.5rem;
}
.dashboard-filter .dashboard-filter-agency .form-select {
    padding: 0.55rem 0.85rem;
    min-height: 2.5rem;
}
.dashboard-filter-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}
.dashboard-filter-agency,
.dashboard-filter-location {
    flex: 1 1 220px;
    max-width: 320px;
    margin-bottom: 0;
}
.dashboard-filter .dashboard-filter-location .form-select {
    padding: 0.55rem 0.85rem;
    min-height: 2.5rem;
}
.dashboard-range-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.75rem 1rem;
    align-items: stretch;
}
.dashboard-range-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
}
.dashboard-range-start {
    border-top: 3px solid var(--dash-green);
}
.dashboard-range-end {
    border-top: 3px solid var(--dash-blue);
}
.dashboard-range-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--dash-green);
    margin-bottom: 0.85rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(5, 150, 105, 0.08);
}
.dashboard-range-badge-end {
    color: var(--dash-blue);
    background: rgba(37, 99, 235, 0.08);
}
.dashboard-datetime-row {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 0.75rem;
}
.dashboard-field .form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0.35rem;
}
.dashboard-field .form-label i {
    margin-left: 0.2rem;
    opacity: 0.75;
}
.dashboard-field-date .form-control,
.dashboard-field-time .form-control {
    font-family: inherit;
    text-align: center;
}
.dashboard-range-sep {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 1.1rem;
    padding-top: 2rem;
}
.dashboard-range-hint {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    padding: 0.75rem 1.35rem;
    background: #f1f5f9;
    border-top: 1px solid var(--border);
    font-size: 0.82rem;
    color: var(--muted);
}
.dashboard-range-hint i {
    color: var(--dash-blue);
}
.dashboard-stats-grid {
    margin-bottom: 1.25rem;
}
.dashboard-stat-card::before {
    content: '';
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 4px;
    border-radius: 14px 0 0 14px;
    background: var(--stat-accent, var(--dash-blue));
    z-index: 1;
}
.dashboard-stat-card .stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
    margin-bottom: 0.65rem;
    font-size: 1.05rem;
    background: color-mix(in srgb, var(--stat-accent, var(--dash-blue)) 12%, white);
    color: var(--stat-accent, var(--dash-blue));
}
.dashboard-stat-users { --stat-accent: #2563eb; }
.dashboard-stat-configs { --stat-accent: #7c3aed; }
.dashboard-stat-orders { --stat-accent: #059669; }
.dashboard-stat-pending { --stat-accent: #d97706; }
.dashboard-stat-revenue { --stat-accent: #059669; }
.dashboard-stat-pool { --stat-accent: #0891b2; }
.dashboard-stat-gb { --stat-accent: #4f46e5; }
.dashboard-gb-hero {
    height: 100%;
    border-radius: 14px;
    padding: 1.35rem 1.4rem;
    color: #fff;
    background: linear-gradient(135deg, #4f46e5 0%, #2563eb 55%, #0891b2 100%);
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.28);
}
.dashboard-gb-hero .gb-label {
    font-size: 0.88rem;
    opacity: 0.92;
    margin-bottom: 0.35rem;
}
.dashboard-gb-hero .gb-value {
    font-size: 2.35rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
}
.dashboard-gb-hero .gb-unit {
    font-size: 1rem;
    font-weight: 600;
    opacity: 0.9;
}
.dashboard-gb-hero .gb-meta {
    margin-top: 0.65rem;
    font-size: 0.82rem;
    opacity: 0.88;
}
.dashboard-section-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid var(--border);
}
.dashboard-section-title i {
    color: var(--dash-blue);
}
.dashboard-chart-panel {
    border-radius: 14px;
}
.dashboard-chart-panel .panel-heading [data-dash-suffix] {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--muted);
}
.dashboard-revenue-highlight {
    border-radius: 14px;
    background: linear-gradient(180deg, #ecfdf5 0%, var(--surface) 100%);
    border: 1px solid #a7f3d0;
}
.dashboard-revenue-highlight .value {
    font-size: 1.85rem !important;
}

@media (max-width: 991.98px) {
    .dashboard-range-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-range-sep {
        padding: 0;
        transform: rotate(-90deg);
    }
    .dashboard-datetime-row {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 575.98px) {
    .dashboard-filter-body {
        padding: 1rem 1rem 0.85rem;
    }
    .dashboard-filter-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.55rem;
        margin-top: 1rem;
        padding-top: 0.85rem;
    }
    .dashboard-filter-actions .btn {
        width: 100%;
        padding: 0.72rem 1rem;
        font-size: 0.9rem;
        justify-content: center;
    }
    .dashboard-datetime-row {
        grid-template-columns: 1fr;
    }
    .dashboard-stat-card .value {
        font-size: 1.4rem;
    }
    .dashboard-gb-hero .gb-value {
        font-size: 2rem;
    }
}
