/* ==========================================================================
   Pishkhan (پیشخوان) Office Panel - Editorial Design System ("The Digital Curator")
   No-Line Rule | Breathing Room | Tonal Layering
   ========================================================================== */

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: #f7f9fb;
    color: #2a3439;
}

h1, h2, h3, h4, h5, h6,
.font-headline {
    font-family: 'Vazirmatn', sans-serif;
}

.mud-popover {
    z-index: 1400 !important;
}

/* --------------------------------------------------------------------------
   Login Page
   -------------------------------------------------------------------------- */

.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #f7f9fb;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 44px 36px;
    background: #ffffff;
    border-radius: 0.75rem;
    border: none;
    box-shadow: 0 8px 24px rgba(42, 52, 57, 0.06);
}

.login-card-header {
    display: flex;
    align-items: center;
    margin-bottom: 36px;
}

.login-form {
    margin-bottom: 8px;
}

.login-button {
    height: 48px !important;
    border-radius: 9999px !important;
    font-size: 0.925rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.01em !important;
    text-transform: none !important;
    background: linear-gradient(135deg, #0053db, #0048c1) !important;
    box-shadow: 0 8px 24px rgba(0, 83, 219, 0.15) !important;
    transition: all 0.2s ease !important;
}

.login-button:hover {
    box-shadow: 0 8px 24px rgba(0, 83, 219, 0.25) !important;
    transform: translateY(-1px);
}

@media (max-width: 480px) {
    .login-card {
        margin: 16px;
        padding: 32px 24px;
    }
}

/* --------------------------------------------------------------------------
   Main Layout - AppBar (Editorial: clean, glass, no heavy borders)
   -------------------------------------------------------------------------- */

/* The glass blur lives on a ::before pseudo-element rather than the appbar
   itself: backdrop-filter makes the element the containing block for
   fixed-position descendants, which trapped the user menu's click-away
   overlay inside the bar so the menu never closed on outside clicks. */
.main-appbar {
    background: rgba(255, 255, 255, 0.80) !important;
    color: #2a3439 !important;
    border-bottom: none !important;
    box-shadow: none !important;
}

.main-appbar::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.main-appbar .mud-appbar-toolbar {
    padding: 0 2rem !important;
}

/* Breadcrumb */
.appbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 16px;
    font-size: 0.875rem;
    font-weight: 500;
}

.breadcrumb-parent {
    color: #a9b4b9;
}

.breadcrumb-sep {
    color: #a9b4b9;
}

.breadcrumb-current {
    color: #2a3439;
    font-weight: 700;
}

/* AppBar icon buttons */
.appbar-icon-btn {
    color: #717c82 !important;
    border-radius: 0.75rem !important;
    transition: color 0.15s ease !important;
}

.appbar-icon-btn:hover {
    color: #0053db !important;
    background: transparent !important;
}

/* AppBar notifications menu — wallet low-balance alerts wrap onto two lines,
   so the list needs a width cap and room to scroll rather than one long row. */
.appbar-notif-menu {
    max-width: 360px;
    max-height: 420px;
    overflow-y: auto;
}

.appbar-notif-menu .mud-menu-item {
    white-space: normal;
}

/* AppBar search button - visually emphasized */
.appbar-search-btn {
    margin-right: 4px !important;
    background: #f0f4f7 !important;
}

.appbar-search-btn:hover {
    background: #e5ecf1 !important;
    color: #0053db !important;
}

/* User menu */
.user-menu-btn {
    text-transform: none !important;
    padding: 6px 12px !important;
    border-radius: 0.75rem !important;
}

.user-menu-btn:hover {
    background: #f0f4f7 !important;
}

.user-avatar {
    background: linear-gradient(135deg, #0053db, #0048c1) !important;
    color: #fff !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    width: 36px !important;
    height: 36px !important;
}

.user-menu-name {
    font-weight: 700 !important;
    font-size: 0.825rem !important;
    color: #2a3439 !important;
}

.user-menu-role {
    font-size: 0.68rem !important;
    color: #717c82 !important;
}

/* Phone widths: the full bar (breadcrumb, wallet chip, top-up, search,
   notifications, user name) is wider than the screen, so keep only the
   current page title and show the user as an avatar. */
@media (max-width: 600px) {
    .main-appbar .mud-appbar-toolbar {
        padding: 0 8px !important;
        gap: 2px;
    }

    .appbar-breadcrumb {
        margin: 0 4px;
        min-width: 0;
        overflow: hidden;
    }

    .breadcrumb-parent,
    .breadcrumb-sep {
        display: none;
    }

    .breadcrumb-current {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .appbar-search-btn {
        margin-right: 0 !important;
        padding: 6px !important;
    }

    .appbar-search-btn .mud-icon-root {
        font-size: 1.35rem !important;
    }

    .user-menu-btn {
        min-width: 0 !important;
        padding: 4px !important;
    }

    .user-menu-btn .user-menu-name,
    .user-menu-btn .user-menu-role,
    .user-menu-btn .flex-column {
        display: none !important;
    }
}

/* --------------------------------------------------------------------------
   Main Layout - Sidebar (Editorial: light, airy, no dark background)
   Uses surface-container-low (#f0f4f7) instead of dark navy
   -------------------------------------------------------------------------- */

.sidebar-drawer .mud-drawer-content {
    background: #f0f4f7 !important;
    display: flex;
    flex-direction: column;
    padding-top: 0 !important;
    margin-top: 0 !important;
    overflow-x: hidden !important;
}

.sidebar-drawer .mud-drawer-header {
    display: none !important;
}

.sidebar-drawer .mud-appbar-fixed-adjust {
    display: none !important;
}

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    margin-bottom: 4px;
}

.sidebar-brand-text {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1.2rem;
    font-weight: 800;
    color: #2a3439;
    letter-spacing: -0.03em;
}

/* Sidebar nav - prevent horizontal scroll */
.sidebar-nav {
    overflow-x: hidden !important;
    padding: 0 8px !important;
}

/* ── Top-level nav link (Dashboard) ── */
.sidebar-nav > .mud-nav-link {
    color: #566166 !important;
    border-radius: 0.75rem !important;
    margin: 2px 4px !important;
    padding: 10px 14px !important;
    transition: all 0.15s ease !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
}

.sidebar-nav > .mud-nav-link:hover {
    color: #2a3439 !important;
    background: #e1e9ee !important;
}

.sidebar-nav > .mud-nav-link.active {
    color: #0053db !important;
    background: #d9e4ea !important;
    font-weight: 600 !important;
}

.sidebar-nav > .mud-nav-link .mud-nav-link-icon {
    color: #566166 !important;
    font-size: 1.2rem !important;
}

.sidebar-nav > .mud-nav-link.active .mud-nav-link-icon {
    color: #0053db !important;
}

/* ── Parent group header (sections) ── */
.sidebar-nav > .mud-nav-group > .mud-nav-group-header {
    color: #566166 !important;
    border-radius: 0.75rem !important;
    margin: 2px 4px !important;
    padding: 10px 14px !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    letter-spacing: 0 !important;
    transition: all 0.15s ease !important;
}

.sidebar-nav > .mud-nav-group > .mud-nav-group-header:hover {
    color: #2a3439 !important;
    background: #e1e9ee !important;
}

.sidebar-nav > .mud-nav-group > .mud-nav-group-header .mud-nav-link-icon {
    color: #566166 !important;
    font-size: 1.2rem !important;
}

.sidebar-nav > .mud-nav-group > .mud-nav-group-header .mud-nav-link-expand-icon {
    color: #a9b4b9 !important;
    transition: transform 0.2s ease !important;
}

/* ── Child items container ── */
.sidebar-nav > .mud-nav-group > .mud-collapse-container .mud-navmenu-list {
    padding: 2px 0 4px 0 !important;
    margin: 0 4px 0 20px !important;
    border-left: none !important;
}

/* ── Child items ── */
.sidebar-nav .mud-nav-group .mud-nav-link {
    color: #717c82 !important;
    border-radius: 0.75rem !important;
    margin: 1px 4px !important;
    padding: 8px 14px !important;
    transition: all 0.15s ease !important;
    font-size: 0.8rem !important;
    font-weight: 400 !important;
}

.sidebar-nav .mud-nav-group .mud-nav-link:hover {
    color: #2a3439 !important;
    background: #e1e9ee !important;
}

.sidebar-nav .mud-nav-group .mud-nav-link.active {
    color: #0053db !important;
    background: #d9e4ea !important;
    font-weight: 500 !important;
}

.sidebar-nav .mud-nav-group .mud-nav-link .mud-nav-link-icon {
    color: inherit !important;
    font-size: 1rem !important;
    min-width: 28px !important;
}

/* ── Nested nav group (e.g. Blog inside Website) ── */
.sidebar-nav .mud-nav-group .mud-nav-group .mud-nav-group-header {
    color: #717c82 !important;
    font-size: 0.8rem !important;
    font-weight: 500 !important;
    padding: 8px 14px !important;
    margin: 1px 4px !important;
    border-radius: 0.75rem !important;
}

.sidebar-nav .mud-nav-group .mud-nav-group .mud-nav-group-header:hover {
    color: #2a3439 !important;
    background: #e1e9ee !important;
}

.sidebar-nav .mud-nav-group .mud-nav-group .mud-nav-group-header .mud-nav-link-icon {
    color: inherit !important;
    font-size: 1rem !important;
    min-width: 28px !important;
}

.sidebar-nav .mud-nav-group .mud-nav-group > .mud-collapse-container .mud-navmenu-list {
    padding: 2px 0 !important;
    margin: 0 0 0 14px !important;
    border-left: none !important;
}

/* ── Sidebar drill-down navigation ── */

/* Slide animations */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sidebar-slide {
    animation-duration: 0.25s;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
    animation-fill-mode: both;
}

.sidebar-slide.slide-in-right {
    animation-name: slideInRight;
}

.sidebar-slide.slide-in-left {
    animation-name: slideInLeft;
}

.sidebar-slide-header {
    animation: slideInRight 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Stagger child items for a cascading effect */
.sidebar-slide .mud-nav-link:nth-child(1) { animation-delay: 0.03s; }
.sidebar-slide .mud-nav-link:nth-child(2) { animation-delay: 0.06s; }
.sidebar-slide .mud-nav-link:nth-child(3) { animation-delay: 0.09s; }
.sidebar-slide .mud-nav-link:nth-child(4) { animation-delay: 0.12s; }
.sidebar-slide .mud-nav-link:nth-child(5) { animation-delay: 0.15s; }
.sidebar-slide .mud-nav-link:nth-child(6) { animation-delay: 0.18s; }
.sidebar-slide .mud-nav-link:nth-child(7) { animation-delay: 0.21s; }
.sidebar-slide .mud-nav-link:nth-child(8) { animation-delay: 0.24s; }
.sidebar-slide .mud-nav-link:nth-child(9) { animation-delay: 0.27s; }
.sidebar-slide .mud-nav-link:nth-child(10) { animation-delay: 0.30s; }
.sidebar-slide .mud-nav-link:nth-child(11) { animation-delay: 0.33s; }

.sidebar-slide .mud-nav-link {
    opacity: 0;
    animation: inherit;
    animation-duration: 0.25s;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
    animation-fill-mode: both;
}

.sidebar-slide.slide-in-right .mud-nav-link {
    animation-name: slideInRight;
}

.sidebar-slide.slide-in-left .mud-nav-link {
    animation-name: slideInLeft;
}

/* Submenu left padding to visually indent from level 1 */
.sidebar-submenu {
    padding-left: 10px;
}

.sidebar-pinned-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin: 0 12px 8px;
    background: #e1e9ee;
    border-radius: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 1;
}

.sidebar-back-btn {
    color: #566166 !important;
    min-width: 32px !important;
    width: 32px !important;
    height: 32px !important;
    transition: all 0.15s ease !important;
}

.sidebar-back-btn:hover {
    background: rgba(0, 83, 219, 0.08) !important;
    color: #0053db !important;
}

.sidebar-pinned-icon {
    color: #0053db !important;
    font-size: 1.15rem !important;
}

.sidebar-pinned-title {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: #2a3439;
    letter-spacing: -0.01em;
}

.sidebar-drillable {
    position: relative;
}

.sidebar-drillable .sidebar-drill-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem !important;
    color: #a9b4b9 !important;
    transition: color 0.15s ease, transform 0.15s ease;
}

.sidebar-drillable:hover .sidebar-drill-arrow {
    color: #0053db !important;
    transform: translateY(-50%) translateX(2px);
}

/* Dark mode drill-down */
.mud-theme-dark .sidebar-pinned-header {
    background: #1a2027;
}

.mud-theme-dark .sidebar-pinned-title {
    color: #d9e4ea;
}

.mud-theme-dark .sidebar-pinned-icon {
    color: #6fa3ff !important;
}

.mud-theme-dark .sidebar-back-btn {
    color: #a9b4b9 !important;
}

.mud-theme-dark .sidebar-back-btn:hover {
    background: rgba(111, 163, 255, 0.1) !important;
    color: #6fa3ff !important;
}

.mud-theme-dark .sidebar-drillable .sidebar-drill-arrow {
    color: #566166 !important;
}

.mud-theme-dark .sidebar-drillable:hover .sidebar-drill-arrow {
    color: #6fa3ff !important;
}

/* ── Sidebar user info at bottom ── */
.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    margin-top: auto;
    background: #e8eff3;
    border-radius: 0.75rem;
    margin: 8px 12px 12px;
}

/* Pop-out menu wraps the bottom user card. Strip MudMenu's default button styling so
   the activator looks like the rest of the sidebar card and the click target spans the
   full pill width. */
.sidebar-user-menu .mud-menu-activator > .mud-button-root {
    width: calc(100% - 24px);
    margin: 8px 12px 12px;
    padding: 0 !important;
    background: transparent !important;
    text-transform: none !important;
    min-width: 0 !important;
}

.sidebar-user-info--clickable {
    margin: 0 !important;
    width: 100%;
    cursor: pointer;
    transition: background 0.15s ease;
}

.sidebar-user-info--clickable:hover {
    background: #dde6ec;
}

.sidebar-user-avatar {
    background: linear-gradient(135deg, #0053db, #0048c1) !important;
    color: #fff !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
}

.sidebar-user-details {
    overflow: hidden;
}

.sidebar-user-name {
    color: #2a3439 !important;
    font-weight: 600 !important;
    font-size: 0.8rem !important;
}

.sidebar-user-email {
    color: #717c82 !important;
    font-size: 0.68rem !important;
}

/* --------------------------------------------------------------------------
   Dashboard Stat Cards (Editorial: borderless, tonal lift, no borders)
   -------------------------------------------------------------------------- */

.stat-card {
    padding: 28px !important;
    border-radius: 0.75rem !important;
    border: none !important;
    background: #ffffff !important;
    box-shadow: 0 8px 24px rgba(42, 52, 57, 0.06) !important;
    transition: all 0.2s ease !important;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(42, 52, 57, 0.09) !important;
}

.stat-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.stat-card-icon.primary { background: #dbe1ff; }
.stat-card-icon.primary .mud-icon-root { color: #0053db !important; }
.stat-card-icon.secondary { background: #d5e3fc; }
.stat-card-icon.secondary .mud-icon-root { color: #526074 !important; }
.stat-card-icon.success { background: rgba(0, 101, 146, 0.1); }
.stat-card-icon.success .mud-icon-root { color: #006592 !important; }
.stat-card-icon.warning { background: rgba(245, 158, 11, 0.1); }
.stat-card-icon.warning .mud-icon-root { color: #F59E0B !important; }

/* --------------------------------------------------------------------------
   Main Content Area (Editorial: breathing room, surface background)
   -------------------------------------------------------------------------- */

.main-content-area {
    background: #f7f9fb !important;
    min-height: 100vh;
}

/* --------------------------------------------------------------------------
   MudBlazor Component Overrides (Editorial Style)
   -------------------------------------------------------------------------- */

/* Paper - no borders, use tonal lift */
.mud-paper {
    border: none !important;
    box-shadow: 0 8px 24px rgba(42, 52, 57, 0.06) !important;
    border-radius: 0.75rem !important;
}

.mud-paper.mud-elevation-0 {
    box-shadow: none !important;
}

/* Tables - Clean Sheet Pattern */
.mud-table {
    border: none !important;
    border-radius: 0.75rem !important;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(42, 52, 57, 0.06) !important;
}

.mud-table .mud-table-head .mud-table-row .mud-table-cell {
    background: #f0f4f7 !important;
    border-bottom: none !important;
    font-size: 0.6875rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    color: #717c82 !important;
    padding: 14px 20px !important;
}

.mud-table .mud-table-body .mud-table-row .mud-table-cell {
    border-bottom: none !important;
    padding: 16px 20px !important;
    font-size: 0.8125rem !important;
    color: #2a3439 !important;
}

.mud-table .mud-table-body .mud-table-row {
    transition: background 0.15s ease !important;
}

.mud-table .mud-table-body .mud-table-row:hover {
    background: #f0f4f7 !important;
}

/* Buttons - Editorial Primary (gradient, rounded) */
.mud-button-filled.mud-button-primary {
    background: linear-gradient(135deg, #0053db, #0048c1) !important;
    border-radius: 9999px !important;
    box-shadow: none !important;
    font-weight: 600 !important;
    padding: 8px 24px !important;
}

.mud-button-filled.mud-button-primary:hover {
    box-shadow: 0 4px 16px rgba(0, 83, 219, 0.2) !important;
}

/* Outlined buttons */
.mud-button-outlined {
    border-radius: 9999px !important;
    border-color: #e1e9ee !important;
}

/* Text buttons */
.mud-button-text {
    border-radius: 0.75rem !important;
}

/* Chips - full roundedness */
.mud-chip {
    border-radius: 9999px !important;
    font-size: 0.6875rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.03em !important;
}

/* Dialogs - glassmorphism */
.mud-dialog {
    border-radius: 0.75rem !important;
    box-shadow: 0 8px 24px rgba(42, 52, 57, 0.06) !important;
    border: none !important;
}

/* Input fields - Editorial style */
.mud-input-outlined .mud-input-outlined-border {
    border-color: rgba(113, 124, 130, 0.1) !important;
    border-radius: 0.75rem !important;
}

.mud-input-outlined:hover .mud-input-outlined-border {
    border-color: rgba(113, 124, 130, 0.2) !important;
}

.mud-input-outlined.mud-input-focused .mud-input-outlined-border {
    border-color: rgba(0, 83, 219, 0.2) !important;
    box-shadow: 0 0 0 3px rgba(0, 83, 219, 0.06) !important;
}

/* Select */
.mud-select .mud-input-outlined-border {
    border-radius: 0.75rem !important;
}

/* --------------------------------------------------------------------------
   General Transitions
   -------------------------------------------------------------------------- */

.mud-paper,
.mud-button,
.mud-icon-button {
    transition: all 0.15s ease !important;
}

/* --------------------------------------------------------------------------
   Scrollbar (thin, subtle)
   -------------------------------------------------------------------------- */

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #a9b4b9;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #717c82;
}

/* --------------------------------------------------------------------------
   Dark Mode Adjustments
   -------------------------------------------------------------------------- */

.mud-theme-dark .main-appbar {
    background: rgba(26, 32, 37, 0.80) !important;
}

.mud-theme-dark .sidebar-drawer .mud-drawer-content {
    background: #0b0f10 !important;
}

.mud-theme-dark .sidebar-brand-text {
    color: #d9e4ea !important;
}

.mud-theme-dark .sidebar-nav > .mud-nav-link,
.mud-theme-dark .sidebar-nav > .mud-nav-group > .mud-nav-group-header {
    color: #a9b4b9 !important;
}

.mud-theme-dark .sidebar-nav > .mud-nav-link:hover,
.mud-theme-dark .sidebar-nav > .mud-nav-group > .mud-nav-group-header:hover {
    color: #d9e4ea !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

.mud-theme-dark .sidebar-nav > .mud-nav-link.active {
    color: #618bff !important;
    background: rgba(97, 139, 255, 0.12) !important;
}

.mud-theme-dark .sidebar-nav .mud-nav-group .mud-nav-link {
    color: #717c82 !important;
}

.mud-theme-dark .sidebar-nav .mud-nav-group .mud-nav-link:hover {
    color: #d9e4ea !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

.mud-theme-dark .sidebar-nav .mud-nav-group .mud-nav-link.active {
    color: #618bff !important;
    background: rgba(97, 139, 255, 0.12) !important;
}

.mud-theme-dark .sidebar-user-info {
    background: rgba(255, 255, 255, 0.04) !important;
}

.mud-theme-dark .sidebar-user-name {
    color: #d9e4ea !important;
}

.mud-theme-dark .sidebar-user-email {
    color: #717c82 !important;
}

.mud-theme-dark .stat-card {
    background: #1a2025 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2) !important;
}

.mud-theme-dark .login-page {
    background: #0b0f10;
}

.mud-theme-dark .login-card {
    background: #1a2025;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.mud-theme-dark .mud-table .mud-table-head .mud-table-row .mud-table-cell {
    background: #1a2025 !important;
    color: #a9b4b9 !important;
}

.mud-theme-dark .mud-table .mud-table-body .mud-table-row:hover {
    background: rgba(255, 255, 255, 0.03) !important;
}

.mud-theme-dark .breadcrumb-current {
    color: #d9e4ea !important;
}

/* --------------------------------------------------------------------------
   File Gallery
   -------------------------------------------------------------------------- */

.file-card:hover {
    border-color: #0053db !important;
    box-shadow: 0 4px 16px rgba(0, 83, 219, 0.12) !important;
    transform: translateY(-2px);
}

.file-card .file-card-overlay {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.file-card:hover .file-card-overlay {
    opacity: 1;
}

/* --------------------------------------------------------------------------
   Blazor Loading & Error UI
   -------------------------------------------------------------------------- */

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    inset-inline-start: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    inset-inline-end: 0.75rem;
    top: 0.5rem;
}

/* --------------------------------------------------------------------------
   Page Builder - Full Screen Page
   -------------------------------------------------------------------------- */

.pb-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: none;
    position: sticky;
    top: 0;
    z-index: 100;
}

.pb-topbar-divider {
    width: 1px;
    height: 28px;
    background: #e1e9ee;
}

.pb-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.pb-fullscreen-content {
    height: calc(100vh - 53px);
    overflow: hidden;
}

.pb-fullscreen-content .page-builder {
    border: none;
    border-radius: 0;
    height: 100%;
}

.pb-fullscreen-content .page-builder-body {
    max-height: calc(100vh - 53px - 45px);
    height: calc(100vh - 53px - 45px);
}

/* ── Settings Drawer (blog metadata panel) ── */

.pb-settings-drawer {
    width: 340px;
    min-width: 340px;
    background: #ffffff;
    border-left: 1px solid #e8edf0;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 53px);
    overflow: hidden;
}

.pb-settings-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #f0f4f7;
    border-bottom: 1px solid #e8edf0;
    flex-shrink: 0;
}

.pb-settings-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.pb-settings-panels .mud-expand-panel {
    border-radius: 0 !important;
    box-shadow: none !important;
    border-bottom: 1px solid #e8edf0;
}

.pb-settings-panels .mud-expand-panel::before {
    display: none;
}

.pb-settings-panels .mud-expand-panel-header {
    padding: 8px 16px;
    min-height: 40px;
    font-size: 0.85rem;
    font-weight: 600;
}

.pb-settings-panels .mud-expand-panel-content {
    padding: 8px 16px 16px;
}

/* --------------------------------------------------------------------------
   Page Builder - Component
   -------------------------------------------------------------------------- */

.page-builder {
    border: none;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(42, 52, 57, 0.06);
}

.page-builder-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #f0f4f7;
    border-bottom: none;
}

.page-builder-body {
    display: flex;
    min-height: 420px;
    max-height: 65vh;
}

/* ── Sidebar ── */

.page-builder-sidebar {
    width: 260px;
    min-width: 260px;
    background: #ffffff;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-search {
    padding: 10px 12px;
    background: #f0f4f7;
}

.sidebar-section {
    padding: 8px 0;
}

.sidebar-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px 4px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #a9b4b9;
}

.sidebar-component-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    transition: all 0.12s ease;
    border-left: 3px solid transparent;
}

.sidebar-component-card:hover {
    background: rgba(0, 83, 219, 0.04);
    border-left-color: #0053db;
}

.sidebar-component-card:active {
    transform: scale(0.98);
}

.sidebar-component-card.theme-component {
    border-left-color: transparent;
}

.sidebar-component-card.theme-component:hover {
    border-left-color: #0053db;
}

.sidebar-component-icon {
    width: 30px;
    height: 30px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-component-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-component-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #2a3439;
    line-height: 1.2;
}

.sidebar-component-desc {
    font-size: 0.68rem;
    color: #717c82;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-component-add {
    opacity: 0;
    transition: opacity 0.15s ease;
    color: #0053db !important;
}

.sidebar-component-card:hover .sidebar-component-add {
    opacity: 1;
}

/* ── Canvas ── */

.page-builder-canvas {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    background: #f7f9fb;
    padding: 16px;
}

.page-builder-canvas.full-width {
    max-width: 100%;
}

.canvas-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 350px;
    border: 2px dashed #e1e9ee;
    border-radius: 0.75rem;
    padding: 40px;
    text-align: center;
}

.canvas-drop-container {
    height: 100%;
}

.canvas-drop-zone {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 100%;
    padding: 4px;
    border-radius: 0.75rem;
    transition: background 0.2s ease;
}

.canvas-drop-zone.canvas-drop-highlight {
    background: rgba(0, 83, 219, 0.04);
    outline: 2px dashed #0053db;
    outline-offset: -2px;
}

.canvas-block {
    background: #ffffff;
    border: none;
    border-radius: 0.75rem;
    overflow: hidden;
    transition: all 0.15s ease;
    cursor: default;
    box-shadow: 0 2px 8px rgba(42, 52, 57, 0.04);
}

.canvas-block:hover {
    box-shadow: 0 4px 16px rgba(0, 83, 219, 0.08);
}

.canvas-block.selected {
    box-shadow: 0 0 0 2px rgba(0, 83, 219, 0.2);
}

.canvas-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f0f4f7;
    border-bottom: none;
}

.canvas-block-icon {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.canvas-block-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.canvas-block:hover .canvas-block-actions {
    opacity: 1;
}

.canvas-block-preview {
    padding: 10px 14px;
    min-height: 32px;
}

/* ── Block Previews ── */

.block-preview-text {
    font-size: 0.82rem;
    color: #566166;
    line-height: 1.5;
    max-height: 60px;
    overflow: hidden;
}

.block-preview-image {
    display: flex;
    align-items: center;
    gap: 12px;
}

.block-preview-caption {
    font-size: 0.75rem;
    color: #a9b4b9;
    font-style: italic;
}

.block-preview-hero {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(0, 83, 219, 0.04), rgba(0, 101, 146, 0.03));
    border-radius: 0.5rem;
}

.block-preview-hero strong {
    font-size: 0.9rem;
    color: #2a3439;
}

.block-preview-hero span {
    font-size: 0.78rem;
    color: #566166;
}

.block-preview-btn {
    display: inline-block;
    padding: 3px 10px;
    background: linear-gradient(135deg, #0053db, #0048c1);
    color: white !important;
    border-radius: 9999px;
    font-size: 0.72rem !important;
    font-weight: 600;
    width: fit-content;
    margin-top: 4px;
}

.block-preview-code {
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.78rem;
    color: #566166;
    background: #f0f4f7;
    padding: 8px 10px;
    border-radius: 0.5rem;
    max-height: 50px;
    overflow: hidden;
}

.block-preview-spacer {
    text-align: center;
    font-size: 0.75rem;
    color: #a9b4b9;
    padding: 4px;
}

.block-preview-divider {
    border: none;
    border-top: 2px dashed #e1e9ee;
    margin: 4px 0;
}

.block-preview-component {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(0, 83, 219, 0.03);
    border-radius: 0.5rem;
}

.block-preview-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    background: rgba(0, 101, 146, 0.1);
    color: #006592;
    border-radius: 9999px;
}

.block-preview-placeholder {
    font-size: 0.78rem;
    color: #a9b4b9;
    font-style: italic;
    padding: 4px;
}

.block-preview-with-icon {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Component Preview Popover ── */

.component-preview-popover {
    position: fixed;
    z-index: 9999;
    width: 320px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 8px 24px rgba(42, 52, 57, 0.06);
    overflow: hidden;
    animation: previewSlideIn 0.18s ease;
    left: 320px;
    top: 50%;
    transform: translateY(-50%);
}

.pb-fullscreen-content .component-preview-popover {
    left: 280px;
}

@keyframes previewSlideIn {
    from { opacity: 0; transform: translateY(-50%) translateX(-12px) scale(0.96); }
    to { opacity: 1; transform: translateY(-50%) translateX(0) scale(1); }
}

.component-preview-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: #f0f4f7;
    border-bottom: none;
    font-size: 0.75rem;
    font-weight: 600;
    color: #566166;
}

.component-preview-wireframe {
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    min-height: 100px;
}

.component-preview-wireframe svg {
    width: 100%;
    height: auto;
    max-height: 200px;
}

.component-preview-footer {
    padding: 8px 14px;
    text-align: center;
    font-size: 0.7rem;
    color: #a9b4b9;
    background: #f0f4f7;
}

/* ── Dark Mode - Page Builder ── */

.mud-theme-dark .component-preview-wireframe {
    background: #1a2025;
}

.mud-theme-dark .component-preview-popover {
    background: rgba(26, 32, 37, 0.8);
}

.mud-theme-dark .page-builder {
    background: #1a2025;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.mud-theme-dark .canvas-block {
    background: #1a2025;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.mud-theme-dark .canvas-block:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.mud-theme-dark .sidebar-component-card:hover {
    background: rgba(97, 139, 255, 0.08);
}

/* ── Responsive ── */

@media (max-width: 768px) {
    .page-builder-body {
        flex-direction: column;
        max-height: none;
    }

    .page-builder-sidebar {
        width: 100%;
        min-width: 100%;
        max-height: 250px;
        border-right: none;
    }
}

/* ─── Quill Editor inside MudBlazor Dialog ─── */
.mud-dialog .ql-toolbar.ql-snow {
    border-radius: 8px 8px 0 0;
    border-color: var(--mud-palette-divider);
    background: var(--mud-palette-surface);
}
.mud-dialog .ql-container.ql-snow {
    border-radius: 0 0 8px 8px;
    border-color: var(--mud-palette-divider);
    font-size: 0.95rem;
    font-family: 'Vazirmatn', sans-serif;
}
.mud-dialog .ql-editor {
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
}
.mud-dialog .ql-editor.ql-blank::before {
    font-style: normal;
    color: var(--mud-palette-text-disabled);
}
.ql-snow .ql-tooltip {
    z-index: 200000 !important;
}
.ql-snow .ql-picker-options {
    z-index: 200000 !important;
}

/* Table-of-Contents placeholder block inside the editor */
.mud-dialog .ql-editor .ql-toc-placeholder {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 12px 0;
    padding: 12px 14px;
    border: 1px dashed var(--mud-palette-primary);
    border-radius: 8px;
    background: var(--mud-palette-primary-hover, rgba(0, 0, 0, 0.03));
    user-select: none;
}
.mud-dialog .ql-editor .ql-toc-placeholder__icon {
    font-size: 1.05rem;
}
.mud-dialog .ql-editor .ql-toc-placeholder__label {
    font-weight: 600;
}
.mud-dialog .ql-editor .ql-toc-placeholder__hint {
    font-size: 0.8rem;
    color: var(--mud-palette-text-secondary);
}

/* Tables authored through the Quill table module */
.mud-dialog .ql-editor table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
}
.mud-dialog .ql-editor table td,
.mud-dialog .ql-editor table th {
    border: 1px solid var(--mud-palette-divider);
    padding: 6px 10px;
    min-width: 48px;
}

/* --------------------------------------------------------------------------
   Subscription & Billing Pages
   (My Subscription, Change Plan, Usage & Limits, Plan Comparison)
   Editorial: no-line, breathing room, tonal layering, soft glass cards.
   -------------------------------------------------------------------------- */

.subs-page {
    max-width: 1240px;
    margin: 0 auto;
}

.subs-hero {
    margin-bottom: 32px;
}

.subs-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #717c82;
    margin-bottom: 10px;
}

.subs-hero-title {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #2a3439;
    line-height: 1.15;
    margin: 0 0 8px 0;
}

.subs-hero-sub {
    color: #566166;
    font-size: 0.975rem;
    line-height: 1.55;
    max-width: 720px;
    margin: 0;
}

/* Soft glass surface (default card for these pages) */
.subs-card {
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 1px 2px rgba(42, 52, 57, 0.04), 0 8px 28px rgba(42, 52, 57, 0.05);
    overflow: hidden;
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.subs-card--hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 1px 2px rgba(42, 52, 57, 0.05), 0 14px 36px rgba(42, 52, 57, 0.08);
}

.subs-card-body {
    padding: 28px;
}

.subs-card-body--lg {
    padding: 32px;
}

.subs-card-foot {
    padding: 16px 28px 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Status pill */
.subs-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 12px;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.subs-status .subs-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.subs-status-trial   { background: rgba(0, 122, 255, 0.10);  color: #0064c8; }
.subs-status-pending { background: rgba(245, 158, 11, 0.12); color: #b06700; }
.subs-status-active  { background: rgba(16, 163, 100, 0.12); color: #0f7a4a; }
.subs-status-pastdue { background: rgba(220, 50, 50, 0.10);  color: #b32424; }
.subs-status-cancel  { background: rgba(113, 124, 130, 0.12); color: #4a5258; }
.subs-status-expired { background: rgba(113, 124, 130, 0.12); color: #4a5258; }

/* Primary subscription card (current plan) */
.subs-plan-card {
    position: relative;
    background:
        radial-gradient(120% 80% at 0% 0%, rgba(0, 83, 219, 0.05) 0%, rgba(0, 83, 219, 0) 60%),
        linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
}

.subs-plan-eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #717c82;
}

.subs-plan-name {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #2a3439;
    line-height: 1.1;
}

.subs-plan-cycle {
    font-size: 0.875rem;
    font-weight: 600;
    color: #717c82;
    background: #f0f4f7;
    padding: 4px 10px;
    border-radius: 9999px;
}

.subs-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px 28px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #eef2f5;
}

.subs-meta-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    color: #a9b4b9;
    margin-bottom: 6px;
}

.subs-meta-value {
    font-size: 1rem;
    font-weight: 600;
    color: #2a3439;
}

.subs-meta-muted {
    font-size: 0.875rem;
    color: #717c82;
}

/* Wallet side card */
.subs-wallet-card {
    background:
        linear-gradient(135deg, rgba(0, 83, 219, 0.06) 0%, rgba(0, 83, 219, 0) 60%),
        #ffffff;
    height: 100%;
}

.subs-wallet-amount {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #2a3439;
    line-height: 1;
}

.subs-wallet-currency {
    font-size: 1rem;
    font-weight: 600;
    color: #717c82;
    margin-left: 8px;
}

/* Plan grid (Change Plan, empty-state callout) */
.subs-plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.subs-plan-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 1rem;
    padding: 28px 24px 22px;
    box-shadow: 0 1px 2px rgba(42, 52, 57, 0.04), 0 8px 28px rgba(42, 52, 57, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.subs-plan-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 1px 2px rgba(42, 52, 57, 0.05), 0 16px 40px rgba(42, 52, 57, 0.10);
}

.subs-plan-tile--current {
    background:
        linear-gradient(180deg, rgba(0, 83, 219, 0.04) 0%, #ffffff 60%),
        #ffffff;
    box-shadow: 0 0 0 2px #0053db, 0 12px 32px rgba(0, 83, 219, 0.14);
}

.subs-plan-tile--popular {
    box-shadow: 0 0 0 1.5px rgba(0, 83, 219, 0.35), 0 10px 30px rgba(42, 52, 57, 0.08);
}

.subs-plan-tile-ribbon {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #0053db, #0048c1);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 4px 12px;
    border-radius: 9999px;
    box-shadow: 0 6px 16px rgba(0, 83, 219, 0.30);
}

.subs-plan-tile-name {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1.125rem;
    font-weight: 800;
    color: #2a3439;
    letter-spacing: -0.01em;
}

.subs-plan-tile-price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-top: 10px;
}

.subs-plan-tile-price-amount {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: #2a3439;
    letter-spacing: -0.02em;
    line-height: 1;
}

.subs-plan-tile-price-cycle {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #717c82;
}

.subs-plan-tile-desc {
    color: #566166;
    font-size: 0.875rem;
    line-height: 1.5;
    margin-top: 14px;
    min-height: 56px;
}

.subs-plan-tile-features {
    list-style: none;
    padding: 0;
    margin: 14px 0 22px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.subs-plan-tile-features li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.8125rem;
    color: #2a3439;
    line-height: 1.4;
}

.subs-plan-tile-features .subs-feature-icon {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(16, 163, 100, 0.14);
    color: #0f7a4a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    margin-top: 1px;
}

.subs-plan-tile-cta {
    margin-top: auto;
}

/* Billing cycle toggle */
.subs-cycle-switch {
    display: inline-flex;
    align-items: center;
    background: #ffffff;
    padding: 4px;
    border-radius: 9999px;
    box-shadow: 0 1px 2px rgba(42, 52, 57, 0.04), 0 6px 18px rgba(42, 52, 57, 0.05);
}

.subs-cycle-switch button {
    appearance: none;
    border: none;
    background: transparent;
    height: 34px;
    padding: 0 18px;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #566166;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.subs-cycle-switch button:hover {
    color: #2a3439;
}

.subs-cycle-switch button.is-active {
    background: linear-gradient(135deg, #0053db, #0048c1);
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(0, 83, 219, 0.25);
}

.subs-cycle-save {
    background: rgba(16, 163, 100, 0.14);
    color: #0f7a4a;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 8px;
    border-radius: 9999px;
    margin-left: 6px;
}

.subs-cycle-switch button.is-active .subs-cycle-save {
    background: rgba(255, 255, 255, 0.20);
    color: #ffffff;
}

/* Usage page */
.subs-usage-section-title {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #717c82;
    margin: 32px 0 12px;
}

.subs-usage-card {
    background: #ffffff;
    border-radius: 1rem;
    padding: 22px 22px 20px;
    box-shadow: 0 1px 2px rgba(42, 52, 57, 0.04), 0 8px 24px rgba(42, 52, 57, 0.05);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.subs-usage-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #a9b4b9;
}

.subs-usage-value {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-top: 6px;
}

.subs-usage-value-num {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1.625rem;
    font-weight: 800;
    color: #2a3439;
    letter-spacing: -0.01em;
    line-height: 1;
}

.subs-usage-value-limit {
    font-size: 0.875rem;
    font-weight: 600;
    color: #717c82;
}

.subs-usage-bar {
    margin-top: 14px;
    height: 6px;
    background: #eef2f5;
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.subs-usage-bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.4s ease;
}

.subs-usage-bar-fill--ok   { background: linear-gradient(90deg, #0053db, #2178ff); }
.subs-usage-bar-fill--warn { background: linear-gradient(90deg, #f59e0b, #eab308); }
.subs-usage-bar-fill--full { background: linear-gradient(90deg, #dc3232, #ef4444); }

.subs-usage-hint {
    font-size: 0.75rem;
    margin-top: 8px;
    color: #717c82;
}

.subs-usage-hint--warn { color: #b06700; }
.subs-usage-hint--full { color: #b32424; font-weight: 600; }

.subs-usage-bool {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.subs-usage-bool-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.subs-usage-bool-icon--on  { background: rgba(16, 163, 100, 0.14); color: #0f7a4a; }
.subs-usage-bool-icon--off { background: #f0f4f7; color: #a9b4b9; }

.subs-usage-bool-text {
    font-size: 1rem;
    font-weight: 700;
    color: #2a3439;
}

.subs-usage-bool-text--off { color: #717c82; font-weight: 600; }

.subs-usage-reset {
    margin-top: auto;
    padding-top: 12px;
    font-size: 0.7rem;
    color: #a9b4b9;
}

/* Plan comparison table */
.subs-compare-section {
    margin-top: 32px;
}

.subs-compare-section-title {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #717c82;
    margin: 0 0 12px 4px;
}

.subs-compare-card {
    background: #ffffff;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(42, 52, 57, 0.04), 0 8px 24px rgba(42, 52, 57, 0.05);
}

.subs-compare-table {
    width: 100%;
    border-collapse: collapse;
}

.subs-compare-table thead th {
    background: #f7f9fb;
    padding: 16px 20px;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    color: #717c82;
}

.subs-compare-table thead th.subs-compare-th-feature {
    text-align: left;
    width: 32%;
}

.subs-compare-table thead .subs-compare-th-plan-name {
    color: #2a3439;
    font-size: 0.95rem;
    font-weight: 800;
    text-transform: none;
    letter-spacing: -0.01em;
    font-family: 'Vazirmatn', sans-serif;
}

.subs-compare-table thead .subs-compare-th-popular {
    background: linear-gradient(180deg, rgba(0, 83, 219, 0.06) 0%, #f7f9fb 100%);
}

.subs-compare-popular-pill {
    display: inline-block;
    margin-top: 4px;
    background: linear-gradient(135deg, #0053db, #0048c1);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 2px 10px;
    border-radius: 9999px;
}

.subs-compare-table tbody tr + tr td {
    border-top: 1px solid #f0f4f7;
}

.subs-compare-table tbody td {
    padding: 14px 20px;
    font-size: 0.875rem;
    color: #2a3439;
    text-align: center;
    vertical-align: middle;
}

.subs-compare-table tbody td.subs-compare-feature {
    text-align: left;
    color: #566166;
    font-weight: 500;
}

.subs-compare-table tbody td.subs-compare-popular {
    background: rgba(0, 83, 219, 0.025);
}

.subs-compare-feature-unit {
    color: #a9b4b9;
    font-size: 0.75rem;
    margin-left: 4px;
}

.subs-compare-yes {
    color: #0f7a4a;
}

.subs-compare-no {
    color: #c8d0d4;
}

.subs-compare-unlimited {
    font-weight: 700;
    color: #0053db;
}

/* Empty state */
.subs-empty {
    text-align: center;
    padding: 56px 24px;
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 1px 2px rgba(42, 52, 57, 0.04), 0 8px 24px rgba(42, 52, 57, 0.05);
    max-width: 640px;
    margin: 0 auto;
}

.subs-empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 83, 219, 0.10), rgba(0, 83, 219, 0.02));
    color: #0053db;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
}

.subs-empty-title {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: #2a3439;
    letter-spacing: -0.01em;
    margin: 0 0 8px;
}

.subs-empty-text {
    color: #566166;
    font-size: 0.95rem;
    line-height: 1.55;
    margin: 0 0 24px;
}

.subs-empty-actions {
    display: inline-flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Alerts (banner notes) */
.subs-banner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 22px;
    border-radius: 1rem;
    margin-bottom: 24px;
    box-shadow: 0 1px 2px rgba(42, 52, 57, 0.04), 0 8px 24px rgba(42, 52, 57, 0.05);
}

.subs-banner-icon {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.subs-banner-body { line-height: 1.5; }

.subs-banner-title {
    font-weight: 700;
    color: #2a3439;
    margin-bottom: 2px;
}

.subs-banner-text {
    color: #566166;
    font-size: 0.875rem;
}

.subs-banner--info    { background: linear-gradient(180deg, rgba(0, 122, 255, 0.06), #ffffff); }
.subs-banner--info    .subs-banner-icon { background: rgba(0, 122, 255, 0.12); color: #0064c8; }

.subs-banner--warn    { background: linear-gradient(180deg, rgba(245, 158, 11, 0.08), #ffffff); }
.subs-banner--warn    .subs-banner-icon { background: rgba(245, 158, 11, 0.16); color: #b06700; }

.subs-banner--error   { background: linear-gradient(180deg, rgba(220, 50, 50, 0.06), #ffffff); }
.subs-banner--error   .subs-banner-icon { background: rgba(220, 50, 50, 0.12); color: #b32424; }

.subs-banner--neutral { background: linear-gradient(180deg, rgba(113, 124, 130, 0.06), #ffffff); }
.subs-banner--neutral .subs-banner-icon { background: #f0f4f7; color: #566166; }

/* Dark mode */
.mud-theme-dark .subs-card,
.mud-theme-dark .subs-plan-tile,
.mud-theme-dark .subs-usage-card,
.mud-theme-dark .subs-compare-card,
.mud-theme-dark .subs-empty,
.mud-theme-dark .subs-banner,
.mud-theme-dark .subs-cycle-switch {
    background: #1a2025;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.30), 0 8px 24px rgba(0, 0, 0, 0.30);
}

.mud-theme-dark .subs-hero-title,
.mud-theme-dark .subs-plan-name,
.mud-theme-dark .subs-plan-tile-name,
.mud-theme-dark .subs-usage-value-num,
.mud-theme-dark .subs-wallet-amount,
.mud-theme-dark .subs-meta-value,
.mud-theme-dark .subs-usage-bool-text,
.mud-theme-dark .subs-empty-title,
.mud-theme-dark .subs-banner-title {
    color: #e6ebef;
}

.mud-theme-dark .subs-hero-sub,
.mud-theme-dark .subs-plan-tile-desc,
.mud-theme-dark .subs-banner-text,
.mud-theme-dark .subs-empty-text,
.mud-theme-dark .subs-meta-muted {
    color: #a9b4b9;
}

.mud-theme-dark .subs-meta-grid { border-top-color: #2a3439; }
.mud-theme-dark .subs-plan-cycle { background: #2a3439; color: #c2cad0; }
.mud-theme-dark .subs-usage-bar { background: #2a3439; }
.mud-theme-dark .subs-compare-table thead th,
.mud-theme-dark .subs-compare-table thead .subs-compare-th-popular {
    background: #232a30;
    color: #a9b4b9;
}
.mud-theme-dark .subs-compare-table thead .subs-compare-th-plan-name { color: #e6ebef; }
.mud-theme-dark .subs-compare-table tbody tr + tr td { border-top-color: #232a30; }
.mud-theme-dark .subs-compare-table tbody td { color: #e6ebef; }
.mud-theme-dark .subs-compare-table tbody td.subs-compare-feature { color: #a9b4b9; }


/* Image drop zone (paste & drag-and-drop attachment areas) */
.image-drop-zone { position: relative; }
.image-drop-zone .image-drop-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    background: rgba(99, 102, 241, 0.08);
    border: 2px dashed #6366f1;
    border-radius: 12px;
    color: #4338ca;
    font-size: 0.85rem;
    font-weight: 600;
    pointer-events: none;
    z-index: 10;
}
.image-drop-zone.image-drop-active .image-drop-overlay { display: flex; }
.mud-theme-dark .image-drop-zone .image-drop-overlay {
    background: rgba(99, 102, 241, 0.15);
    color: #c7d2fe;
}

/* Red unread-count badge inside the sidebar nav links */
.sidebar-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    margin-left: 8px;
    border-radius: 999px;
    background: #e53935;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.18);
}
[dir="rtl"] .sidebar-unread-badge { margin-left: 0; margin-right: 8px; }

/* Ticket list row styling — distinguish unread / replied vs idle tickets */
.ticket-row-unread {
    background: #fff7ed !important;
    border-left: 3px solid #ef4444;
}
.ticket-row-unread .mud-table-cell { font-weight: 600; }
.ticket-row-awaiting-reply {
    background: #fefce8 !important;
    border-left: 3px solid #f59e0b;
}
.ticket-row-replied {
    background: #f0fdf4 !important;
    border-left: 3px solid #22c55e;
}
.ticket-row-closed { opacity: 0.7; }
.ticket-row-pending {
    background: #f5f3ff !important;
    border-left: 3px solid #8b5cf6;
}

.ticket-new-pill {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    margin-left: 8px;
    border-radius: 999px;
    background: #e53935;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ticket-state-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
}
.ticket-state-pill.unread { background: #fee2e2; color: #b91c1c; }
.ticket-state-pill.awaiting { background: #fef3c7; color: #b45309; }
.ticket-state-pill.replied { background: #dcfce7; color: #166534; }
.ticket-state-pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ------------------------------------------------------------------ */
/* Page Builder — HTML Renderer split editor (code | live preview)    */
/* ------------------------------------------------------------------ */
.hr-split {
    display: flex;
    align-items: stretch;
    width: 100%;
    gap: 0;
    border: 1px solid var(--mud-palette-divider);
    border-radius: 10px;
    overflow: hidden;
    background: var(--mud-palette-surface);
}

.hr-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.hr-pane-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
    background: var(--mud-palette-background-grey);
    border-bottom: 1px solid var(--mud-palette-divider);
    flex: 0 0 auto;
    user-select: none;
}

.hr-pane-header .hr-pane-header-actions { margin-inline-start: auto; }

.hr-code {
    flex: 1 1 auto;
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    padding: 12px 14px;
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.55;
    tab-size: 2;
    white-space: pre;
    overflow: auto;
}
.hr-code::placeholder { color: var(--mud-palette-text-disabled); font-family: inherit; }

.hr-preview-pane { background: #fff; }

.hr-preview {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background:
        linear-gradient(45deg, #f3f4f6 25%, transparent 25%),
        linear-gradient(-45deg, #f3f4f6 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f3f4f6 75%),
        linear-gradient(-45deg, transparent 75%, #f3f4f6 75%);
    background-size: 18px 18px;
    background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

.hr-preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
    display: block;
}

.hr-preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 100%;
    color: var(--mud-palette-text-disabled);
    text-align: center;
    padding: 24px;
    background: var(--mud-palette-surface);
}

/* Draggable gutter */
.hr-gutter {
    flex: 0 0 10px;
    position: relative;
    cursor: col-resize;
    background: var(--mud-palette-background-grey);
    border-inline-start: 1px solid var(--mud-palette-divider);
    border-inline-end: 1px solid var(--mud-palette-divider);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
    touch-action: none;
}
.hr-gutter:hover,
.hr-split--dragging .hr-gutter { background: var(--mud-palette-primary); }

.hr-gutter-grip {
    width: 2px;
    height: 28px;
    border-radius: 2px;
    background: var(--mud-palette-text-disabled);
    box-shadow: 4px 0 0 var(--mud-palette-text-disabled), -4px 0 0 var(--mud-palette-text-disabled);
    pointer-events: none;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.hr-gutter:hover .hr-gutter-grip,
.hr-split--dragging .hr-gutter-grip {
    background: #fff;
    box-shadow: 4px 0 0 #fff, -4px 0 0 #fff;
}

/* Stack vertically on narrow screens */
@media (max-width: 720px) {
    .hr-split { flex-direction: column; }
    .hr-split [data-split-left] { flex-basis: auto !important; height: 45%; }
    .hr-gutter { flex-basis: 10px; width: 100%; cursor: row-resize; }
}


/* Codes and usernames are Latin: type them left-to-right. */
.ltr-input input {
    /* Latin values (codes, usernames, passwords) keep LTR order but start
       from the right edge like every other field in the RTL panel. */
    direction: ltr;
    text-align: right;
}
