:root {
    --bg: #f4f7fb;
    --bg-accent: #eef4ff;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-strong: #ffffff;
    --surface-muted: #f8fbff;
    --text: #162033;
    --text-soft: #667085;
    --text-faint: #98a2b3;
    --border: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(37, 99, 235, 0.18);
    --primary: #2563eb;
    --primary-soft: rgba(37, 99, 235, 0.12);
    --success: #12b76a;
    --success-soft: rgba(18, 183, 106, 0.14);
    --warning: #f79009;
    --warning-soft: rgba(247, 144, 9, 0.16);
    --danger: #f04438;
    --danger-soft: rgba(240, 68, 56, 0.14);
    --dark: #101828;
    --shadow-sm: 0 8px 20px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 18px 50px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 28px 60px rgba(37, 99, 235, 0.10);
    --radius-sm: 14px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --sidebar-width: 286px;
    --transition: 240ms ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Vazirmatn", Tahoma, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.10), transparent 25%),
        radial-gradient(circle at bottom left, rgba(18, 183, 106, 0.08), transparent 22%),
        var(--bg);
    color: var(--text);
}

a {
    text-decoration: none;
}

.admin-body {
    background-attachment: fixed;
}

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    min-height: 100vh;
}

.dashboard-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
    z-index: 1040;
}

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: linear-gradient(180deg, rgba(12, 19, 36, 0.98), rgba(18, 28, 53, 0.96));
    color: #fff;
    padding: 28px 18px;
    position: sticky;
    top: 0;
    min-height: 100vh;
    z-index: 1050;
    box-shadow: 24px 0 50px rgba(2, 6, 23, 0.16);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 12px 24px;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    box-shadow: 0 16px 30px rgba(37, 99, 235, 0.35);
    font-size: 1.1rem;
}

.sidebar-brand-text small,
.sidebar-profile-meta,
.sidebar-footer,
.sidebar-nav-label {
    color: rgba(255, 255, 255, 0.65);
}

.sidebar-brand-text strong {
    display: block;
    font-size: 1.03rem;
    font-weight: 800;
    color: #fff;
}

.sidebar-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0 12px;
    margin-bottom: 10px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    color: rgba(255, 255, 255, 0.82);
    transition: background var(--transition), color var(--transition), transform var(--transition);
}

.sidebar-link:hover,
.sidebar-link.active {
    background: rgba(255, 255, 255, 0.11);
    color: #fff;
    transform: translateX(-2px);
}

.sidebar-link-main {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.sidebar-link i {
    font-size: 1rem;
}

.sidebar-profile {
    margin-top: 26px;
    padding: 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-profile strong {
    display: block;
    font-size: 0.98rem;
}

.sidebar-footer {
    margin-top: auto;
    padding: 20px 12px 6px;
    font-size: 0.82rem;
}

.main-panel {
    flex: 1;
    min-width: 0;
    padding: 24px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    margin-bottom: 22px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-sm);
}

.topbar-title strong {
    display: block;
    font-size: 1.05rem;
}

.topbar-title span {
    color: var(--text-soft);
    font-size: 0.92rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 0.9rem;
    box-shadow: var(--shadow-sm);
}

.page-shell {
    display: grid;
    gap: 22px;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.page-header h1,
.page-header h2 {
    margin: 0 0 8px;
    font-weight: 800;
    color: var(--text);
}

.page-header p {
    margin: 0;
    color: var(--text-soft);
    max-width: 720px;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.btn {
    border-radius: 14px;
    font-weight: 700;
    padding: 0.8rem 1rem;
    border-width: 1px;
    transition: transform var(--transition), box-shadow var(--transition), background-color var(--transition), border-color var(--transition), color var(--transition);
}

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

.btn:focus {
    box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.16);
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: #2563eb;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.24);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    border-color: #1d4ed8;
}

.btn-success {
    background: linear-gradient(135deg, #12b76a, #039855);
    border-color: #12b76a;
}

.btn-warning {
    color: #1f2937;
    background: linear-gradient(135deg, #fdb022, #f79009);
    border-color: #f79009;
}

.btn-danger {
    background: linear-gradient(135deg, #f04438, #d92d20);
    border-color: #f04438;
}

.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-danger {
    background: rgba(255, 255, 255, 0.9);
}

.btn-light {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--border);
}

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

.summary-card,
.panel-card,
.auth-card,
.table-card,
.empty-state {
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--surface);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow-sm);
}

.summary-card {
    padding: 18px;
    position: relative;
    overflow: hidden;
}

.summary-card::after {
    content: "";
    position: absolute;
    inset: auto -40px -40px auto;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.38);
    filter: blur(18px);
}

.summary-card .icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 1.2rem;
}

.summary-card .summary-label {
    color: var(--text-soft);
    font-size: 0.92rem;
    margin-bottom: 8px;
}

.summary-card strong {
    display: block;
    font-size: 1.85rem;
    line-height: 1;
    margin-bottom: 8px;
}

.summary-card small {
    color: var(--text-soft);
    font-size: 0.84rem;
}

.tone-primary .icon-wrap,
.tone-primary .status-chip,
.status-chip.tone-primary {
    background: var(--primary-soft);
    color: var(--primary);
}

.tone-success .icon-wrap,
.tone-success .status-chip,
.status-chip.tone-success {
    background: var(--success-soft);
    color: var(--success);
}

.tone-warning .icon-wrap,
.tone-warning .status-chip,
.status-chip.tone-warning {
    background: var(--warning-soft);
    color: #b54708;
}

.tone-danger .icon-wrap,
.tone-danger .status-chip,
.status-chip.tone-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.tone-dark .icon-wrap,
.tone-dark .status-chip,
.status-chip.tone-dark {
    background: rgba(16, 24, 40, 0.10);
    color: var(--dark);
}

.panel-card {
    padding: 22px;
}

.card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.card-heading h3,
.card-heading h4 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    font-weight: 800;
}

.card-heading p {
    margin: 0;
    color: var(--text-soft);
}

.panel-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 20px;
}

.panel-stack {
    display: grid;
    gap: 20px;
}

.settings-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 700;
}

.helper-note,
.alert-modern {
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid transparent;
    font-size: 0.95rem;
}

.helper-note {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.15);
    color: #1d4ed8;
}

.helper-note code {
    direction: ltr;
    display: inline-block;
}

.flash-stack {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.flash-alert {
    border-radius: 18px;
    border: 1px solid transparent;
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
}

.flash-alert.alert-success {
    background: rgba(18, 183, 106, 0.10);
    border-color: rgba(18, 183, 106, 0.18);
    color: #067647;
}

.flash-alert.alert-danger {
    background: rgba(240, 68, 56, 0.10);
    border-color: rgba(240, 68, 56, 0.18);
    color: #b42318;
}

.flash-alert.alert-warning {
    background: rgba(247, 144, 9, 0.10);
    border-color: rgba(247, 144, 9, 0.18);
    color: #b54708;
}

.flash-alert.alert-info {
    background: rgba(37, 99, 235, 0.10);
    border-color: rgba(37, 99, 235, 0.18);
    color: #1d4ed8;
}

.search-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.search-field {
    position: relative;
    flex: 1 1 320px;
}

.search-field i {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 16px;
    color: var(--text-faint);
}

.search-field input {
    padding-right: 44px;
}

.table-card {
    padding: 20px;
    overflow: hidden;
}

.table-modern {
    margin: 0;
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(248, 250, 252, 0.8);
    --bs-table-hover-bg: rgba(37, 99, 235, 0.04);
}

.table-modern thead th {
    font-size: 0.82rem;
    color: var(--text-soft);
    font-weight: 800;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    padding: 1rem 0.85rem;
    background: rgba(255, 255, 255, 0.7);
}

.table-modern tbody td {
    padding: 1rem 0.85rem;
    vertical-align: middle;
    border-color: rgba(15, 23, 42, 0.06);
}

.table-modern tbody tr {
    transition: transform var(--transition), box-shadow var(--transition), background-color var(--transition);
}

.table-modern tbody tr:hover {
    transform: translateY(-1px);
}

.identity-cell strong {
    display: block;
    font-size: 0.98rem;
}

.identity-cell small,
.muted-text {
    color: var(--text-soft);
}

.cell-stack {
    display: grid;
    gap: 4px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 700;
    font-size: 0.84rem;
    white-space: nowrap;
}

.badge-success {
    background: var(--success-soft);
    color: #067647;
}

.badge-warning {
    background: var(--warning-soft);
    color: #b54708;
}

.badge-danger {
    background: var(--danger-soft);
    color: #b42318;
}

.badge-secondary {
    background: rgba(15, 23, 42, 0.08);
    color: #344054;
}

.badge-primary {
    background: var(--primary-soft);
    color: #1d4ed8;
}

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

.form-control,
.form-select {
    min-height: 52px;
    border-radius: 16px;
    border-color: rgba(15, 23, 42, 0.10);
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: none;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(37, 99, 235, 0.40);
    box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.10);
}

textarea.form-control {
    min-height: 180px;
    resize: vertical;
}

.form-label {
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.form-text {
    color: var(--text-soft);
}

.form-switch-modern,
.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 0;
    padding-right: 0;
}

.form-check-input {
    float: none;
    margin-right: 0;
    margin-left: 0;
    width: 2.6rem;
    height: 1.4rem;
    border-radius: 999px;
}

.auth-layout {
    width: min(1140px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(360px, 460px);
    gap: 24px;
    align-items: stretch;
}

.auth-visual,
.auth-card {
    padding: 32px;
}

.auth-visual {
    background: linear-gradient(145deg, rgba(37, 99, 235, 0.95), rgba(30, 64, 175, 0.94));
    color: white;
    border-radius: 30px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.auth-visual::before,
.auth-visual::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
}

.auth-visual::before {
    width: 260px;
    height: 260px;
    top: -60px;
    left: -30px;
}

.auth-visual::after {
    width: 200px;
    height: 200px;
    bottom: -50px;
    right: -10px;
}

.auth-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    margin-bottom: 18px;
    font-size: 0.9rem;
}

.auth-visual h1 {
    margin: 0 0 14px;
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    line-height: 1.2;
    font-weight: 800;
}

.auth-visual p {
    margin: 0 0 22px;
    color: rgba(255, 255, 255, 0.82);
    max-width: 620px;
}

.auth-highlights {
    display: grid;
    gap: 14px;
    margin-top: 28px;
}

.auth-highlight {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.12);
}

.auth-highlight i {
    font-size: 1.2rem;
}

.auth-card {
    align-self: center;
}

.auth-card h2 {
    font-weight: 800;
    margin-bottom: 10px;
}

.auth-card p {
    color: var(--text-soft);
    margin-bottom: 24px;
}

.auth-footer {
    margin-top: 20px;
    color: var(--text-faint);
    font-size: 0.86rem;
    text-align: center;
}

.form-grid {
    display: grid;
    gap: 18px;
}

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

.section-grid {
    display: grid;
    gap: 18px;
}

.empty-state {
    padding: 44px 24px;
    text-align: center;
}

.empty-state i {
    display: inline-flex;
    width: 72px;
    height: 72px;
    align-items: center;
    justify-content: center;
    border-radius: 22px;
    background: rgba(37, 99, 235, 0.10);
    color: var(--primary);
    font-size: 1.8rem;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-weight: 800;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-soft);
    margin-bottom: 0;
}

.footer-note {
    text-align: center;
    color: var(--text-faint);
    font-size: 0.85rem;
    padding: 8px 0 18px;
}

.mobile-nav-toggle {
    display: none;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
}

@media (max-width: 1399px) {
    .summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1199px) {
    .summary-grid,
    .panel-grid,
    .auth-layout {
        grid-template-columns: 1fr;
    }

    .auth-visual {
        min-height: 320px;
    }
}

@media (max-width: 991px) {
    .mobile-nav-toggle {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        right: 0;
        transform: translateX(100%);
        transition: transform var(--transition);
        height: 100vh;
    }

    .dashboard-shell.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .dashboard-shell.sidebar-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .main-panel {
        width: 100%;
        padding: 16px;
    }

    .topbar,
    .panel-card,
    .table-card {
        border-radius: 20px;
    }

    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

    .page-header,
    .search-toolbar,
    .topbar,
    .topbar-actions,
    .page-actions,
    .split-actions,
    .actions-cluster {
        flex-direction: column;
        align-items: stretch;
    }

    .settings-inline {
        display: grid;
        grid-template-columns: 1fr;
    }

    .table-modern thead {
        display: none;
    }

    .table-modern,
    .table-modern tbody,
    .table-modern tr,
    .table-modern td {
        display: block;
        width: 100%;
    }

    .table-modern tbody tr {
        margin-bottom: 14px;
        padding: 16px;
        border: 1px solid var(--border);
        border-radius: 20px;
        background: #fff;
        box-shadow: var(--shadow-sm);
    }

    .table-modern tbody td {
        padding: 10px 0;
        border: 0;
    }

    .table-modern tbody td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 6px;
        font-size: 0.8rem;
        font-weight: 800;
        color: var(--text-soft);
    }

    .auth-visual,
    .auth-card {
        padding: 24px;
    }
}
