.admin-body {
    min-height: 100vh;
}

.admin-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
    gap: 0.8rem;
    padding: 0.8rem;
}

.admin-sidebar {
    position: sticky;
    top: 0.8rem;
    max-height: calc(100vh - 1.6rem);
    padding: 0.9rem;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.9rem;
}

.brand-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 700;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(145deg, var(--primary), var(--primary-2));
}

.sidebar-scroll {
    overflow-y: auto;
    padding-right: 0.15rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    text-decoration: none;
    color: var(--text-muted);
    padding: 0.62rem 0.72rem;
    border-radius: 12px;
    margin-bottom: 0.35rem;
    font-size: 0.84rem;
    font-weight: 500;
    transition: all 0.23s ease;
}

.sidebar-badge {
    margin-left: auto;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.32rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #d35572, #c2465e);
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.46);
    color: var(--text-main);
}

.sidebar-link.active {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow: 0 11px 26px rgba(109, 74, 230, 0.25);
}

.sidebar-link.logout {
    margin-top: auto;
    color: var(--danger);
    background: rgba(194, 70, 94, 0.1);
}

.admin-content {
    min-width: 0;
    position: relative;
    z-index: 0;
}

.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    padding: 0.9rem 1rem;
    margin-bottom: 0.8rem;
    position: relative;
    z-index: 40;
    overflow: visible;
    isolation: isolate;
}

.admin-topbar .dropdown {
    position: relative;
}

.admin-notify-dropdown {
    position: relative;
}

.admin-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    padding: 0.45rem 0.74rem;
    border-radius: 999px;
    font-size: 0.82rem;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.78);
}

.admin-lang-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.42rem 0.68rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.78);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.admin-lang-toggle-btn:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.admin-lang-toggle-btn i {
    font-size: 0.88rem;
    color: var(--primary);
    transition: transform 0.2s ease;
}

.admin-lang-toggle-btn:hover i {
    transform: rotate(15deg);
}

.admin-lang-toggle-btn .lang-divider {
    opacity: 0.35;
    font-weight: 400;
    margin: 0 0.05rem;
}

.admin-lang-toggle-btn .lang-opt {
    opacity: 0.45;
    transition: all 0.2s ease;
    padding: 0.05rem 0.2rem;
    border-radius: 3px;
}

.admin-lang-toggle-btn .lang-opt.active {
    opacity: 1;
    color: var(--primary);
    font-weight: 700;
}

html[data-theme="dark"] .admin-lang-toggle-btn {
    background: rgba(20, 31, 35, 0.82);
    border-color: rgba(168, 150, 224, 0.24);
    color: var(--text-main);
}

html[data-theme="dark"] .admin-lang-toggle-btn:hover {
    background: rgba(28, 42, 48, 0.95);
    border-color: rgba(168, 150, 224, 0.4);
}

html[data-theme="dark"] .admin-lang-toggle-btn i {
    color: #60a5fa;
}

html[data-theme="dark"] .admin-lang-toggle-btn .lang-opt.active {
    color: #60a5fa;
}

.notify-count-badge {
    position: absolute;
    top: -0.32rem;
    right: -0.35rem;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.22rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.66rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #d35572, #c2465e);
    box-shadow: 0 6px 12px rgba(194, 70, 94, 0.32);
}

.admin-notify-menu {
    display: none;
    width: min(320px, calc(100vw - 1.6rem));
    min-width: 320px;
    max-width: calc(100vw - 1.6rem);
    position: absolute !important;
    top: calc(100% + 0.45rem) !important;
    right: 0 !important;
    left: auto !important;
    margin: 0 !important;
    transform: none !important;
    border: 1px solid rgba(255, 255, 255, 0.76);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 18px 38px rgba(24, 50, 56, 0.18);
    z-index: 1400;
}

.admin-notify-menu.show {
    display: block;
}

.admin-notify-header {
    padding: 0.7rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(95, 125, 120, 0.18);
}

.admin-notify-header-total {
    min-width: 1.4rem;
    height: 1.4rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #256fd8, #1f94d6);
}

.admin-notify-list {
    max-height: 260px;
    overflow-y: auto;
}

.admin-notify-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text-main);
    padding: 0.65rem 0.85rem;
    border-bottom: 1px dashed rgba(95, 125, 120, 0.2);
    transition: background 0.2s ease, transform 0.2s ease;
}

.admin-notify-item:hover {
    background: rgba(109, 74, 230, 0.08);
    color: var(--text-main);
    transform: translateY(-1px);
}

.admin-notify-item-icon {
    width: 1.9rem;
    height: 1.9rem;
    flex: 0 0 1.9rem;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.86rem;
    color: #1f6bb8;
    background: rgba(44, 137, 217, 0.14);
    border: 1px solid rgba(44, 137, 217, 0.3);
}

.admin-notify-item.is-task_request .admin-notify-item-icon {
    color: #2b78cb;
    background: rgba(43, 120, 203, 0.14);
    border-color: rgba(43, 120, 203, 0.28);
}

.admin-notify-item.is-deposit .admin-notify-item-icon {
    color: #1f8a66;
    background: rgba(31, 138, 102, 0.14);
    border-color: rgba(31, 138, 102, 0.28);
}

.admin-notify-item.is-withdrawal .admin-notify-item-icon {
    color: #ac7036;
    background: rgba(172, 112, 54, 0.14);
    border-color: rgba(172, 112, 54, 0.28);
}

.admin-notify-item.is-order .admin-notify-item-icon {
    color: #5d68c0;
    background: rgba(93, 104, 192, 0.14);
    border-color: rgba(93, 104, 192, 0.28);
}

.admin-notify-item-body {
    min-width: 0;
    flex: 1 1 auto;
    display: inline-flex;
    flex-direction: column;
    gap: 0.12rem;
}

.admin-notify-item-head {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    min-width: 0;
}

.admin-notify-item strong {
    font-size: 0.75rem;
    line-height: 1.2;
    font-weight: 700;
}

.admin-notify-item-time {
    font-size: 0.67rem;
    line-height: 1.2;
    color: var(--text-muted);
    white-space: nowrap;
}

.admin-notify-item-name {
    font-size: 0.72rem;
    line-height: 1.25;
    font-weight: 600;
    color: var(--text-main);
}

.admin-notify-item-phone {
    font-weight: 500;
    color: var(--text-muted);
}

.admin-notify-item-summary {
    font-size: 0.68rem;
    line-height: 1.28;
    color: var(--text-muted);
}

.admin-notify-item-amount {
    margin-top: 0.08rem;
    font-size: 0.69rem;
    line-height: 1.2;
    color: #1f8a66;
    font-weight: 700;
}

.admin-notify-empty {
    padding: 0.88rem;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.78rem;
}

.admin-notify-footer {
    display: block;
    text-align: center;
    text-decoration: none;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--primary);
    padding: 0.62rem 0.8rem;
    background: rgba(109, 74, 230, 0.08);
}

#adminRealtimeToastHost {
    pointer-events: none;
}

#adminRealtimeToastHost .toast {
    pointer-events: auto;
}

.admin-realtime-toast {
    width: min(360px, calc(100vw - 1.2rem));
    border-radius: 14px;
    color: #eef6ff;
    background: linear-gradient(135deg, #1f6be3, #2488f0);
    box-shadow: 0 14px 32px rgba(9, 45, 96, 0.34);
}

.admin-realtime-toast.is-task_request {
    background: linear-gradient(135deg, #2667d4, #2e86ea);
}

.admin-realtime-toast.is-deposit {
    background: linear-gradient(135deg, #167c66, #1ca37b);
}

.admin-realtime-toast.is-withdrawal {
    background: linear-gradient(135deg, #9e5a23, #c87833);
}

.admin-realtime-toast.is-order {
    background: linear-gradient(135deg, #535fc7, #6e7be2);
}

.admin-realtime-toast-body {
    font-size: 0.82rem;
    line-height: 1.3;
    padding-right: 0.45rem;
}

.admin-realtime-toast-title {
    font-weight: 700;
    font-size: 0.8rem;
    line-height: 1.2;
}

.admin-realtime-toast-text {
    margin-top: 0.18rem;
    font-weight: 600;
}

.admin-realtime-toast-meta {
    margin-top: 0.18rem;
    font-weight: 700;
    color: #d9f9ed;
}

.admin-realtime-toast-open {
    margin: 0.55rem 0 0.55rem auto;
    padding: 0.36rem 0.74rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.admin-realtime-toast-open:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.24);
}

.admin-realtime-toast-close {
    margin: 0.58rem 0.52rem 0 0.38rem;
    opacity: 0.78;
}

.admin-realtime-toast-close:hover {
    opacity: 1;
}

.task-action-stack {
    min-width: 520px;
    display: inline-flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
}

.task-action-form {
    border-radius: 12px;
    padding: 0.55rem;
    background: rgba(255, 255, 255, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.58);
}

.task-action-grid {
    display: grid;
    grid-template-columns: minmax(190px, 1.2fr) minmax(170px, 1fr) minmax(120px, 0.8fr) minmax(120px, 0.8fr) auto;
    gap: 0.45rem;
    align-items: end;
}

.task-action-grid-reject {
    grid-template-columns: minmax(280px, 1fr) auto;
}

.task-action-field {
    min-width: 0;
}

.task-action-label {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 0.28rem;
    color: var(--text-muted);
}

.task-action-btn {
    min-width: 90px;
}

.task-product-preview {
    width: 100%;
    margin-top: 0.45rem;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.25rem 0.4rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.74);
}

.task-product-preview .thumb-48 {
    width: 34px;
    height: 34px;
    border-radius: 8px;
}

.task-product-preview-text {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.admin-main {
    display: block;
    position: relative;
    z-index: 1;
}

.admin-chart-wrap {
    position: relative;
    width: 100%;
    min-height: 240px;
    height: clamp(240px, 36vh, 360px);
    overflow: hidden;
}

.admin-chart-wrap canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 0.78rem;
    padding: 1rem;
}

.kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    color: var(--primary);
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(255, 255, 255, 0.74);
}

.activity-feed {
    max-height: 420px;
    overflow-y: auto;
}

.activity-item {
    padding: 0.78rem 0;
    border-bottom: 1px dashed rgba(95, 125, 120, 0.24);
}

.activity-item:last-child {
    border-bottom: none;
}

.tab-pills .nav-link {
    border-radius: 999px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.42);
    margin-right: 0.4rem;
}

.tab-pills .nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.52rem;
    max-height: 220px;
    overflow-y: auto;
}

@media (max-width: 1199.98px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: fixed;
        left: 0.75rem;
        top: 0.75rem;
        bottom: 0.75rem;
        z-index: 1052;
        width: min(280px, calc(100vw - 1.5rem));
        transform: translateX(-120%);
        transition: transform 0.3s ease;
    }

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

    .task-action-stack {
        min-width: 100%;
    }

    .task-action-grid,
    .task-action-grid-reject {
        grid-template-columns: 1fr;
    }

    .task-action-btn {
        width: 100%;
    }
}

html[data-theme="dark"] .sidebar-link:hover {
    background: rgba(20, 31, 35, 0.86);
}

html[data-theme="dark"] .sidebar-link.logout {
    background: rgba(215, 103, 127, 0.16);
}

html[data-theme="dark"] .admin-user-chip,
html[data-theme="dark"] .kpi-icon,
html[data-theme="dark"] .tab-pills .nav-link {
    background: rgba(20, 31, 35, 0.82);
    border-color: rgba(168, 150, 224, 0.24);
}

html[data-theme="dark"] .activity-item {
    border-bottom-color: rgba(168, 150, 224, 0.2);
}

html[data-theme="dark"] .admin-notify-menu {
    border-color: rgba(168, 150, 224, 0.24);
    background: rgba(18, 30, 34, 0.95);
    box-shadow: 0 18px 36px rgba(1, 8, 10, 0.55);
}

html[data-theme="dark"] .admin-notify-header {
    border-bottom-color: rgba(168, 150, 224, 0.2);
}

html[data-theme="dark"] .admin-notify-item {
    border-bottom-color: rgba(168, 150, 224, 0.17);
}

html[data-theme="dark"] .admin-notify-item:hover {
    background: rgba(139, 111, 242, 0.15);
}

html[data-theme="dark"] .admin-notify-item-time,
html[data-theme="dark"] .admin-notify-item-phone,
html[data-theme="dark"] .admin-notify-item-summary,
html[data-theme="dark"] .admin-notify-empty,
html[data-theme="dark"] .task-product-preview-text {
    color: #9db9b5;
}

html[data-theme="dark"] .admin-notify-header-total {
    background: linear-gradient(135deg, #2a7af0, #289bd6);
}

html[data-theme="dark"] .admin-notify-item-name {
    color: #d9efe9;
}

html[data-theme="dark"] .admin-notify-item-amount {
    color: #83ddb9;
}

html[data-theme="dark"] .admin-notify-item-icon {
    background: rgba(33, 69, 78, 0.56);
    border-color: rgba(168, 214, 205, 0.22);
    color: #9cd9cb;
}

html[data-theme="dark"] .task-action-form {
    background: rgba(20, 31, 35, 0.68);
    border-color: rgba(168, 150, 224, 0.24);
}

html[data-theme="dark"] .admin-notify-footer,
html[data-theme="dark"] .task-product-preview {
    background: rgba(20, 31, 35, 0.8);
    border-color: rgba(168, 150, 224, 0.2);
}

html[data-theme="dark"] .admin-realtime-toast {
    background: linear-gradient(135deg, #1b5cd8, #286bcf);
    box-shadow: 0 16px 34px rgba(2, 9, 11, 0.5);
}

html[data-theme="dark"] .admin-realtime-toast.is-task_request {
    background: linear-gradient(135deg, #2358b8, #2b78d6);
}

html[data-theme="dark"] .admin-realtime-toast.is-deposit {
    background: linear-gradient(135deg, #17664f, #1e8c66);
}

html[data-theme="dark"] .admin-realtime-toast.is-withdrawal {
    background: linear-gradient(135deg, #865221, #aa6a2d);
}

html[data-theme="dark"] .admin-realtime-toast.is-order {
    background: linear-gradient(135deg, #4c57af, #6371ce);
}

/* ==========================================================================
   Admin console — professional refinements + performance
   Appended last so it wins the cascade. CSS-only, no markup changes.
   Goal: crisper "enterprise" look and smoother scrolling by making the
   always-visible surfaces more solid (cheaper backdrop-filter) and by
   removing motion that repaints large blurred areas.
   ========================================================================== */

/* Solid, crisp chrome. Higher opacity + lighter blur = far cheaper to
   repaint while a long table scrolls behind the sticky sidebar. */
.admin-sidebar,
.admin-topbar {
    background: rgba(255, 255, 255, 0.86);
    border-color: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px) saturate(1.05);
    -webkit-backdrop-filter: blur(10px) saturate(1.05);
}

.admin-content .glass-card,
.admin-content .glass-panel {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Dashboards shouldn't bounce. Replace the lift with a calm, cheap
   border/shadow change — reads as more professional and avoids repainting
   the card's blurred backdrop on every hover. */
.admin-content .glass-card:hover {
    transform: none;
    box-shadow: 0 12px 28px rgba(46, 33, 90, 0.14);
    border-color: rgba(109, 74, 230, 0.28);
}

/* Sidebar: specific transitions (not `all`) and a firmer active state. */
.sidebar-link {
    transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
    letter-spacing: 0.005em;
}

.sidebar-link.active {
    box-shadow: 0 8px 20px rgba(109, 74, 230, 0.28);
}

.sidebar-link i {
    font-size: 1.02rem;
    width: 1.15rem;
    text-align: center;
}

.brand-pill {
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.82rem;
}

.admin-topbar h1 {
    letter-spacing: -0.01em;
}

/* KPI numbers — tabular figures keep dashboards aligned and legible. */
.kpi-card strong,
.metric-box strong,
.table-glass td {
    font-variant-numeric: tabular-nums;
}

/* Professional, unobtrusive scrollbars on the scrolling regions. */
.sidebar-scroll,
.activity-feed,
.admin-notify-list,
.permission-grid,
.list-feed {
    scrollbar-width: thin;
    scrollbar-color: rgba(109, 74, 230, 0.4) transparent;
}

.sidebar-scroll::-webkit-scrollbar,
.activity-feed::-webkit-scrollbar,
.admin-notify-list::-webkit-scrollbar,
.permission-grid::-webkit-scrollbar,
.list-feed::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.sidebar-scroll::-webkit-scrollbar-thumb,
.activity-feed::-webkit-scrollbar-thumb,
.admin-notify-list::-webkit-scrollbar-thumb,
.permission-grid::-webkit-scrollbar-thumb,
.list-feed::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(109, 74, 230, 0.32);
    border-radius: 999px;
}

.sidebar-scroll::-webkit-scrollbar-thumb:hover,
.activity-feed::-webkit-scrollbar-thumb:hover,
.admin-notify-list::-webkit-scrollbar-thumb:hover {
    background: rgba(109, 74, 230, 0.5);
}

/* Cohesive violet dark surfaces (replaces leftover teal-tinted darks). */
html[data-theme="dark"] .admin-sidebar,
html[data-theme="dark"] .admin-topbar {
    background: rgba(22, 18, 40, 0.9);
    border-color: rgba(168, 150, 224, 0.16);
    backdrop-filter: blur(10px) saturate(1.05);
    -webkit-backdrop-filter: blur(10px) saturate(1.05);
}

html[data-theme="dark"] .sidebar-link:hover {
    background: rgba(30, 24, 52, 0.86);
}

html[data-theme="dark"] .admin-user-chip,
html[data-theme="dark"] .kpi-icon,
html[data-theme="dark"] .tab-pills .nav-link {
    background: rgba(26, 21, 45, 0.82);
}

html[data-theme="dark"] .admin-notify-menu {
    background: rgba(24, 20, 42, 0.96);
    box-shadow: 0 18px 36px rgba(4, 2, 12, 0.6);
}

/* --- Receipt viewer (floating, no new tab) ------------------------------ */

.receipt-viewer {
    position: fixed;
    inset: 0;
    /* Above the sidebar (1400) and the mobile sidebar overlay (1052). */
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: clamp(12px, 3vw, 32px);
}

.receipt-viewer[hidden] {
    display: none !important;
}

.receipt-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 6, 20, 0.72);
    backdrop-filter: blur(3px);
}

body.receipt-viewer-open {
    overflow: hidden;
}

.receipt-viewer-box {
    position: relative;
    margin: 0;
    display: flex;
    flex-direction: column;
    width: min(760px, 100%);
    max-height: min(88vh, 900px);
    border-radius: 18px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid rgba(109, 74, 230, 0.2);
    box-shadow: 0 32px 70px rgba(6, 4, 20, 0.45);
    animation: receipt-pop 0.18s ease-out;
}

@keyframes receipt-pop {
    from { opacity: 0; transform: translateY(10px) scale(0.985); }
    to { opacity: 1; transform: none; }
}

.receipt-viewer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid rgba(109, 74, 230, 0.16);
    background: rgba(109, 74, 230, 0.06);
}

.receipt-viewer-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #2e3c46;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.receipt-viewer-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.receipt-viewer-body {
    flex: 1;
    min-height: 0;
    display: grid;
    place-items: center;
    padding: 0.75rem;
    background: #f4f4f8;
    overflow: auto;
}

.receipt-viewer-body img {
    max-width: 100%;
    max-height: 76vh;
    border-radius: 10px;
    object-fit: contain;
}

.receipt-viewer-body iframe {
    width: 100%;
    height: 74vh;
    border: 0;
    border-radius: 10px;
    background: #fff;
}

.receipt-viewer-error {
    padding: 2.5rem 1rem;
    font-size: 0.86rem;
    color: #8a6d3b;
}

html[data-theme="dark"] .receipt-viewer-box {
    background: #171528;
    border-color: rgba(168, 150, 224, 0.24);
}

html[data-theme="dark"] .receipt-viewer-head {
    background: rgba(168, 150, 224, 0.08);
    border-bottom-color: rgba(168, 150, 224, 0.2);
}

html[data-theme="dark"] .receipt-viewer-title {
    color: #e6e2f7;
}

html[data-theme="dark"] .receipt-viewer-body {
    background: #100e1d;
}

/* --- Dashboard: data scope, KPI movement, trend chart ------------------- */

.scope-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.34rem 0.72rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
    white-space: nowrap;
}

.scope-badge.scope-global {
    color: #6d4ae6;
    background: rgba(109, 74, 230, 0.12);
    border-color: rgba(109, 74, 230, 0.28);
}

.scope-badge.scope-own {
    color: #1f8a70;
    background: rgba(31, 138, 112, 0.12);
    border-color: rgba(31, 138, 112, 0.28);
}

.kpi-card-pro {
    position: relative;
    align-items: flex-start;
    padding: 1.05rem 1.1rem;
    border-radius: 18px;
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

/* Thin gradient rail along the top edge — reads as "modern dashboard" without
   adding another border or colour block to the card. */
.kpi-card-pro::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, #6d4ae6, #a78bfa 55%, rgba(167, 139, 250, 0));
    opacity: 0.85;
}

.kpi-card-pro:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 34px rgba(24, 16, 60, 0.18);
}

.kpi-card-pro .kpi-icon {
    background: linear-gradient(145deg, rgba(109, 74, 230, 0.16), rgba(109, 74, 230, 0.04));
    border-color: rgba(109, 74, 230, 0.22);
    color: #6d4ae6;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

html[data-theme="dark"] .kpi-card-pro:hover {
    box-shadow: 0 16px 34px rgba(2, 4, 14, 0.5);
}

html[data-theme="dark"] .kpi-card-pro .kpi-icon {
    background: linear-gradient(145deg, rgba(167, 139, 250, 0.2), rgba(167, 139, 250, 0.05));
    border-color: rgba(167, 139, 250, 0.26);
    color: #c4b5fd;
}

.kpi-card-pro .kpi-body {
    min-width: 0;
}

.kpi-card-pro .kpi-body small {
    display: block;
    font-size: 0.76rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    opacity: 0.72;
}

.kpi-card-pro .kpi-count {
    margin-top: 0.15rem;
    font-size: clamp(1.15rem, 1.9vw, 1.45rem);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.015em;
    word-break: break-word;
}

.kpi-delta {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    margin-top: 0.35rem;
    font-size: 0.74rem;
    font-weight: 600;
    opacity: 0.9;
}

.kpi-delta.up { color: #1f8a70; }
.kpi-delta.down { color: #d9534f; }
.kpi-delta.flat { color: rgba(120, 130, 140, 0.9); font-weight: 500; }

.chart-legend {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    opacity: 0.82;
}

.legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.legend-dot.deposits { background: #6d4ae6; }
.legend-dot.withdrawals { background: #ec7063; }

.chart-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 14px;
    background: rgba(109, 74, 230, 0.05);
    border: 1px solid rgba(109, 74, 230, 0.12);
}

.chart-summary-item small {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.68;
}

.chart-summary-item strong {
    font-size: 0.94rem;
    font-variant-numeric: tabular-nums;
}

.chart-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    opacity: 0.6;
    pointer-events: none;
}

html[data-theme="dark"] .chart-summary {
    background: rgba(168, 150, 224, 0.07);
    border-color: rgba(168, 150, 224, 0.18);
}

html[data-theme="dark"] .scope-badge.scope-own {
    color: #52d0ac;
    background: rgba(82, 208, 172, 0.12);
    border-color: rgba(82, 208, 172, 0.26);
}

html[data-theme="dark"] .scope-badge.scope-global {
    color: #b39cff;
    background: rgba(179, 156, 255, 0.12);
    border-color: rgba(179, 156, 255, 0.26);
}

html[data-theme="dark"] .kpi-delta.up { color: #52d0ac; }
html[data-theme="dark"] .kpi-delta.down { color: #ff8a80; }

/* Respect reduced-motion: kill the load stagger and shimmer for users who
   ask for it — also the cheapest possible "no lag" path on weak hardware. */
@media (prefers-reduced-motion: reduce) {
    .admin-content .fade-in,
    .admin-content .skeleton::after {
        animation: none !important;
    }

    * {
        transition-duration: 0.001ms !important;
    }
}
