/* ====================================================================
   RoshanPlus Bank — design system (Bootstrap 5 RTL companion)
   Loaded AFTER bootstrap.rtl.min.css so these rules win.
   ==================================================================== */

@font-face {
    font-family: "Vazirmatn";
    src: url("/fonts/Vazirmatn.woff2") format("woff2");
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --rp-primary: #2563eb;
    --rp-primary-600: #2563eb;
    --rp-primary-700: #1d4ed8;
    --rp-primary-soft: color-mix(in srgb, var(--rp-primary) 12%, white);
    --rp-primary-tint: color-mix(in srgb, var(--rp-primary) 6%, white);
    --rp-grad: linear-gradient(135deg, var(--rp-primary), color-mix(in srgb, var(--rp-primary) 62%, #7c3aed));

    --rp-ink: #0f172a;
    --rp-ink-2: #475569;
    --rp-muted: #64748b;
    --rp-line: #e8edf5;
    --rp-line-2: #eef2f7;
    --rp-bg: #f1f5f9;
    --rp-surface: #ffffff;

    --rp-radius: 16px;
    --rp-radius-sm: 12px;
    --rp-radius-lg: 22px;

    --rp-shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
    --rp-shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --rp-shadow: 0 4px 16px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .05);
    --rp-shadow-lg: 0 18px 48px rgba(15, 23, 42, .14);

    --bs-primary: var(--rp-primary);
    --bs-link-color: var(--rp-primary);
    --bs-body-font-family: "Vazirmatn", -apple-system, "Segoe UI", Roboto, sans-serif;
    --bs-body-bg: var(--rp-bg);
    --bs-body-color: var(--rp-ink);
}

*,
button,
input,
select,
textarea {
    font-family: var(--bs-body-font-family);
}

body {
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: color-mix(in srgb, var(--rp-primary) 22%, transparent);
}

[x-cloak] {
    display: none !important;
}

/* ---- App shell ---- */
.rp-shell {
    display: flex;
    min-height: 100vh;
    gap: 16px;
    padding: 16px;
}

.rp-sidebar {
    width: 254px;
    flex: 0 0 254px;
    background: var(--rp-surface);
    border-radius: var(--rp-radius);
    box-shadow: var(--rp-shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: sticky;
    top: 16px;
    height: calc(100vh - 32px);
    border: 1px solid var(--rp-line-2);
}

.rp-content {
    flex: 1 1 auto;
    min-width: 0;
}

.rp-topbar {
    background: var(--rp-surface);
    border-radius: var(--rp-radius);
    box-shadow: var(--rp-shadow-sm);
    padding: 12px 18px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--rp-line-2);
}

.rp-topbar-title {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
}

.rp-topbar-title h5 {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    font-size: 1.05rem;
}

.rp-menu-toggle,
.rp-drawer-close {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 12px;
    display: none;
    place-items: center;
    flex: 0 0 auto;
    background: #f1f5f9;
    color: #334155;
    font-size: 1.35rem;
    transition: background-color .2s ease, color .2s ease;
}

.rp-menu-toggle:hover,
.rp-drawer-close:hover {
    background: var(--rp-primary-soft);
    color: var(--rp-primary);
}

.rp-drawer-backdrop {
    display: none;
}

.rp-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 18px;
    border-bottom: 1px solid var(--rp-line-2);
}

.rp-brand>div.rp-brand-text {
    min-width: 0;
    flex: 1;
}

.rp-brand .rp-brand-text>div {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rp-brand .rp-brand-text .fw-bold {
    font-size: .98rem;
}

.rp-brand .logo {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    font-size: 21px;
    color: #fff;
    flex: 0 0 auto;
}

.rp-menu {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

.rp-menu a {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--rp-ink-2);
    text-decoration: none;
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 3px;
    font-weight: 500;
    font-size: .93rem;
    position: relative;
    transition: background-color .18s ease, color .18s ease;
}

.rp-menu a i {
    font-size: 1.15rem;
    opacity: .9;
}

.rp-menu a:hover {
    background: #f1f5f9;
    color: var(--rp-ink);
}

.rp-menu a.active {
    background: var(--rp-grad);
    color: #fff;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--rp-primary) 26%, transparent);
}

.rp-menu a.active i {
    opacity: 1;
}

.rp-sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--rp-line-2);
}

/* ---- Topbar avatar / user chip ---- */
.rp-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px 5px 6px;
    border-radius: 999px;
    background: var(--rp-primary-tint);
    color: var(--rp-primary);
    font-size: .82rem;
    font-weight: 600;
}

.rp-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    background: var(--rp-grad);
    color: #fff;
    font-weight: 700;
    font-size: .8rem;
}

/* ---- Page header ---- */
.rp-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.rp-page-head .rp-ph-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.rp-page-head .rp-ph-icon {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    background: var(--rp-primary-soft);
    color: var(--rp-primary);
    font-size: 1.25rem;
}

.rp-page-head h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.3;
}

.rp-page-head .rp-ph-sub {
    margin: 2px 0 0;
    color: var(--rp-muted);
    font-size: .82rem;
}

.rp-page-head .rp-ph-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.rp-section-title {
    font-weight: 700;
    font-size: .95rem;
    color: var(--rp-ink);
    display: flex;
    align-items: center;
    gap: 8px;
}

.rp-section-title i {
    color: var(--rp-primary);
}

/* ---- Plain (standalone) page wrapper ---- */
.rp-plain-wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 22px 18px 48px;
}

@media (max-width: 575.98px) {
    .rp-plain-wrap {
        padding: 12px 10px 32px;
    }
}

/* ---- Cards / stats / grid ---- */
.card {
    background: var(--rp-surface);
    border-radius: var(--rp-radius);
    box-shadow: var(--rp-shadow-sm);
    border: 1px solid var(--rp-line-2);
    padding: 18px;
}

.card-flush {
    padding: 0;
    overflow: hidden;
}

.card-flush>table {
    border-radius: inherit;
}

.rp-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.grid {
    display: grid;
    gap: 14px;
}

.stat {
    background: var(--rp-surface);
    border-radius: var(--rp-radius);
    box-shadow: var(--rp-shadow-sm);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--rp-line-2);
    transition: transform .18s ease, box-shadow .18s ease;
}

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

.stat .rp-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    font-size: 1.4rem;
    background: var(--rp-primary-soft);
    color: var(--rp-primary);
}

.stat .rp-stat-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat .n {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.stat .l {
    color: var(--rp-muted);
    font-size: .82rem;
}

.stat.tint-green .rp-stat-icon {
    background: #dcfce7;
    color: #16a34a;
}

.stat.tint-amber .rp-stat-icon {
    background: #fef3c7;
    color: #d97706;
}

.stat.tint-rose .rp-stat-icon {
    background: #ffe4e6;
    color: #e11d48;
}

.stat.tint-violet .rp-stat-icon {
    background: #ede9fe;
    color: #7c3aed;
}

.stat.tint-sky .rp-stat-icon {
    background: #e0f2fe;
    color: #0284c7;
}

/* ---- Tables ---- */
.rp-table-wrap {
    width: 100%;
    overflow-x: auto;
}

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

thead th {
    text-align: right;
    padding: 13px 14px;
    color: var(--rp-muted);
    background: #f8fafc;
    border-bottom: 1px solid var(--rp-line);
    font-size: .76rem;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: .01em;
}

tbody td {
    text-align: right;
    padding: 13px 14px;
    border-bottom: 1px solid var(--rp-line-2);
    vertical-align: middle;
}

tbody tr {
    transition: background-color .16s ease;
}

tbody tr:hover {
    background: #f8fafc;
}

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

.rp-row-actions {
    display: inline-flex;
    gap: 6px;
    white-space: nowrap;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 15px;
    border-radius: 11px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: .87rem;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.2;
    transition: transform .12s ease, filter .15s ease, background-color .15s ease, box-shadow .15s ease;
    white-space: nowrap;
}

.btn:hover {
    filter: brightness(.98);
}

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

.btn:focus-visible,
.pagination .page-link:focus-visible,
.rp-segment button:focus-visible,
.rp-filter-component-toggle:focus-visible,
.rp-lightbox-close:focus-visible,
.rp-img-retry:focus-visible,
.rp-tree-box .fancytree-container:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--rp-primary) 42%, transparent);
    outline-offset: 2px;
    box-shadow: 0 0 0 2px var(--rp-surface);
}

.rp-chip:focus-within {
    outline: 3px solid color-mix(in srgb, var(--rp-primary) 35%, transparent);
    outline-offset: 2px;
}

.btn:disabled,
.btn[disabled] {
    opacity: .6;
    cursor: not-allowed;
}

.btn,
.pagination .page-link,
.rp-filter-component-toggle {
    touch-action: manipulation;
}

.btn-sm {
    padding: 6px 11px;
    font-size: .8rem;
    border-radius: 9px;
}

.btn-lg {
    padding: 12px 20px;
    font-size: .95rem;
    border-radius: 13px;
}

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

.btn-primary {
    background: var(--rp-grad);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--rp-primary) 24%, transparent);
}

.btn-primary:hover {
    filter: brightness(1.04);
    box-shadow: 0 10px 22px color-mix(in srgb, var(--rp-primary) 30%, transparent);
}

.btn-success {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
    box-shadow: 0 8px 18px rgba(22, 163, 74, .22);
}

.btn-warning {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #fff;
    box-shadow: 0 8px 18px rgba(245, 158, 11, .22);
}

.btn-danger {
    background: #fee2e2;
    border-color: #fecaca;
    color: #b91c1c;
    box-shadow: none;
}

.btn-danger:hover {
    background: #fecaca;
}

.btn-muted,
.btn-light {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #334155;
}

.btn-muted:hover,
.btn-light:hover {
    background: #e9eef4;
}

.btn-outline {
    background: #fff;
    border-color: #dbe2ec;
    color: var(--rp-ink-2);
}

.btn-outline:hover {
    border-color: var(--rp-primary);
    color: var(--rp-primary);
    background: var(--rp-primary-tint);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--rp-ink-2);
}

.btn-ghost:hover {
    background: #f1f5f9;
    color: var(--rp-ink);
}

/* square icon button for row actions */
.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 10px;
    font-size: 1rem;
}

.btn-icon.btn-sm {
    width: 30px;
    height: 30px;
    font-size: .9rem;
}

/* ---- Forms ---- */
.input,
select,
textarea,
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    font-size: .88rem;
    background: #f8fafc;
    color: var(--rp-ink);
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.input::placeholder,
textarea::placeholder {
    color: #94a3b8;
}

.input:focus,
select:focus,
textarea:focus,
.form-control:focus {
    outline: none;
    border-color: var(--rp-primary);
    background: #fff;
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--rp-primary) 15%, transparent);
}

label {
    font-size: .82rem;
    color: var(--rp-ink-2);
}

.rp-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rp-field>label {
    font-weight: 600;
}

.rp-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .86rem;
    color: var(--rp-ink-2);
    cursor: pointer;
    user-select: none;
}

.rp-check input {
    width: 17px;
    height: 17px;
    accent-color: var(--rp-primary);
    cursor: pointer;
}

/* ---- Badges / status ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 700;
    line-height: 1.4;
}

.b-easy {
    background: #dcfce7;
    color: #166534;
}

.b-medium {
    background: #fef9c3;
    color: #854d0e;
}

.b-hard {
    background: #ffedd5;
    color: #9a3412;
}

.b-vhard {
    background: #fee2e2;
    color: #991b1b;
}

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

.rp-badge-off {
    background: #fee2e2;
    color: #991b1b;
}

.rp-badge-info {
    background: var(--rp-primary-soft);
    color: var(--rp-primary);
}

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

.rp-badge-lock {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* ---- Alerts (legacy .flash/.warn kept) ---- */
.flash,
.warn {
    padding: 11px 14px;
    border-radius: 12px;
    margin-bottom: 14px;
    font-size: .85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.flash {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.warn {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.err {
    color: #dc2626;
    font-size: .78rem;
    margin-top: 4px;
}

/* ---- Jalali datepicker popup ---- */
.jdp-container {
    z-index: 1200 !important;
    font-family: var(--bs-body-font-family) !important;
}

/* ---- Breadcrumb (drill-down) ---- */
.rp-crumbs {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.rp-crumb {
    border: 0;
    background: transparent;
    color: var(--rp-ink-2);
    font-weight: 600;
    font-size: .85rem;
    padding: 5px 10px;
    border-radius: 9px;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.rp-crumb:hover {
    background: var(--rp-primary-tint);
    color: var(--rp-primary);
}

.rp-crumb.is-active {
    background: var(--rp-primary-soft);
    color: var(--rp-primary);
}

.rp-crumb-sep {
    color: #cbd5e1;
    font-size: .8rem;
}

.rp-link-btn {
    border: 0;
    background: transparent;
    color: var(--rp-ink);
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.rp-link-btn:hover {
    color: var(--rp-primary);
}

/* ---- Empty state ---- */
.rp-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--rp-muted);
}

.rp-empty i {
    font-size: 2.4rem;
    color: #cbd5e1;
    display: block;
    margin-bottom: 10px;
}

.rp-empty .rp-empty-title {
    font-weight: 700;
    color: var(--rp-ink-2);
    font-size: .95rem;
}

.rp-empty .rp-empty-sub {
    font-size: .82rem;
    margin-top: 4px;
}

/* ---- Helpers ---- */
.ltr {
    direction: ltr;
    unicode-bidi: embed;
}

a {
    color: var(--rp-primary);
}

.rp-muted {
    color: var(--rp-muted);
}

.rp-hr {
    height: 1px;
    background: var(--rp-line-2);
    border: 0;
    margin: 16px 0;
}

/* ---- Pagination (custom rp view) ---- */
.rp-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    min-width: 0;
    max-width: 100%;
}

.rp-pagination-info {
    color: var(--rp-muted);
    font-size: .82rem;
}

.pagination {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    row-gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pagination .page-item {
    flex: 0 0 auto;
}

.pagination .page-item .page-link,
.pagination .page-item>span.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--rp-line);
    border-radius: 10px;
    background: #fff;
    color: var(--rp-ink-2);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    line-height: 1;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.pagination .page-item .page-link:hover {
    border-color: var(--rp-primary);
    color: var(--rp-primary);
    background: var(--rp-primary-tint);
}

.pagination .page-item.active .page-link {
    background: var(--rp-grad);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 6px 14px color-mix(in srgb, var(--rp-primary) 26%, transparent);
}

.pagination .page-item.disabled .page-link {
    opacity: .45;
    cursor: default;
    background: #f8fafc;
}

.pagination .page-item .page-link:disabled {
    opacity: .55;
    cursor: wait;
}

@media (max-width: 575.98px) {
    .rp-pagination-info {
        display: none;
    }

    .rp-pagination {
        justify-content: center;
    }

    .pagination {
        width: 100%;
        justify-content: center;
        gap: 6px;
    }

    .pagination .page-item .page-link,
    .pagination .page-item>span.page-link {
        min-width: 44px;
        height: 44px;
        padding-inline: 8px;
    }
}

/* ====================================================================
   Modal (rp-modal) — Livewire-controlled overlay (no Bootstrap JS)
   ==================================================================== */
.rp-modal {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: none;
    padding: 22px;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    background: rgba(15, 23, 42, .5);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity .2s ease;
}

.rp-modal.is-open {
    display: flex;
    opacity: 1;
}

body.rp-modal-open {
    overflow: hidden;
}

.rp-modal-panel {
    background: var(--rp-surface);
    border-radius: var(--rp-radius-lg);
    width: 100%;
    max-width: 520px;
    margin: auto;
    box-shadow: var(--rp-shadow-lg);
    overflow: hidden;
    transform: translateY(14px) scale(.98);
    opacity: 0;
    transition: transform .22s cubic-bezier(.2, .8, .2, 1), opacity .22s ease;
}

.rp-modal.is-open .rp-modal-panel {
    transform: none;
    opacity: 1;
}

.rp-modal-sm .rp-modal-panel {
    max-width: 400px;
}

.rp-modal-lg .rp-modal-panel {
    max-width: 760px;
}

.rp-modal-xl .rp-modal-panel {
    max-width: 980px;
}

.rp-modal-head {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--rp-line-2);
}

.rp-modal-head .rp-modal-ico {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    background: var(--rp-primary-soft);
    color: var(--rp-primary);
    font-size: 1.1rem;
}

.rp-modal-head h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    flex: 1;
}

.rp-modal-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: #f1f5f9;
    color: #475569;
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color .15s ease, color .15s ease;
}

.rp-modal-close:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.rp-modal-body {
    padding: 20px;
    max-height: calc(100vh - 220px);
    overflow-y: auto;
}

.rp-modal-foot {
    padding: 14px 20px;
    border-top: 1px solid var(--rp-line-2);
    background: #f8fafc;
    display: flex;
    gap: 8px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

/* ---- Form grid inside modals ---- */
.rp-form-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, 1fr);
}

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

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

/* ====================================================================
   Toast (rp-toast)
   ==================================================================== */
.rp-toast-wrap {
    position: fixed;
    inset-block-start: 18px;
    inset-inline-start: 18px;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.rp-toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 240px;
    max-width: 380px;
    padding: 12px 15px;
    border-radius: 13px;
    background: #fff;
    box-shadow: var(--rp-shadow-lg);
    border: 1px solid var(--rp-line);
    font-size: .86rem;
    font-weight: 600;
    color: var(--rp-ink);
    animation: rp-toast-in .28s cubic-bezier(.2, .8, .2, 1);
}

.rp-toast i {
    font-size: 1.2rem;
    flex: 0 0 auto;
}

.rp-toast.is-ok i {
    color: #16a34a;
}

.rp-toast.is-err i {
    color: #dc2626;
}

.rp-toast .rp-toast-bar {
    width: 4px;
    align-self: stretch;
    border-radius: 4px;
}

.rp-toast.is-ok .rp-toast-bar {
    background: #16a34a;
}

.rp-toast.is-err .rp-toast-bar {
    background: #dc2626;
}

@keyframes rp-toast-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ====================================================================
   Segmented control + chips (workspace)
   ==================================================================== */
.rp-segment {
    display: inline-flex;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
}

.rp-segment button,
.rp-segment .rp-seg-item {
    border: 0;
    background: transparent;
    color: var(--rp-ink-2);
    font-weight: 600;
    font-size: .84rem;
    padding: 7px 16px;
    border-radius: 9px;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.rp-segment button.active,
.rp-segment .rp-seg-item.active {
    background: #fff;
    color: var(--rp-primary);
    box-shadow: var(--rp-shadow-xs);
}

.rp-chip-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rp-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    padding: 10px 13px;
    border-radius: 11px;
    cursor: pointer;
    border: 1px solid var(--rp-line);
    transition: border-color .18s ease, background-color .18s ease;
    user-select: none;
    font-size: .88rem;
}

.rp-chip:hover {
    background: #f1f5f9;
}

.rp-chip input {
    width: 18px;
    height: 18px;
    accent-color: var(--rp-primary);
    cursor: pointer;
    flex: 0 0 auto;
}

.rp-chip:has(input:checked) {
    border-color: var(--rp-primary);
    background: var(--rp-primary-tint);
}

.rp-chip:has(input:checked) span {
    font-weight: 700;
    color: var(--rp-primary);
}

/* count medallion */
.rp-count-medallion {
    width: 132px;
    height: 132px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin: 0 auto 4px;
    background: conic-gradient(var(--rp-primary) 0, var(--rp-primary) 100%, #e2e8f0 0);
    padding: 12px;
    box-shadow: inset 0 0 0 12px #fff;
}

.rp-count-medallion .rp-count-inner {
    text-align: center;
}

.rp-count-medallion .rp-count-n {
    font-size: 1.7rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1;
}

.rp-count-medallion .rp-count-l {
    font-size: .72rem;
    color: #ffffff;
    margin-top: 3px;
}

/* sticky sidebar panel for workspaces */
.rp-sticky {
    position: sticky;
    top: 16px;
    align-self: flex-start;
}

/* two-column workspace (sidebar + main). First col renders on the right in RTL. */
.rp-workspace {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.rp-workspace-aside {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Optional wrapper for collapsing workspace filters on phone/tablet layouts. */
.rp-filter-component {
    min-width: 0;
    position: relative;
    isolation: isolate;
}

.rp-filter-loading {
    position: absolute;
    inset: 0;
    z-index: 10;
    align-items: flex-start;
    justify-content: center;
    padding: 12px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--rp-bg) 82%, transparent);
    pointer-events: auto;
}

.rp-filter-component-toggle {
    width: 100%;
    min-height: 48px;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--rp-line);
    border-radius: 13px;
    background: var(--rp-surface);
    color: var(--rp-ink);
    box-shadow: var(--rp-shadow-xs);
    cursor: pointer;
    font-size: .9rem;
    font-weight: 700;
    text-align: start;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.rp-filter-component-toggle:hover {
    border-color: color-mix(in srgb, var(--rp-primary) 35%, var(--rp-line));
    background: var(--rp-primary-tint);
}

.rp-filter-component-toggle-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    transition: transform .18s ease;
}

.rp-filter-component-toggle[aria-expanded="true"] .rp-filter-component-toggle-icon {
    transform: rotate(180deg);
}

.rp-filter-component-sections {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

@media (max-width: 991.98px) {
    .rp-workspace {
        grid-template-columns: 1fr;
    }

    .rp-workspace .rp-sticky {
        position: static;
    }

    .rp-filter-component-toggle {
        display: flex;
    }

    .rp-filter-component-sections {
        display: none;
        margin-top: 12px;
    }

    .rp-filter-component.is-open>.rp-filter-component-sections,
    .rp-filter-component[data-open="true"]>.rp-filter-component-sections,
    .rp-filter-component:has(>.rp-filter-component-toggle[aria-expanded="true"])>.rp-filter-component-sections {
        display: flex;
    }
}

/* filter stack */
.rp-filter-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rp-filter-stack label.rp-flabel {
    font-weight: 600;
    font-size: .78rem;
    color: var(--rp-muted);
    margin-bottom: -2px;
}

/* curriculum fancytree box */
.rp-tree-box {
    border: 1px solid var(--rp-line);
    border-radius: 11px;
    background: #fbfdff;
    min-height: 200px;
    max-height: 460px;
    overflow: auto;
    padding: 8px 6px;
}

.rp-tree-box .fancytree-container {
    border: 0;
    direction: rtl;
    text-align: right;
    background: transparent;
    font-size: .9rem;
    outline: 0;
}

.rp-tree-box .fancytree-node {
    padding: 2px 0;
}

.rp-tree-box span.fancytree-title {
    color: var(--rp-ink-2);
    border: 0;
    padding: 2px 6px;
    border-radius: 6px;
}

.rp-tree-box span.fancytree-title:hover {
    background: var(--rp-primary-tint);
}

.rp-tree-box .fancytree-active span.fancytree-title,
.rp-tree-box .fancytree-selected span.fancytree-title {
    background: var(--rp-primary-soft);
    color: var(--rp-primary);
    font-weight: 600;
}

.rp-tree-box span.fancytree-checkbox {
    cursor: pointer;
}

.rp-tree-box span.fancytree-expander {
    cursor: pointer;
}

/* question card (workspace) */
.qcard {
    border: 1px solid var(--rp-line);
    border-radius: var(--rp-radius-sm);
    padding: 15px;
    margin-bottom: 12px;
    background: #fff;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.qcard-head,
.qcard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.qcard-head>.qcard-meta,
.qcard-header>.qcard-meta {
    flex: 1 1 auto;
    min-width: 0;
}

.qcard-head>.rp-row-actions,
.qcard-header>.rp-row-actions {
    flex: 0 0 auto;
}

.qcard:hover {
    border-color: color-mix(in srgb, var(--rp-primary) 30%, var(--rp-line));
    box-shadow: var(--rp-shadow-sm);
}

.qcard.is-selected {
    border-color: #86efac;
    background: #f6fef9;
    box-shadow: inset 3px 0 0 #16a34a;
}

.qcard:last-child {
    margin-bottom: 0;
}

.qcard .qcard-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    font-size: .74rem;
    color: var(--rp-muted);
}

.qcard .choices {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(2, 1fr);
}

.qcard .choices li {
    border: 1px solid var(--rp-line);
    border-radius: 9px;
    padding: 7px 11px;
    font-size: .85rem;
    background: #f8fafc;
}

.qcard .choices li.correct {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
    font-weight: 600;
}

@media (max-width: 575.98px) {
    .btn {
        min-height: 44px;
    }

    .rp-filter-stack .input,
    .rp-filter-stack select,
    .rp-filter-stack textarea,
    .rp-auto-count {
        min-height: 44px;
        font-size: 1rem;
    }

    .rp-chip,
    .rp-filter-stack .rp-check,
    .rp-segment button,
    .rp-segment .rp-seg-item {
        min-height: 44px;
    }

    .rp-filter-stack .rp-check {
        padding-block: 8px;
    }

    .rp-tree-box {
        max-height: min(56dvh, 420px);
    }

    .rp-tree-box .fancytree-node {
        min-height: 44px;
        padding-block: 4px;
    }

    .rp-tree-box span.fancytree-title {
        min-height: 36px;
        padding-block: 8px;
    }

    .rp-tree-box span.fancytree-checkbox,
    .rp-tree-box span.fancytree-expander {
        margin-top: 10px;
    }

    .qcard-head,
    .qcard-header {
        flex-direction: column;
        align-items: stretch;
    }

    .qcard-head>.rp-row-actions,
    .qcard-header>.rp-row-actions {
        display: flex;
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 8px;
        white-space: normal;
    }

    .qcard-head>.rp-row-actions .btn-sm:not(.btn-icon),
    .qcard-header>.rp-row-actions .btn-sm:not(.btn-icon) {
        min-height: 44px;
        flex: 1 1 auto;
    }

    .btn-icon.btn-sm {
        width: 44px;
        height: 44px;
    }

    .qcard .choices {
        grid-template-columns: 1fr;
    }
}

/* Scoped Livewire loading overlay. The existing content reserves its own height,
   so showing the absolute overlay does not cause layout shift. */
.rp-loading-region {
    position: relative;
    min-width: 0;
    min-height: 160px;
    isolation: isolate;
}

.rp-loading-region>.rp-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    align-items: flex-start;
    justify-content: center;
    padding: clamp(18px, 7vh, 58px) 14px 18px;
    border-radius: inherit;
    background: color-mix(in srgb, var(--rp-surface) 88%, transparent);
    pointer-events: auto;
}

.rp-loading-panel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    max-width: 100%;
    padding: 10px 16px;
    border: 1px solid color-mix(in srgb, var(--rp-primary) 18%, var(--rp-line));
    border-radius: 13px;
    background: var(--rp-surface);
    color: var(--rp-ink-2);
    box-shadow: var(--rp-shadow);
    font-size: .86rem;
    font-weight: 600;
    text-align: center;
}

.rp-loading-panel .rp-spin {
    flex: 0 0 auto;
    border-color: color-mix(in srgb, var(--rp-primary) 24%, transparent);
    border-top-color: var(--rp-primary);
}

.rp-loading-region[aria-busy="true"]>.rp-loading-content {
    pointer-events: none;
    user-select: none;
}

/* ---- Initial loader ---- */
body.rp-app-loading {
    overflow: hidden;
}

.rp-initial-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: grid;
    place-items: center;
    background: #f8fafc;
    transition: opacity .35s ease, visibility .35s ease;
}

.rp-initial-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.rp-loader-mark {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    position: relative;
    border-radius: 22px;
    color: var(--rp-primary);
    background: #fff;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .1);
}

.rp-loader-mark::after {
    content: "";
    position: absolute;
    inset: -7px;
    border-radius: 27px;
    border: 2px solid color-mix(in srgb, var(--rp-primary) 18%, transparent);
    border-top-color: var(--rp-primary);
    animation: rp-spin 1.2s linear infinite;
}

.rp-loader-title {
    margin-top: 16px;
    color: #0f172a;
    font-weight: 700;
    text-align: center;
}

.rp-loader-sub {
    margin-top: 4px;
    color: #64748b;
    font-size: .8rem;
    text-align: center;
}

@keyframes rp-spin {
    to {
        transform: rotate(360deg);
    }
}

/* small inline spinner (buttons/loading) */
.rp-spin {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: rp-spin .8s linear infinite;
}

/* ---- Auth (login) ---- */
.rp-auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(1100px 560px at 100% -10%, color-mix(in srgb, var(--rp-primary) 18%, transparent), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, color-mix(in srgb, #7c3aed 14%, transparent), transparent 55%),
        var(--rp-bg);
}

.rp-auth-card {
    width: 100%;
    max-width: 410px;
    background: #fff;
    border-radius: var(--rp-radius-lg);
    box-shadow: var(--rp-shadow-lg);
    padding: 34px;
    border: 1px solid var(--rp-line-2);
}

.rp-auth-logo {
    width: 62px;
    height: 62px;
    border-radius: 19px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--rp-grad);
    font-size: 1.8rem;
    margin: 0 auto 16px;
    box-shadow: 0 12px 26px color-mix(in srgb, var(--rp-primary) 30%, transparent);
}

/* ====================================================================
   Question content rendering (Phase 12)
   ==================================================================== */
.rp-qc {
    line-height: 2;
    letter-spacing: 0;
    word-break: break-word;
}

.rp-qc p {
    margin: 0 0 .5rem;
}

.rp-qc img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

.rp-qc pre {
    background: #0d1117;
    color: #e6edf3;
    border-radius: 12px;
    padding: 14px;
    overflow: auto;
    direction: ltr;
}

.rp-qc code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.rp-qc :not(pre)>code {
    background: #f1f5f9;
    padding: 1px 6px;
    border-radius: 6px;
    font-size: .9em;
    direction: ltr;
}

.rp-qc .katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 0;
}

/* skeleton while a card waits to be processed */
.rp-qc-skeleton {
    position: relative;
    min-height: 44px;
}

.rp-qc-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 10px;
    background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 37%, #eef2f7 63%);
    background-size: 400% 100%;
    animation: rp-shimmer 1.3s ease infinite;
}

@keyframes rp-shimmer {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: 0 0;
    }
}

/* lazy image wrapper */
.rp-img-wrap {
    display: inline-block;
    position: relative;
    min-width: 60px;
    min-height: 32px;
}

.rp-img-wrap.is-loading::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 10px;
    background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 37%, #eef2f7 63%);
    background-size: 400% 100%;
    animation: rp-shimmer 1.3s ease infinite;
}

.rp-img-wrap.is-error img {
    display: none;
}

.rp-img-retry {
    border: 1px dashed #fca5a5;
    background: #fef2f2;
    color: #b91c1c;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: .82rem;
    cursor: pointer;
}

/* lightbox */
.rp-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    place-items: center;
    background: rgba(15, 23, 42, .82);
    backdrop-filter: blur(2px);
    padding: 24px;
}

.rp-lightbox.is-open {
    display: grid;
}

.rp-lightbox img {
    max-width: 92vw;
    max-height: 86vh;
    border-radius: 12px;
    cursor: zoom-in;
    transition: transform .2s ease;
    background: #fff;
}

.rp-lightbox img.is-zoomed {
    transform: scale(1.8);
    cursor: zoom-out;
}

.rp-lightbox-close {
    position: fixed;
    top: 18px;
    inset-inline-end: 18px;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
}

body.rp-lightbox-open {
    overflow: hidden;
}

/* ====================================================================
   Responsive — mobile drawer
   ==================================================================== */
@media (max-width: 991.98px) {
    .rp-shell {
        display: block;
        min-height: 100dvh;
        padding: 10px;
    }

    .rp-content {
        width: 100%;
    }

    .rp-topbar {
        position: sticky;
        top: 10px;
        z-index: 1020;
    }

    .rp-menu-toggle,
    .rp-drawer-close {
        display: grid;
    }

    .rp-sidebar {
        position: fixed;
        inset-block: 0;
        inset-inline-start: 0;
        width: min(86vw, 320px);
        height: 100dvh;
        max-height: none;
        flex-basis: auto;
        border-radius: 20px 0 0 20px;
        z-index: 1045;
        transform: translateX(110%);
        visibility: hidden;
        transition: transform .25s ease, visibility .25s ease;
        box-shadow: -18px 0 45px rgba(15, 23, 42, .18);
    }

    .rp-sidebar.is-open {
        transform: translateX(0);
        visibility: visible;
    }

    .rp-drawer-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1040;
        border: 0;
        background: rgba(15, 23, 42, .44);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity .25s ease, visibility .25s ease;
    }

    .rp-drawer-backdrop.is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    body.rp-drawer-open {
        overflow: hidden;
    }

    /* wide tables scroll horizontally inside their card */
    .rp-table-wrap {
        -webkit-overflow-scrolling: touch;
    }

    .card>table {
        min-width: 560px;
    }
}

@media (max-width: 575.98px) {
    .rp-shell {
        padding: 8px;
    }

    .rp-topbar {
        top: 8px;
        padding: 10px 12px;
        margin-bottom: 12px;
        border-radius: 14px;
    }

    .card {
        border-radius: 14px;
        padding: 14px;
    }

    .stat .n {
        font-size: 1.35rem;
    }

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

    .rp-modal {
        padding: 0;
        align-items: flex-end;
    }

    .rp-modal-panel {
        max-width: 100%;
        border-radius: 20px 20px 0 0;
    }

    .rp-page-head h2 {
        font-size: 1.05rem;
    }
}

@media (prefers-reduced-motion: reduce) {

    .rp-sidebar,
    .rp-drawer-backdrop,
    .rp-initial-loader,
    .rp-modal,
    .rp-modal-panel,
    .stat,
    .btn,
    .pagination .page-link,
    .rp-segment button,
    .rp-segment .rp-seg-item,
    .rp-chip,
    .qcard,
    .rp-filter-component-toggle,
    .rp-filter-component-toggle-icon,
    .rp-loading-panel {
        transition: none;
    }

    .rp-loader-mark::after,
    .rp-spin,
    .rp-qc-skeleton::after,
    .rp-img-wrap.is-loading::before,
    .rp-toast {
        animation: none;
    }
}
